|
|
|
@ -137,6 +137,17 @@ public class TopicResourceController {
|
|
|
|
|
sysTopicAndCourse.setId(IdUtil.randomUUID());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (SysTopicAndCourse sysTopicAndCourse : list) {
|
|
|
|
|
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
|
|
|
|
|
example.createCriteria().andTopicIdEqualTo(sysTopicAndCourse.getTopicId())
|
|
|
|
|
.andOneIdEqualTo(sysTopicAndCourse.getOneId())
|
|
|
|
|
.andTwoIdEqualTo(sysTopicAndCourse.getTwoId())
|
|
|
|
|
.andThreeIdEqualTo(sysTopicAndCourse.getThreeId());
|
|
|
|
|
List<SysTopicAndCourse> sysTopicAndCourses = sysTopicAndCourseMapper.selectByExample(example);
|
|
|
|
|
if (sysTopicAndCourses != null && !sysTopicAndCourses.isEmpty()) {
|
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "该章节下已存在此题目!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
sysTopicAndCourseMapper.batchInsert(list);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
@ -159,9 +170,9 @@ public class TopicResourceController {
|
|
|
|
|
@PostMapping("selectTopicByConditions") //todo 关于老师删除的题库如何查询
|
|
|
|
|
private ResultEntity<PageInfo<SysObjectiveQuestionsDto>> selectTopicByConditions(@RequestParam Integer index,
|
|
|
|
|
@RequestParam Integer size,
|
|
|
|
|
@RequestParam (required = false)String oneID,
|
|
|
|
|
@RequestParam (required = false)String twoID,
|
|
|
|
|
@RequestParam (required = false)String threeID,
|
|
|
|
|
@RequestParam(required = false) String oneID,
|
|
|
|
|
@RequestParam(required = false) String twoID,
|
|
|
|
|
@RequestParam(required = false) String threeID,
|
|
|
|
|
@RequestParam(required = false) String type,
|
|
|
|
|
@ApiParam("题干") @RequestParam(required = false) String content) {
|
|
|
|
|
PageHelper.startPage(index, size);
|
|
|
|
@ -185,31 +196,6 @@ public class TopicResourceController {
|
|
|
|
|
List<SysObjectiveQuestionsDto> list = sysObjectiveQuestionMapper.getTopicByConfig(oneID, twoID, threeID, type, content);
|
|
|
|
|
PageInfo<SysObjectiveQuestionsDto> pageInfo = new PageInfo(list);
|
|
|
|
|
return new ResultEntity<PageInfo<SysObjectiveQuestionsDto>>(pageInfo);
|
|
|
|
|
// SysTopicAndCourseExample example = new SysTopicAndCourseExample();
|
|
|
|
|
// SysTopicAndCourseExample.Criteria criteria = example.createCriteria();
|
|
|
|
|
// if (StringUtils.isNotBlank(oneID)) {
|
|
|
|
|
// criteria.andOneIdEqualTo(oneID);
|
|
|
|
|
// }
|
|
|
|
|
// if (StringUtils.isNotBlank(twoID)) {
|
|
|
|
|
// criteria.andTwoIdEqualTo(twoID);
|
|
|
|
|
// }
|
|
|
|
|
// if (StringUtils.isNotBlank(threeID)) {
|
|
|
|
|
// criteria.andThreeIdEqualTo(threeID);
|
|
|
|
|
// }
|
|
|
|
|
// List<SysTopicAndCourse> sysTopicAndCourses = sysTopicAndCourseMapper.selectByExample(example);
|
|
|
|
|
// List<String> collect = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
|
|
|
|
|
// SysObjectiveQuestionsExample example1 = new SysObjectiveQuestionsExample();
|
|
|
|
|
// SysObjectiveQuestionsExample.Criteria criteria1 = example1.createCriteria();
|
|
|
|
|
// if (StringUtils.isNotBlank(type)) {
|
|
|
|
|
// criteria1.andTypeEqualTo(type);
|
|
|
|
|
// }
|
|
|
|
|
// if (StringUtils.isNotBlank(content)) {
|
|
|
|
|
// criteria1.andContentLike(content);
|
|
|
|
|
// }
|
|
|
|
|
// criteria1.andObjectiveIdIn(collect);
|
|
|
|
|
// List<SysObjectiveQuestions> sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByExample(example1);
|
|
|
|
|
// PageInfo pageInfo = PageUtil.pageHelper(sysObjectiveQuestions, index, size);
|
|
|
|
|
// return new ResultEntity<PageInfo<SysObjectiveQuestionsDto>>(pageInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|