修改案例题查询逻辑,加上三级目录条件

master
xiaoCJ 8 months ago
parent ede9a61d9f
commit f5d4eb612b

@ -95,9 +95,11 @@ public class CaseController {
public ResultEntity<PageInfo<SysCaseQuestion>> selectCaseByConditions(@RequestParam Integer index,
@RequestParam Integer size,
@RequestParam(required = false) String title,
@RequestParam(required = false) String oneId) {
@RequestParam(required = false) String oneId,
@RequestParam(required = false) String twoId,
@RequestParam(required = false) String threeId) {
PageHelper.startPage(index, size);
List<SysCaseQuestion> list = caseQuestionMapper.selectCaseByConditions(title, oneId, null);
List<SysCaseQuestion> list = caseQuestionMapper.selectCaseByConditions(title, oneId, null, twoId, threeId);
PageInfo pageInfo = new PageInfo<SysCaseQuestion>(list);
return new ResultEntity<PageInfo<SysCaseQuestion>>(pageInfo);
}
@ -105,11 +107,14 @@ public class CaseController {
@AnonymousAccess
@ApiOperation("案例题页面查询/有重复")
@PostMapping("selectCaseByConditionsByBind")
public ResultEntity<PageInfo<SysCaseQuestion>> selectCaseByConditions(@RequestParam Integer index,
@RequestParam Integer size,
@RequestParam(required = false) String title) {
public ResultEntity<PageInfo<SysCaseQuestion>> selectCaseByConditionsByBind(@RequestParam Integer index,
@RequestParam Integer size,
@RequestParam(required = false) String title,
@RequestParam(required = false) String oneId,
@RequestParam(required = false) String twoId,
@RequestParam(required = false) String threeId) {
PageHelper.startPage(index, size);
List<SysCaseQuestion> list = caseQuestionMapper.selectCaseByConditionsByBind(title);
List<SysCaseQuestion> list = caseQuestionMapper.selectCaseByConditionsByBind(title, oneId, twoId, threeId);
PageInfo pageInfo = new PageInfo<SysCaseQuestion>(list);
return new ResultEntity<PageInfo<SysCaseQuestion>>(pageInfo);
}
@ -132,7 +137,7 @@ public class CaseController {
sysCaseQuestion.setTwoId(sysTopicAndCourse.getTwoId());
sysCaseQuestion.setTwoName(sysTopicAndCourse.getTwoName());
}
if (StringUtils.isNotBlank(sysCaseQuestion.getThreeId())) {
if (StringUtils.isNotBlank(sysTopicAndCourse.getThreeId())) {
sysCaseQuestion.setThreeName(sysTopicAndCourse.getThreeName());
sysCaseQuestion.setThreeId(sysTopicAndCourse.getThreeId());
}
@ -231,13 +236,13 @@ public class CaseController {
@AnonymousAccess
@ApiOperation("批量绑定案例题")
@PostMapping("batchBindCase")
public ResultEntity<String> batchBindCase(@ApiParam("传全部参数")@RequestBody List<SysTopicAndCourse> sysTopicAndCourse) {
public ResultEntity<String> batchBindCase(@ApiParam("传全部参数") @RequestBody List<SysTopicAndCourse> sysTopicAndCourse) {
try {
topicAndCourseMapper.batchInsert(sysTopicAndCourse);
} catch (Exception e) {
e.printStackTrace();
return new ResultEntity<>(HttpStatus.INTERNAL_SERVER_ERROR,"绑定失败,请联系管理员");
return new ResultEntity<>(HttpStatus.INTERNAL_SERVER_ERROR, "绑定失败,请联系管理员");
}
return new ResultEntity<>(HttpStatus.OK,"绑定成功!");
return new ResultEntity<>(HttpStatus.OK, "绑定成功!");
}
}

@ -104,7 +104,7 @@ public class CaseApi {
@RequestParam(required = false) String schoolId) {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
String oneId = sysOneCatalogs.getOneId();
List<SysCaseQuestion> list = caseQuestionMapper.selectCaseByConditions(keyword, oneId, schoolId);
List<SysCaseQuestion> list = caseQuestionMapper.selectCaseByConditions(keyword, oneId, schoolId,null,null);
PageInfo pageInfo1 = PageUtil.pageHelper(list, index, size);
return pageInfo1;
}

@ -6,7 +6,6 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface SysCaseQuestionMapper {
@ -40,7 +39,12 @@ public interface SysCaseQuestionMapper {
List<SysCaseQuestion> selectCaseByConditions(@Param("title") String title,
@Param("oneId") String oneId,
@Param("source") String source);
List<SysCaseQuestion> selectCaseByConditionsByBind(@Param("title") String title);
@Param("source") String source,
@Param("twoId") String twoId,
@Param("threeId") String threeId);
List<SysCaseQuestion> selectCaseByConditionsByBind(@Param("title") String title,
@Param("oneId") String oneId,
@Param("twoId") String twoId,
@Param("threeId") String threeId);
}

@ -444,6 +444,12 @@
<if test="oneId != null and oneId != ''">
st.one_id = #{oneId}
</if>
<if test="twoId != null and twoId != ''">
and st.two_id = #{twoId}
</if>
<if test="threeId != null and threeId != ''">
and st.three_id = #{threeId}
</if>
<if test="title != null and title != ''">
and s.title LIKE CONCAT('%', #{title}, '%')
</if>
@ -467,6 +473,15 @@
<if test="title != null and title != ''">
and s.title LIKE CONCAT('%', #{title}, '%')
</if>
<if test="oneId != null and oneId != ''">
and st.one_id = #{oneId}
</if>
<if test="twoId != null and twoId != ''">
and st.two_id = #{twoId}
</if>
<if test="threeId != null and threeId != ''">
and st.three_id = #{threeId}
</if>
and s.unmount_status is false
</where>
order by s.create_time

Loading…
Cancel
Save