修改班级试卷添加逻辑以支持覆盖旧试卷
parent
ffaea5a15c
commit
1707e3907b
|
|
@ -41,10 +41,12 @@ public class ClassExamPaperAddExe {
|
|||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(ClassExamPaperAddCmd cmd) {
|
||||
Long count = classExamPaperRepository.countByClassId(cmd.getClassId());
|
||||
if (count > 0) {
|
||||
throw new BizException("该班级已存在试卷");
|
||||
}
|
||||
// 先删除老试卷。
|
||||
classExamPaperRepository.deleteByClassId(cmd.getClassId());
|
||||
// Long count = classExamPaperRepository.countByClassId(cmd.getClassId());
|
||||
// if (count > 0) {
|
||||
// throw new BizException("该班级已存在试卷");
|
||||
// }
|
||||
|
||||
|
||||
ClassExamPaperE classExamPaperE = new ClassExamPaperE();
|
||||
|
|
@ -66,11 +68,12 @@ public class ClassExamPaperAddExe {
|
|||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean executeAutoSave(ClassExamPaperAutoAddCmd cmd) {
|
||||
|
||||
Long count = classExamPaperRepository.countByClassId(cmd.getClassId());
|
||||
if (count > 0) {
|
||||
throw new BizException("该班级已存在试卷");
|
||||
}
|
||||
// 先删除老试卷。
|
||||
classExamPaperRepository.deleteByClassId(cmd.getClassId());
|
||||
// Long count = classExamPaperRepository.countByClassId(cmd.getClassId());
|
||||
// if (count > 0) {
|
||||
// throw new BizException("该班级已存在试卷");
|
||||
// }
|
||||
|
||||
ClassExamPaperE classExamPaperE = new ClassExamPaperE();
|
||||
BeanUtils.copyProperties(cmd, classExamPaperE);
|
||||
|
|
|
|||
Loading…
Reference in New Issue