课程和考试的重名检测不过滤下架的数据
This commit is contained in:
parent
fccd063da8
commit
13afe241fa
@ -82,7 +82,7 @@ public class ExamService implements IExamService {
|
|||||||
//检查分数是否合理
|
//检查分数是否合理
|
||||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(checkScore(examDefinitionVO));
|
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 examDefinition = examDefinitionVO.toDB();
|
||||||
examDefinition.setCreatorId(userVO.getId());
|
examDefinition.setCreatorId(userVO.getId());
|
||||||
@ -119,6 +119,9 @@ public class ExamService implements IExamService {
|
|||||||
if (id != null) {
|
if (id != null) {
|
||||||
criteria.andIdNotEqualTo(id);
|
criteria.andIdNotEqualTo(id);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.hasText(status)) {
|
||||||
|
criteria.andStatusEqualTo(status);
|
||||||
|
}
|
||||||
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(examDefinitionDAO.countByExample(example) == 0,
|
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);
|
ExamDefinition examDefinition = this.examDefinitionDAO.selectByPrimaryKey(id);
|
||||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(examDefinition);
|
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.setName(examDefinitionVO.getName());
|
||||||
examDefinition.setTrial(examDefinitionVO.getTrial());
|
examDefinition.setTrial(examDefinitionVO.getTrial());
|
||||||
examDefinition.setStartTime(examDefinitionVO.getStartTime());
|
examDefinition.setStartTime(examDefinitionVO.getStartTime());
|
||||||
|
@ -200,7 +200,7 @@ public class LessonService implements ILessonService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void publish(LessonVO lessonVo, LessonPublishVO publishVO) {
|
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);
|
lessonVo.apply(publishVO);
|
||||||
LsLesson newLesson = lessonVo.toPublic();
|
LsLesson newLesson = lessonVo.toPublic();
|
||||||
newLesson.setUpdateTime(LocalDateTime.now());
|
newLesson.setUpdateTime(LocalDateTime.now());
|
||||||
@ -395,7 +395,7 @@ public class LessonService implements ILessonService {
|
|||||||
public void updateNameAndRemarks(Long id, String name, String remarks, UserVO user) {
|
public void updateNameAndRemarks(Long id, String name, String remarks, UserVO user) {
|
||||||
LsLesson lesson = this.lessonDAO.selectByPrimaryKey(id);
|
LsLesson lesson = this.lessonDAO.selectByPrimaryKey(id);
|
||||||
if (Objects.nonNull(lesson)) {
|
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()),
|
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(sameNameLesson == null || sameNameLesson.getId().equals(lesson.getId()),
|
||||||
"名称重复");
|
"名称重复");
|
||||||
lesson.setName(name);
|
lesson.setName(name);
|
||||||
|
Loading…
Reference in New Issue
Block a user