master
xiaoCJ 8 months ago
parent dfcb513a1b
commit 627e5cc537

@ -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);
}

@ -7,7 +7,6 @@ import lombok.Data;
* @Author xcj
* @Date 2024/6/24
*/
@Data
public class SysObjectiveQuestionsDto extends SysObjectiveQuestions {
private String oneID;
private String twoID;
@ -16,4 +15,60 @@ public class SysObjectiveQuestionsDto extends SysObjectiveQuestions {
private String twoName;
private String threeName;
private String topicAndCourseId;
public String getOneID() {
return oneID;
}
public void setOneID(String oneID) {
this.oneID = oneID;
}
public String getTwoID() {
return twoID;
}
public void setTwoID(String twoID) {
this.twoID = twoID;
}
public String getThreeID() {
return threeID;
}
public void setThreeID(String threeID) {
this.threeID = threeID;
}
public String getOneName() {
return oneName;
}
public void setOneName(String oneName) {
this.oneName = oneName;
}
public String getTwoName() {
return twoName;
}
public void setTwoName(String twoName) {
this.twoName = twoName;
}
public String getThreeName() {
return threeName;
}
public void setThreeName(String threeName) {
this.threeName = threeName;
}
public String getTopicAndCourseId() {
return topicAndCourseId;
}
public void setTopicAndCourseId(String topicAndCourseId) {
this.topicAndCourseId = topicAndCourseId;
}
}

@ -398,7 +398,8 @@
<!-- 条件查询-->
<select id="selectTopicByConditions" parameterType="java.lang.String" resultMap="DtoMap">
SELECT sb.*,st.one_id,st.two_id,st.three_id,st.id,st.one_name,st.two_name,st.three_name
SELECT/* sb.*,st.one_id,st.two_id,st.three_id,st.id,st.one_name,st.two_name,st.three_name*/
sb.*, st.*
FROM sys_objective_questions sb
left JOIN sys_topic_and_course st
on sb.objective_id = st.topic_id
@ -426,8 +427,8 @@
<!-- 条件查询-->
<select id="getTopicByConfig" parameterType="java.lang.String" resultMap="DtoMap">
SELECT sb.*,st.one_id,st.two_id,st.three_id,st.id,st.one_name,st.two_name,st.three_name
FROM sys_topic_and_course st
JOIN sys_objective_questions sb
FROM sys_objective_questions sb
LEFT JOIN sys_topic_and_course st
on sb.objective_id = st.topic_id
<where>
<if test="oneID != null and oneID != ''">

Loading…
Cancel
Save