删除数据处理接口,改用SQL处理数据

This commit is contained in:
thesai 2021-12-28 11:49:37 +08:00
parent 89f6f5ad4d
commit c00fbd22b3
4 changed files with 6 additions and 27 deletions

View File

@ -1,2 +1,7 @@
alter table exam_definition alter table exam_definition
add `system` bit default 0 not null comment '系统生成'; add `system` bit default 0 not null comment '系统生成';
-- 数据处理
UPDATE exam_definition
SET `system` = 1
WHERE
remarks LIKE '%默认试卷'

View File

@ -146,11 +146,6 @@ public class ExamController {
iExamService.updateRules(examDefinitionVO); iExamService.updateRules(examDefinitionVO);
} }
@PutMapping("/handleData/system")
public void updateSystem() {
iExamService.updateSystem();
}
/** /**
* 检查并更新规则数据异常状态 * 检查并更新规则数据异常状态
*/ */

View File

@ -503,26 +503,6 @@ public class ExamService implements IExamService {
} }
} }
@Override
public void updateSystem() {
LsLessonExample lessonExample = new LsLessonExample();
lessonExample.createCriteria().andSysfaultEqualTo(true);
List<Long> lessonIds = lessonDAO.selectByExample(lessonExample)
.stream()
.map(LsLesson::getId)
.collect(Collectors.toList());
ExamDefinitionExample examExample = new ExamDefinitionExample();
examExample.createCriteria().andLessonIdIn(lessonIds);
List<ExamDefinition> exams = examDefinitionDAO.selectByExample(examExample);
for (ExamDefinition exam : exams) {
if (StringUtils.hasText(exam.getRemarks()) && exam.getRemarks().contains("-默认试卷")) {
exam.setSystem(true);
examDefinitionDAO.updateByPrimaryKey(exam);
}
}
}
@Transactional @Transactional
@Override @Override
public void generateExam(long mapId, long lessonId, String prdType, String lessonName, long creatorId) { public void generateExam(long mapId, long lessonId, String prdType, String lessonName, long creatorId) {

View File

@ -127,5 +127,4 @@ public interface IExamService {
*/ */
void regenerateRules(long mapId); void regenerateRules(long mapId);
void updateSystem();
} }