wangwei 6 vuotta sitten
vanhempi
commit
93c941a581

+ 80 - 15
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/ExamController.java

@@ -43,7 +43,7 @@ import cn.com.qmth.examcloud.commons.base.util.JsonUtil;
 import cn.com.qmth.examcloud.commons.web.redis.RedisClient;
 import cn.com.qmth.examcloud.commons.web.security.bean.User;
 import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
-import cn.com.qmth.examcloud.core.examwork.api.controller.bean.CourseGroupBean;
+import cn.com.qmth.examcloud.core.examwork.api.controller.bean.CourseGroupDomain;
 import cn.com.qmth.examcloud.core.examwork.api.controller.bean.ExamDomain;
 import cn.com.qmth.examcloud.core.examwork.base.enums.ExamProperty;
 import cn.com.qmth.examcloud.core.examwork.dao.CourseGroupRelationRepo;
@@ -411,19 +411,28 @@ public class ExamController extends ControllerSupport {
 		}
 	}
 
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param examId
+	 * @param curPage
+	 * @param pageSize
+	 * @return
+	 */
 	@ApiOperation(value = "查询课程组集合", notes = "")
-	@GetMapping("queryCourseGroupList/{examId}/{curPage}/{pageSize}")
-	public List<CourseGroupBean> queryCourseGroupList(@PathVariable Long examId,
+	@GetMapping("getCourseGroupListByExamId/{examId}/{curPage}/{pageSize}")
+	public List<CourseGroupDomain> getCourseGroupListByExamId(@PathVariable Long examId,
 			@PathVariable Integer curPage, @PathVariable Integer pageSize) {
 
 		Pageable pageable = new PageRequest(curPage - 1, pageSize, Sort.Direction.DESC,
 				"updateTime");
 		List<CourseGroupEntity> groupList = courseGroupRepo.findAllByExamId(examId, pageable);
 
-		List<CourseGroupBean> ret = Lists.newArrayList();
+		List<CourseGroupDomain> ret = Lists.newArrayList();
 
 		for (CourseGroupEntity curCourseGroup : groupList) {
-			CourseGroupBean bean = new CourseGroupBean();
+			CourseGroupDomain bean = new CourseGroupDomain();
 			bean.setBeginTime(curCourseGroup.getBeginTime());
 			bean.setCreationTime(curCourseGroup.getCreationTime());
 			bean.setDescription(curCourseGroup.getDescription());
@@ -449,9 +458,17 @@ public class ExamController extends ControllerSupport {
 		return ret;
 	}
 
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param examId
+	 * @param courseId
+	 * @return
+	 */
 	@ApiOperation(value = "通过课程ID查询课程组集合", notes = "")
-	@GetMapping("queryCourseGroupList/{examId}/{courseId}")
-	public List<CourseGroupBean> queryCourseGroupList(@PathVariable Long examId,
+	@GetMapping("getCourseGroupListByExamIdAndCourseId/{examId}/{courseId}")
+	public List<CourseGroupDomain> getCourseGroupListByExamIdAndCourseId(@PathVariable Long examId,
 			@PathVariable Long courseId) {
 
 		List<CourseGroupRelationEntity> relationList = courseGroupRelationRepo
@@ -466,10 +483,10 @@ public class ExamController extends ControllerSupport {
 		List<CourseGroupEntity> groupList = courseGroupRepo
 				.findAllByIdInOrderByUpdateTimeDesc(groupIdList);
 
-		List<CourseGroupBean> ret = Lists.newArrayList();
+		List<CourseGroupDomain> ret = Lists.newArrayList();
 
 		for (CourseGroupEntity curCourseGroup : groupList) {
-			CourseGroupBean bean = new CourseGroupBean();
+			CourseGroupDomain bean = new CourseGroupDomain();
 			bean.setBeginTime(curCourseGroup.getBeginTime());
 			bean.setCreationTime(curCourseGroup.getCreationTime());
 			bean.setDescription(curCourseGroup.getDescription());
@@ -493,9 +510,16 @@ public class ExamController extends ControllerSupport {
 		return ret;
 	}
 
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param courseGroupBean
+	 * @param request
+	 */
 	@ApiOperation(value = "更新课程组", notes = "")
 	@PutMapping("courseGroup")
-	public void updateCourseGroup(@RequestBody CourseGroupBean courseGroupBean,
+	public void updateCourseGroup(@RequestBody CourseGroupDomain courseGroupBean,
 			HttpServletRequest request) {
 
 		CourseGroupEntity courseGroup = new CourseGroupEntity();
@@ -525,13 +549,28 @@ public class ExamController extends ControllerSupport {
 		courseGroupRelationRepo.save(relationList);
 	}
 
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param id
+	 */
 	@ApiOperation(value = "删除课程组", notes = "")
 	@DeleteMapping("courseGroup/{id}")
-	public void deleteSpecificExam(@PathVariable Long id, HttpServletRequest request) {
+	public void deleteCourseGroup(@PathVariable Long id) {
 		courseGroupRepo.delete(id);
 		courseGroupRelationRepo.deleteByGroupId(id);
 	}
 
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param examId
+	 * @param curPage
+	 * @param pageSize
+	 * @return
+	 */
 	@ApiOperation(value = "查询考试相关的学习中心设置", notes = "")
 	@GetMapping("getExamOrgList/{examId}/{curPage}/{pageSize}")
 	public List<?> getExamOrgList(@PathVariable Long examId, @PathVariable Integer curPage,
@@ -542,6 +581,13 @@ public class ExamController extends ControllerSupport {
 		return allByExamId;
 	}
 
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param examOrg
+	 * @return
+	 */
 	@ApiOperation(value = "新增考试相关的学习中心设置", notes = "")
 	@PostMapping("examOrg")
 	public ExamOrgEntity addExamOrg(@RequestBody ExamOrgEntity examOrg) {
@@ -549,6 +595,13 @@ public class ExamController extends ControllerSupport {
 		return ret;
 	}
 
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param examOrg
+	 * @return
+	 */
 	@ApiOperation(value = "更新考试相关的学习中心设置", notes = "")
 	@PutMapping("examOrg")
 	public ExamOrgEntity updateExamOrg(@RequestBody ExamOrgEntity examOrg) {
@@ -556,15 +609,27 @@ public class ExamController extends ControllerSupport {
 		return ret;
 	}
 
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param examId
+	 * @param orgId
+	 */
 	@ApiOperation(value = "删除考试相关的学习中心设置", notes = "")
 	@DeleteMapping("examOrg/{examId}/{orgId}")
 	public void deleteExamOrg(@PathVariable Long examId, @PathVariable Long orgId) {
-		ExamOrgEntity examOrg = new ExamOrgEntity();
-		examOrg.setExamId(examId);
-		examOrg.setOrgId(orgId);
-		examOrgRepo.delete(examOrg);
+		examOrgRepo.deleteByExamIdAndOrgId(examId, orgId);
 	}
 
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param request
+	 * @param examId
+	 * @return
+	 */
 	@ApiOperation(value = "考试IP限制", notes = "")
 	@GetMapping("ipLimit/{examId}")
 	public Map<String, Object> ipLimit(HttpServletRequest request, @PathVariable Long examId) {

+ 1 - 1
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/bean/CourseGroupBean.java → examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/bean/CourseGroupDomain.java

@@ -16,7 +16,7 @@ import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
  * @author WANG
  *
  */
-public class CourseGroupBean implements JsonSerializable {
+public class CourseGroupDomain implements JsonSerializable {
 
 	private static final long serialVersionUID = -3335725218626631530L;
 

+ 5 - 0
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/core/examwork/dao/ExamOrgRepo.java

@@ -21,6 +21,11 @@ public interface ExamOrgRepo
 	@Query("delete from ExamOrgEntity where examId = ?1")
 	void deleteByExamId(Long examId);
 
+	@Transactional
+	@Modifying
+	@Query("delete from ExamOrgEntity where examId = ?1 and orgId = ?2")
+	void deleteByExamIdAndOrgId(Long examId, Long orgId);
+
 	List<ExamOrgEntity> findAllByExamId(Long examId, Pageable pageable);
 
 	List<ExamOrgEntity> findAllByExamIdAndOrgId(Long examId, Long orgId, Pageable pageable);