wangwei 7 anos atrás
pai
commit
b0dae644b0

+ 33 - 33
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/service/examwork/api/ExamApi.java

@@ -34,12 +34,12 @@ import com.google.common.collect.Lists;
 import cn.com.qmth.examcloud.common.support.ControllerSupport;
 import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
 import cn.com.qmth.examcloud.common.util.ErrorMsg;
-import cn.com.qmth.examcloud.service.examwork.dao.CourseGroupRepo;
 import cn.com.qmth.examcloud.service.examwork.dao.ExamRepo;
 import cn.com.qmth.examcloud.service.examwork.dao.ExamStudentRepo;
-import cn.com.qmth.examcloud.service.examwork.entity.CourseGroup;
+import cn.com.qmth.examcloud.service.examwork.dao.SpecificExamRepo;
 import cn.com.qmth.examcloud.service.examwork.entity.Exam;
 import cn.com.qmth.examcloud.service.examwork.entity.ExamStudent;
+import cn.com.qmth.examcloud.service.examwork.entity.SpecificExam;
 import cn.com.qmth.examcloud.service.examwork.enums.ExamType;
 import cn.com.qmth.examcloud.service.examwork.service.ExamService;
 import cn.com.qmth.examcloud.service.examwork.service.ExamStudentService;
@@ -65,7 +65,7 @@ public class ExamApi extends ControllerSupport {
 	ExamStudentService examStudentService;
 
 	@Autowired
-	CourseGroupRepo courseGroupRepo;
+	SpecificExamRepo specificExamRepo;
 
 	@Autowired
 	private JdbcTemplate jdbcTemplate;
@@ -221,19 +221,19 @@ public class ExamApi extends ControllerSupport {
 		return new ResponseEntity(HttpStatus.OK);
 	}
 
-	@ApiOperation(value = "查询课程组", notes = "查询课程组")
-	@GetMapping("/exam/allCourseGroups/{examId}/{curPage}/{pageSize}")
-	public ResponseEntity<?> queryAllCourseGroups(@PathVariable Long examId, @PathVariable Integer curPage,
+	@ApiOperation(value = "查询特殊考试设置", notes = "查询特殊考试设置")
+	@GetMapping("/exam/querySpecificExamList/{examId}/{curPage}/{pageSize}")
+	public ResponseEntity<?> querySpecificExamList(@PathVariable Long examId, @PathVariable Integer curPage,
 			@PathVariable Integer pageSize) {
 
-		List<CourseGroup> groupList = courseGroupRepo.findByExamId(examId, (curPage - 1) * pageSize, pageSize);
+		List<SpecificExam> groupList = specificExamRepo.findByExamId(examId, (curPage - 1) * pageSize, pageSize);
 
-		for (CourseGroup courseGroup : groupList) {
+		for (SpecificExam specificExam : groupList) {
 			List<Long> courseIdList = Lists.newArrayList();
-			courseGroup.setCourseIdList(courseIdList);
+			specificExam.setCourseIdList(courseIdList);
 
 			List<Map<String, Object>> queryList = jdbcTemplate.queryForList(
-					"select t.course_id from ecs_exam_course_group_course t where t.group_id=?", courseGroup.getId());
+					"select t.course_id from ecs_exam_specific_exam_course t where t.specific_exam_id=?", specificExam.getId());
 			if (CollectionUtils.isNotEmpty(queryList)) {
 				for (Map<String, Object> map : queryList) {
 					Long courseId = Long.valueOf(map.get("COURSE_ID").toString());
@@ -242,20 +242,20 @@ public class ExamApi extends ControllerSupport {
 			}
 		}
 
-		return new ResponseEntity<List<CourseGroup>>(groupList, HttpStatus.OK);
+		return new ResponseEntity<List<SpecificExam>>(groupList, HttpStatus.OK);
 	}
 
-	@ApiOperation(value = "查询课程组", notes = "查询课程组")
-	@GetMapping("/exam/queryCourseGroupsByCourseId/{courseId}")
-	public ResponseEntity<?> queryCourseGroupsByCourseId(@PathVariable Long courseId) {
-		List<CourseGroup> groupList = courseGroupRepo.queryCourseGroupsByCourseId(courseId);
+	@ApiOperation(value = "通过课程ID查询特殊考试设置", notes = "通过课程ID查询特殊考试设置")
+	@GetMapping("/exam/querySpecificExamByCourseId/{courseId}")
+	public ResponseEntity<?> querySpecificExamByCourseId(@PathVariable Long courseId) {
+		List<SpecificExam> groupList = specificExamRepo.queryCourseGroupsByCourseId(courseId);
 
-		for (CourseGroup courseGroup : groupList) {
+		for (SpecificExam specificExam : groupList) {
 			List<Long> courseIdList = Lists.newArrayList();
-			courseGroup.setCourseIdList(courseIdList);
+			specificExam.setCourseIdList(courseIdList);
 
 			List<Map<String, Object>> queryList = jdbcTemplate.queryForList(
-					"select t.course_id from ecs_exam_course_group_course t where t.group_id=?", courseGroup.getId());
+					"select t.course_id from ecs_exam_specific_exam_course t where t.specific_exam_id=?", specificExam.getId());
 			if (CollectionUtils.isNotEmpty(queryList)) {
 				for (Map<String, Object> map : queryList) {
 					Long curCourseId = Long.valueOf(map.get("COURSE_ID").toString());
@@ -267,23 +267,23 @@ public class ExamApi extends ControllerSupport {
 		return new ResponseEntity<Object>(groupList, HttpStatus.OK);
 	}
 
-	@ApiOperation(value = "更新课程组", notes = "更新课程组")
-	@PutMapping("/exam/courseGroup")
-	public ResponseEntity<?> updateCourseGroup(@RequestBody CourseGroup courseGroup, HttpServletRequest request) {
+	@ApiOperation(value = "更新特殊考试设置", notes = "更新特殊考试设置")
+	@PutMapping("/exam/specificExam")
+	public ResponseEntity<?> updateSpecificExam(@RequestBody SpecificExam specificExam, HttpServletRequest request) {
 
-		courseGroupRepo.save(courseGroup);
-		Long groupId = courseGroup.getId();
-		Long examId = courseGroup.getExamId();
+		specificExamRepo.save(specificExam);
+		Long specificExamId = specificExam.getId();
+		Long examId = specificExam.getExamId();
 
-		List<Long> courseIdList = courseGroup.getCourseIdList();
-		jdbcTemplate.update("delete from ecs_exam_course_group_course  where group_id=?", groupId);
+		List<Long> courseIdList = specificExam.getCourseIdList();
+		jdbcTemplate.update("delete from ecs_exam_specific_exam_course  where specific_exam_id=?", specificExamId);
 
 		if (CollectionUtils.isNotEmpty(courseIdList)) {
 			for (Long courseId : courseIdList) {
-				jdbcTemplate.update("delete from ecs_exam_course_group_course  where exam_id=? and course_id=?",
-						groupId, courseId);
+				jdbcTemplate.update("delete from ecs_exam_specific_exam_course  where exam_id=? and course_id=?",
+						specificExamId, courseId);
 				jdbcTemplate.update(
-						"insert into ecs_exam_course_group_course(group_id,course_id,exam_id) values(?,?,?)", groupId,
+						"insert into ecs_exam_specific_exam_course(specific_exam_id,course_id,exam_id) values(?,?,?)", specificExamId,
 						courseId, examId);
 			}
 		}
@@ -291,10 +291,10 @@ public class ExamApi extends ControllerSupport {
 		return new ResponseEntity<Object>(HttpStatus.OK);
 	}
 
-	@ApiOperation(value = "删除课程组", notes = "添加课程组")
-	@DeleteMapping("/exam/courseGroup/{id}")
-	public ResponseEntity<?> CourseGroup(@PathVariable Long id, HttpServletRequest request) {
-		courseGroupRepo.delete(id);
+	@ApiOperation(value = "删除特殊考试设置", notes = "删除特殊考试设置")
+	@DeleteMapping("/exam/specificExam/{id}")
+	public ResponseEntity<?> deleteSpecificExam(@PathVariable Long id, HttpServletRequest request) {
+		specificExamRepo.delete(id);
 		jdbcTemplate.update("delete from ecs_exam_course_group_course  where group_id=?", id);
 		return new ResponseEntity<Object>(HttpStatus.OK);
 	}

+ 0 - 21
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/service/examwork/dao/CourseGroupRepo.java

@@ -1,21 +0,0 @@
-package cn.com.qmth.examcloud.service.examwork.dao;
-
-import java.util.List;
-
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.data.repository.query.QueryByExampleExecutor;
-
-import cn.com.qmth.examcloud.service.examwork.entity.CourseGroup;
-
-public interface CourseGroupRepo extends JpaRepository<CourseGroup, Long>, QueryByExampleExecutor<CourseGroup> {
-
-	@Query(value = "select * from ecs_exam_course_group t where t.exam_id=?1 order by id desc limit ?2,?3", nativeQuery = true)
-	List<CourseGroup> findByExamId(@Param("examId") Long examId, @Param("curPage") Integer curPage,
-			@Param("pageSize") Integer pageSize);
-
-	@Query(value = "select x.* from ecs_exam_course_group x,ecs_exam_course_group_course  y where x.id=y.group_id and y.course_id=?1", nativeQuery = true)
-	List<CourseGroup> queryCourseGroupsByCourseId(@Param("courseId") Long courseId);
-
-}

+ 12 - 0
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/service/examwork/dao/SpecificExamCourseRepo.java

@@ -0,0 +1,12 @@
+package cn.com.qmth.examcloud.service.examwork.dao;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.repository.query.QueryByExampleExecutor;
+
+import cn.com.qmth.examcloud.service.examwork.entity.SpecificExamCourse;
+import cn.com.qmth.examcloud.service.examwork.entity.SpecificExamCoursePK;
+
+public interface SpecificExamCourseRepo
+		extends JpaRepository<SpecificExamCourse, SpecificExamCoursePK>, QueryByExampleExecutor<SpecificExamCourse> {
+
+}

+ 21 - 0
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/service/examwork/dao/SpecificExamRepo.java

@@ -0,0 +1,21 @@
+package cn.com.qmth.examcloud.service.examwork.dao;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.data.repository.query.QueryByExampleExecutor;
+
+import cn.com.qmth.examcloud.service.examwork.entity.SpecificExam;
+
+public interface SpecificExamRepo extends JpaRepository<SpecificExam, Long>, QueryByExampleExecutor<SpecificExam> {
+
+	@Query(value = "select * from ecs_exam_specific_exam t where t.exam_id=?1 order by id desc limit ?2,?3", nativeQuery = true)
+	List<SpecificExam> findByExamId(@Param("examId") Long examId, @Param("curPage") Integer curPage,
+			@Param("pageSize") Integer pageSize);
+
+	@Query(value = "select x.* from ecs_exam_specific_exam x,ecs_exam_specific_exam_course  y where x.id=y.specific_exam_id and y.course_id=?1", nativeQuery = true)
+	List<SpecificExam> queryCourseGroupsByCourseId(@Param("courseId") Long courseId);
+
+}

+ 3 - 3
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/service/examwork/entity/CourseGroup.java → examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/service/examwork/entity/SpecificExam.java

@@ -13,14 +13,14 @@ import javax.persistence.Transient;
 import org.springframework.format.annotation.DateTimeFormat;
 
 /**
- * 课程组
+ * 特殊考试
  * 
  * @author WANG
  *
  */
 @Entity
-@Table(name = "ecs_exam_course_group")
-public class CourseGroup implements Serializable {
+@Table(name = "ecs_exam_specific_exam")
+public class SpecificExam implements Serializable {
 
 	private static final long serialVersionUID = -3335725218626631530L;
 

+ 55 - 0
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/service/examwork/entity/SpecificExamCourse.java

@@ -0,0 +1,55 @@
+package cn.com.qmth.examcloud.service.examwork.entity;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.Table;
+
+/**
+ * 特殊考试课程关联
+ * 
+ * @author WANG
+ *
+ */
+@Entity
+@Table(name = "ecs_exam_specific_exam_course")
+@IdClass(SpecificExamCoursePK.class)
+public class SpecificExamCourse implements Serializable {
+
+	private static final long serialVersionUID = -3335725218626631530L;
+
+	@Id
+	private String specificExamId;
+
+	@Id
+	private String courseId;
+
+	private Long examId;
+
+	public String getSpecificExamId() {
+		return specificExamId;
+	}
+
+	public void setSpecificExamId(String specificExamId) {
+		this.specificExamId = specificExamId;
+	}
+
+	public String getCourseId() {
+		return courseId;
+	}
+
+	public void setCourseId(String courseId) {
+		this.courseId = courseId;
+	}
+
+	public Long getExamId() {
+		return examId;
+	}
+
+	public void setExamId(Long examId) {
+		this.examId = examId;
+	}
+
+}

+ 35 - 0
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/service/examwork/entity/SpecificExamCoursePK.java

@@ -0,0 +1,35 @@
+package cn.com.qmth.examcloud.service.examwork.entity;
+
+import java.io.Serializable;
+
+/**
+ * 特殊考试课程关联 主键
+ * 
+ * @author WANG
+ *
+ */
+public class SpecificExamCoursePK implements Serializable {
+
+	private static final long serialVersionUID = 2741694459442340816L;
+
+	private String specificExamId;
+
+	private String courseId;
+
+	public String getSpecificExamId() {
+		return specificExamId;
+	}
+
+	public void setSpecificExamId(String specificExamId) {
+		this.specificExamId = specificExamId;
+	}
+
+	public String getCourseId() {
+		return courseId;
+	}
+
+	public void setCourseId(String courseId) {
+		this.courseId = courseId;
+	}
+
+}