|
@@ -127,16 +127,16 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
}
|
|
}
|
|
examStudentRepo.delete(examStudent);
|
|
examStudentRepo.delete(examStudent);
|
|
|
|
|
|
- int countCourseId = examStudentRepo.countByExamIdAndCourseId(examStudent.getExamId(),
|
|
|
|
- examStudent.getCourseId());
|
|
|
|
- if (1 > countCourseId) {
|
|
|
|
|
|
+ List<ExamStudentEntity> top2 = examStudentRepo.findTop2ByExamIdAndCourseId(
|
|
|
|
+ examStudent.getExamId(), examStudent.getCourseId());
|
|
|
|
+ if (1 > top2.size()) {
|
|
examCourseRelationRepo.deleteByExamIdAndCourseId(examStudent.getExamId(),
|
|
examCourseRelationRepo.deleteByExamIdAndCourseId(examStudent.getExamId(),
|
|
examStudent.getCourseId());
|
|
examStudent.getCourseId());
|
|
}
|
|
}
|
|
|
|
|
|
- int countPaperType = examStudentRepo.countByExamIdAndCourseIdAndPaperType(
|
|
|
|
- examStudent.getExamId(), examStudent.getCourseId(), examStudent.getPaperType());
|
|
|
|
- if (1 > countPaperType) {
|
|
|
|
|
|
+ top2 = examStudentRepo.findTop2ByExamIdAndCourseIdAndPaperType(examStudent.getExamId(),
|
|
|
|
+ examStudent.getCourseId(), examStudent.getPaperType());
|
|
|
|
+ if (1 > top2.size()) {
|
|
examPaperTypeRelationRepo.deleteByExamIdAndCourseIdAndPaperType(
|
|
examPaperTypeRelationRepo.deleteByExamIdAndCourseIdAndPaperType(
|
|
examStudent.getExamId(), examStudent.getCourseId(),
|
|
examStudent.getExamId(), examStudent.getCourseId(),
|
|
examStudent.getPaperType());
|
|
examStudent.getPaperType());
|
|
@@ -263,20 +263,16 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
examStudent = new ExamStudentEntity();
|
|
examStudent = new ExamStudentEntity();
|
|
examStudent.setEnable(true);
|
|
examStudent.setEnable(true);
|
|
} else {
|
|
} 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.deleteByExamIdAndCourseIdAndPaperType(
|
|
|
|
-// examStudent.getExamId(), examStudent.getCourseId(),
|
|
|
|
-// examStudent.getPaperType());
|
|
|
|
-// }
|
|
|
|
|
|
+ if (!paperType.equals(examStudent.getPaperType())) {
|
|
|
|
+ List<ExamStudentEntity> top2 = examStudentRepo
|
|
|
|
+ .findTop2ByExamIdAndCourseIdAndPaperType(examStudent.getExamId(),
|
|
|
|
+ examStudent.getCourseId(), examStudent.getPaperType());
|
|
|
|
+ if (2 > top2.size()) {
|
|
|
|
+ examPaperTypeRelationRepo.deleteByExamIdAndCourseIdAndPaperType(
|
|
|
|
+ examStudent.getExamId(), examStudent.getCourseId(),
|
|
|
|
+ examStudent.getPaperType());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
examStudent.setInfoCollector(examStudentInfo.getInfoCollector());
|
|
examStudent.setInfoCollector(examStudentInfo.getInfoCollector());
|