wangwei преди 7 години
родител
ревизия
7b957ffc22

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

@@ -37,10 +37,10 @@ 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.ExamRepo;
 import cn.com.qmth.examcloud.service.examwork.dao.ExamStudentRepo;
-import cn.com.qmth.examcloud.service.examwork.dao.SpecificExamRepo;
+import cn.com.qmth.examcloud.service.examwork.dao.ExamSetting4CourseRepo;
 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.entity.ExamSetting4Course;
 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;
@@ -66,7 +66,7 @@ public class ExamApi extends ControllerSupport {
 	ExamStudentService examStudentService;
 
 	@Autowired
-	SpecificExamRepo specificExamRepo;
+	ExamSetting4CourseRepo examSetting4CourseRepo;
 
 	@Autowired
 	private JdbcTemplate jdbcTemplate;
@@ -257,14 +257,14 @@ public class ExamApi extends ControllerSupport {
 	public ResponseEntity<?> querySpecificExamList(@PathVariable Long examId, @PathVariable Integer curPage,
 			@PathVariable Integer pageSize) {
 
-		List<SpecificExam> groupList = specificExamRepo.findByExamId(examId, (curPage - 1) * pageSize, pageSize);
+		List<ExamSetting4Course> groupList = examSetting4CourseRepo.findByExamId(examId, (curPage - 1) * pageSize, pageSize);
 
-		for (SpecificExam specificExam : groupList) {
+		for (ExamSetting4Course specificExam : groupList) {
 			List<Long> courseIdList = Lists.newArrayList();
 			specificExam.setCourseIdList(courseIdList);
 
 			List<Map<String, Object>> queryList = jdbcTemplate.queryForList(
-					"select t.course_id from ecs_exam_specific_exam_course t where t.specific_exam_id=?", specificExam.getId());
+					"select t.course_id from ecs_e_exam_course_relation 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());
@@ -273,20 +273,20 @@ public class ExamApi extends ControllerSupport {
 			}
 		}
 
-		return new ResponseEntity<List<SpecificExam>>(groupList, HttpStatus.OK);
+		return new ResponseEntity<List<ExamSetting4Course>>(groupList, HttpStatus.OK);
 	}
 
 	@ApiOperation(value = "通过课程ID查询特殊考试设置", notes = "通过课程ID查询特殊考试设置")
 	@GetMapping("/exam/querySpecificExamByCourseId/{courseId}")
 	public ResponseEntity<?> querySpecificExamByCourseId(@PathVariable Long courseId) {
-		List<SpecificExam> groupList = specificExamRepo.queryCourseGroupsByCourseId(courseId);
+		List<ExamSetting4Course> groupList = examSetting4CourseRepo.queryCourseGroupsByCourseId(courseId);
 
-		for (SpecificExam specificExam : groupList) {
+		for (ExamSetting4Course specificExam : groupList) {
 			List<Long> courseIdList = Lists.newArrayList();
 			specificExam.setCourseIdList(courseIdList);
 
 			List<Map<String, Object>> queryList = jdbcTemplate.queryForList(
-					"select t.course_id from ecs_exam_specific_exam_course t where t.specific_exam_id=?", specificExam.getId());
+					"select t.course_id from ecs_e_exam_course_relation 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());
@@ -300,21 +300,21 @@ public class ExamApi extends ControllerSupport {
 
 	@ApiOperation(value = "更新特殊考试设置", notes = "更新特殊考试设置")
 	@PutMapping("/exam/specificExam")
-	public ResponseEntity<?> updateSpecificExam(@RequestBody SpecificExam specificExam, HttpServletRequest request) {
+	public ResponseEntity<?> updateSpecificExam(@RequestBody ExamSetting4Course specificExam, HttpServletRequest request) {
 
-		specificExamRepo.save(specificExam);
+		examSetting4CourseRepo.save(specificExam);
 		Long specificExamId = specificExam.getId();
 		Long examId = specificExam.getExamId();
 
 		List<Long> courseIdList = specificExam.getCourseIdList();
-		jdbcTemplate.update("delete from ecs_exam_specific_exam_course  where specific_exam_id=?", specificExamId);
+		jdbcTemplate.update("delete from ecs_e_exam_course_relation  where specific_exam_id=?", specificExamId);
 
 		if (CollectionUtils.isNotEmpty(courseIdList)) {
 			for (Long courseId : courseIdList) {
-				jdbcTemplate.update("delete from ecs_exam_specific_exam_course  where exam_id=? and course_id=?",
+				jdbcTemplate.update("delete from ecs_e_exam_course_relation  where exam_id=? and course_id=?",
 						specificExamId, courseId);
 				jdbcTemplate.update(
-						"insert into ecs_exam_specific_exam_course(specific_exam_id,course_id,exam_id) values(?,?,?)", specificExamId,
+						"insert into ecs_e_exam_course_relation(specific_exam_id,course_id,exam_id) values(?,?,?)", specificExamId,
 						courseId, examId);
 			}
 		}
@@ -325,8 +325,8 @@ public class ExamApi extends ControllerSupport {
 	@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);
+		examSetting4CourseRepo.delete(id);
+		jdbcTemplate.update("delete from ecs_e_exam_course_relation  where group_id=?", id);
 		return new ResponseEntity<Object>(HttpStatus.OK);
 	}
 }

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

@@ -0,0 +1,22 @@
+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.ExamSetting4Course;
+
+public interface ExamSetting4CourseRepo
+		extends JpaRepository<ExamSetting4Course, Long>, QueryByExampleExecutor<ExamSetting4Course> {
+
+	@Query(value = "select * from ecs_e_exam_4_course t where t.exam_id=?1 order by id desc limit ?2,?3", nativeQuery = true)
+	List<ExamSetting4Course> findByExamId(@Param("examId") Long examId, @Param("curPage") Integer curPage,
+			@Param("pageSize") Integer pageSize);
+
+	@Query(value = "select x.* from ecs_e_exam_4_course x,ecs_e_exam_course_relation  y where x.id=y.specific_exam_id and y.course_id=?1", nativeQuery = true)
+	List<ExamSetting4Course> queryCourseGroupsByCourseId(@Param("courseId") Long courseId);
+
+}

+ 12 - 0
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/service/examwork/dao/ExamSettingCourseRelationRepo.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.ExamSettingCourseRelation;
+import cn.com.qmth.examcloud.service.examwork.entity.ExamSettingCourseRelationPK;
+
+public interface ExamSettingCourseRelationRepo
+		extends JpaRepository<ExamSettingCourseRelation, ExamSettingCourseRelationPK>, QueryByExampleExecutor<ExamSettingCourseRelation> {
+
+}

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

@@ -1,12 +0,0 @@
-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> {
-
-}

+ 0 - 21
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/service/examwork/dao/SpecificExamRepo.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.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);
-
-}

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

@@ -0,0 +1,108 @@
+package cn.com.qmth.examcloud.service.examwork.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import org.springframework.format.annotation.DateTimeFormat;
+
+/**
+ * 考试-课程
+ * 
+ * @author WANG
+ *
+ */
+@Entity
+@Table(name = "ecs_e_exam_4_course")
+public class ExamSetting4Course implements Serializable {
+
+	private static final long serialVersionUID = -3335725218626631530L;
+
+	@Id
+	@GeneratedValue
+	private Long id;
+
+	private Long examId;
+
+	private String name;
+
+	private String description;
+
+	@Transient
+	private List<Long> courseIdList;
+
+	/**
+	 * 考试批次开始时间
+	 */
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	private Date beginTime;
+
+	/**
+	 * 考试批次结束时间
+	 */
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	private Date endTime;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getExamId() {
+		return examId;
+	}
+
+	public void setExamId(Long examId) {
+		this.examId = examId;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public List<Long> getCourseIdList() {
+		return courseIdList;
+	}
+
+	public void setCourseIdList(List<Long> courseIdList) {
+		this.courseIdList = courseIdList;
+	}
+
+	public Date getBeginTime() {
+		return beginTime;
+	}
+
+	public void setBeginTime(Date beginTime) {
+		this.beginTime = beginTime;
+	}
+
+	public Date getEndTime() {
+		return endTime;
+	}
+
+	public void setEndTime(Date endTime) {
+		this.endTime = endTime;
+	}
+
+}

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

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

+ 4 - 4
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/service/examwork/entity/SpecificExamCourse.java → examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/service/examwork/entity/ExamSettingCourseRelation.java

@@ -8,15 +8,15 @@ 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 {
+@Table(name = "ecs_e_exam_course_relation")
+@IdClass(ExamSettingCourseRelationPK.class)
+public class ExamSettingCourseRelation implements Serializable {
 
 	private static final long serialVersionUID = -3335725218626631530L;
 

+ 2 - 2
examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/service/examwork/entity/SpecificExamCoursePK.java → examcloud-core-examwork-dao/src/main/java/cn/com/qmth/examcloud/service/examwork/entity/ExamSettingCourseRelationPK.java

@@ -3,12 +3,12 @@ package cn.com.qmth.examcloud.service.examwork.entity;
 import java.io.Serializable;
 
 /**
- * 特殊考试课程关联 主键
+ * 考试课程关联 主键
  * 
  * @author WANG
  *
  */
-public class SpecificExamCoursePK implements Serializable {
+public class ExamSettingCourseRelationPK implements Serializable {
 
 	private static final long serialVersionUID = 2741694459442340816L;