From 13afe241fa94ff561c9b83a488aea05470975558 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Tue, 30 Mar 2021 13:22:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=92=8C=E8=80=83=E8=AF=95?= =?UTF-8?q?=E7=9A=84=E9=87=8D=E5=90=8D=E6=A3=80=E6=B5=8B=E4=B8=8D=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E4=B8=8B=E6=9E=B6=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/club/joylink/rtss/services/ExamService.java | 7 +++++-- .../java/club/joylink/rtss/services/LessonService.java | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/ExamService.java b/src/main/java/club/joylink/rtss/services/ExamService.java index 522a33093..ec52b4b03 100644 --- a/src/main/java/club/joylink/rtss/services/ExamService.java +++ b/src/main/java/club/joylink/rtss/services/ExamService.java @@ -82,7 +82,7 @@ public class ExamService implements IExamService { //检查分数是否合理 BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(checkScore(examDefinitionVO)); //检查考试名称是否唯一 - confirmNameUnique(null, examDefinitionVO.getMapId(), examDefinitionVO.getPrdType(), examDefinitionVO.getName(), BusinessConsts.STATUS_USE); + confirmNameUnique(null, examDefinitionVO.getMapId(), examDefinitionVO.getPrdType(), examDefinitionVO.getName(), null); //插入考试定义表数据 ExamDefinition examDefinition = examDefinitionVO.toDB(); examDefinition.setCreatorId(userVO.getId()); @@ -119,6 +119,9 @@ public class ExamService implements IExamService { if (id != null) { criteria.andIdNotEqualTo(id); } + if (StringUtils.hasText(status)) { + criteria.andStatusEqualTo(status); + } BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(examDefinitionDAO.countByExample(example) == 0, "名称重复"); } @@ -387,7 +390,7 @@ public class ExamService implements IExamService { ExamDefinition examDefinition = this.examDefinitionDAO.selectByPrimaryKey(id); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(examDefinition); //考试名称查重 - confirmNameUnique(examDefinition.getId(), examDefinition.getMapId(), examDefinition.getType(), examDefinitionVO.getName(), BusinessConsts.STATUS_USE); + confirmNameUnique(examDefinition.getId(), examDefinition.getMapId(), examDefinition.getType(), examDefinitionVO.getName(), null); examDefinition.setName(examDefinitionVO.getName()); examDefinition.setTrial(examDefinitionVO.getTrial()); examDefinition.setStartTime(examDefinitionVO.getStartTime()); diff --git a/src/main/java/club/joylink/rtss/services/LessonService.java b/src/main/java/club/joylink/rtss/services/LessonService.java index 3d003c870..a0270ec10 100644 --- a/src/main/java/club/joylink/rtss/services/LessonService.java +++ b/src/main/java/club/joylink/rtss/services/LessonService.java @@ -200,7 +200,7 @@ public class LessonService implements ILessonService { @Override @Transactional public void publish(LessonVO lessonVo, LessonPublishVO publishVO) { - LsLesson publishedLesson = this.findEntity(publishVO.getMapId(), publishVO.getName(), publishVO.getPrdType(), BusinessConsts.STATUS_USE); + LsLesson publishedLesson = this.findEntity(publishVO.getMapId(), publishVO.getName(), publishVO.getPrdType(), null); lessonVo.apply(publishVO); LsLesson newLesson = lessonVo.toPublic(); newLesson.setUpdateTime(LocalDateTime.now()); @@ -395,7 +395,7 @@ public class LessonService implements ILessonService { public void updateNameAndRemarks(Long id, String name, String remarks, UserVO user) { LsLesson lesson = this.lessonDAO.selectByPrimaryKey(id); if (Objects.nonNull(lesson)) { - LsLesson sameNameLesson = findEntity(lesson.getMapId(), name, lesson.getPrdType(), BusinessConsts.STATUS_USE); + LsLesson sameNameLesson = findEntity(lesson.getMapId(), name, lesson.getPrdType(), null); BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(sameNameLesson == null || sameNameLesson.getId().equals(lesson.getId()), "名称重复"); lesson.setName(name);