考试创建同规则删除

This commit is contained in:
DU 2021-01-12 18:51:53 +08:00
parent 62739021be
commit 37c0cee2ae
2 changed files with 10 additions and 9 deletions

View File

@ -8,7 +8,6 @@ import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.LessonVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.company.*;
import club.joylink.rtss.vo.client.student.StudentClassVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -69,7 +69,7 @@ public class ExamService implements IExamService{
//检查分数是否合理
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(checkScore(examDefinitionVO));
//检查考试名称和考试规则是否唯一
checkExam(examDefinitionVO);
checkName(examDefinitionVO);
//插入考试定义表数据
ExamDefinition examDefinition = examDefinitionVO.toDB();
examDefinition.setCreateTime(LocalDateTime.now());
@ -175,13 +175,13 @@ public class ExamService implements IExamService{
// definitionRulesDAO.insert(examDefinitionRules);
// });
// }
// private void checkName(ExamDefinitionVO examDefinitionVO) {
// //一个课程下考试名称查重
// ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample();
// examDefinitionExample.createCriteria().andLessonIdEqualTo(examDefinitionVO.getLessonId()).andNameEqualTo(examDefinitionVO.getName());
// List<ExamDefinition> examDefinitionList = examDefinitionDAO.selectByExample(examDefinitionExample);
// BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertCollectionEmpty(examDefinitionList);
// }
private void checkName(ExamDefinitionVO examDefinitionVO) {
//一个课程下考试名称查重
ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample();
examDefinitionExample.createCriteria().andLessonIdEqualTo(examDefinitionVO.getLessonId()).andNameEqualTo(examDefinitionVO.getName());
List<ExamDefinition> examDefinitionList = examDefinitionDAO.selectByExample(examDefinitionExample);
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertCollectionEmpty(examDefinitionList);
}
/**
* 检查考试定义及规则分数是否合理
@ -503,6 +503,8 @@ public class ExamService implements IExamService{
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertCollectionEmpty(examDefinitionList);
examDefinition.setName(examDefinitionVO.getName());
examDefinition.setTrial(examDefinitionVO.getTrial());
examDefinition.setStartTime(examDefinitionVO.getStartTime());
examDefinition.setEndTime(examDefinitionVO.getEndTime());
this.examDefinitionDAO.updateByPrimaryKey(examDefinition);
}