From 1707e3907bf8c721d6aba162c66202d11542154f Mon Sep 17 00:00:00 2001 From: zhangyue Date: Tue, 10 Mar 2026 18:23:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=8F=AD=E7=BA=A7=E8=AF=95?= =?UTF-8?q?=E5=8D=B7=E6=B7=BB=E5=8A=A0=E9=80=BB=E8=BE=91=E4=BB=A5=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=A6=86=E7=9B=96=E6=97=A7=E8=AF=95=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../command/study/ClassExamPaperAddExe.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/web-app/src/main/java/com/zcloud/edu/command/study/ClassExamPaperAddExe.java b/web-app/src/main/java/com/zcloud/edu/command/study/ClassExamPaperAddExe.java index 3d5fe95..5f50b6a 100644 --- a/web-app/src/main/java/com/zcloud/edu/command/study/ClassExamPaperAddExe.java +++ b/web-app/src/main/java/com/zcloud/edu/command/study/ClassExamPaperAddExe.java @@ -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);