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