|
@@ -126,6 +126,21 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
throw new StatusException("E-150112", examStudent.getName() + "已开始考试,不能删除");
|
|
|
}
|
|
|
examStudentRepo.delete(examStudent);
|
|
|
+
|
|
|
+ int countCourseId = examStudentRepo.countByExamIdAndCourseId(examStudent.getExamId(),
|
|
|
+ examStudent.getCourseId());
|
|
|
+ if (1 > countCourseId) {
|
|
|
+ examCourseRelationRepo.deleteByExamIdAndCourseId(examStudent.getExamId(),
|
|
|
+ examStudent.getCourseId());
|
|
|
+ }
|
|
|
+
|
|
|
+ int countPaperType = examStudentRepo.countByExamIdAndCourseIdAndPaperType(
|
|
|
+ examStudent.getExamId(), examStudent.getCourseId(), examStudent.getPaperType());
|
|
|
+ if (1 > countPaperType) {
|
|
|
+ examPaperTypeRelationRepo.deleteByExamIdAndCourseIdAndPageType(
|
|
|
+ examStudent.getExamId(), examStudent.getCourseId(),
|
|
|
+ examStudent.getPaperType());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
for (ExamStudentEntity cur : examStudents) {
|
|
@@ -247,6 +262,21 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
if (null == examStudent) {
|
|
|
examStudent = new ExamStudentEntity();
|
|
|
examStudent.setEnable(true);
|
|
|
+ } else {
|
|
|
+ int countCourseId = examStudentRepo.countByExamIdAndCourseId(examStudent.getExamId(),
|
|
|
+ examStudent.getCourseId());
|
|
|
+ if (2 > countCourseId) {
|
|
|
+ examCourseRelationRepo.deleteByExamIdAndCourseId(examStudent.getExamId(),
|
|
|
+ examStudent.getCourseId());
|
|
|
+ }
|
|
|
+
|
|
|
+ int countPaperType = examStudentRepo.countByExamIdAndCourseIdAndPaperType(
|
|
|
+ examStudent.getExamId(), examStudent.getCourseId(), examStudent.getPaperType());
|
|
|
+ if (2 > countPaperType) {
|
|
|
+ examPaperTypeRelationRepo.deleteByExamIdAndCourseIdAndPageType(
|
|
|
+ examStudent.getExamId(), examStudent.getCourseId(),
|
|
|
+ examStudent.getPaperType());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
examStudent.setInfoCollector(examStudentInfo.getInfoCollector());
|