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

master
xiaoCJ 8 months ago
parent ede9a61d9f
commit f5d4eb612b

@ -95,9 +95,11 @@ public class CaseController {
public ResultEntity<PageInfo<SysCaseQuestion>> selectCaseByConditions(@RequestParam Integer index, public ResultEntity<PageInfo<SysCaseQuestion>> selectCaseByConditions(@RequestParam Integer index,
@RequestParam Integer size, @RequestParam Integer size,
@RequestParam(required = false) String title, @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); 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); PageInfo pageInfo = new PageInfo<SysCaseQuestion>(list);
return new ResultEntity<PageInfo<SysCaseQuestion>>(pageInfo); return new ResultEntity<PageInfo<SysCaseQuestion>>(pageInfo);
} }
@ -105,11 +107,14 @@ public class CaseController {
@AnonymousAccess @AnonymousAccess
@ApiOperation("案例题页面查询/有重复") @ApiOperation("案例题页面查询/有重复")
@PostMapping("selectCaseByConditionsByBind") @PostMapping("selectCaseByConditionsByBind")
public ResultEntity<PageInfo<SysCaseQuestion>> selectCaseByConditions(@RequestParam Integer index, public ResultEntity<PageInfo<SysCaseQuestion>> selectCaseByConditionsByBind(@RequestParam Integer index,
@RequestParam Integer size, @RequestParam Integer size,
@RequestParam(required = false) String title) { @RequestParam(required = false) String title,
@RequestParam(required = false) String oneId,
@RequestParam(required = false) String twoId,
@RequestParam(required = false) String threeId) {
PageHelper.startPage(index, size); 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); PageInfo pageInfo = new PageInfo<SysCaseQuestion>(list);
return new ResultEntity<PageInfo<SysCaseQuestion>>(pageInfo); return new ResultEntity<PageInfo<SysCaseQuestion>>(pageInfo);
} }
@ -132,7 +137,7 @@ public class CaseController {
sysCaseQuestion.setTwoId(sysTopicAndCourse.getTwoId()); sysCaseQuestion.setTwoId(sysTopicAndCourse.getTwoId());
sysCaseQuestion.setTwoName(sysTopicAndCourse.getTwoName()); sysCaseQuestion.setTwoName(sysTopicAndCourse.getTwoName());
} }
if (StringUtils.isNotBlank(sysCaseQuestion.getThreeId())) { if (StringUtils.isNotBlank(sysTopicAndCourse.getThreeId())) {
sysCaseQuestion.setThreeName(sysTopicAndCourse.getThreeName()); sysCaseQuestion.setThreeName(sysTopicAndCourse.getThreeName());
sysCaseQuestion.setThreeId(sysTopicAndCourse.getThreeId()); sysCaseQuestion.setThreeId(sysTopicAndCourse.getThreeId());
} }
@ -231,13 +236,13 @@ public class CaseController {
@AnonymousAccess @AnonymousAccess
@ApiOperation("批量绑定案例题") @ApiOperation("批量绑定案例题")
@PostMapping("batchBindCase") @PostMapping("batchBindCase")
public ResultEntity<String> batchBindCase(@ApiParam("传全部参数")@RequestBody List<SysTopicAndCourse> sysTopicAndCourse) { public ResultEntity<String> batchBindCase(@ApiParam("传全部参数") @RequestBody List<SysTopicAndCourse> sysTopicAndCourse) {
try { try {
topicAndCourseMapper.batchInsert(sysTopicAndCourse); topicAndCourseMapper.batchInsert(sysTopicAndCourse);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); 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) { @RequestParam(required = false) String schoolId) {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner); SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
String oneId = sysOneCatalogs.getOneId(); 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); PageInfo pageInfo1 = PageUtil.pageHelper(list, index, size);
return pageInfo1; return pageInfo1;
} }

@ -6,7 +6,6 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface SysCaseQuestionMapper { public interface SysCaseQuestionMapper {
@ -40,7 +39,12 @@ public interface SysCaseQuestionMapper {
List<SysCaseQuestion> selectCaseByConditions(@Param("title") String title, List<SysCaseQuestion> selectCaseByConditions(@Param("title") String title,
@Param("oneId") String oneId, @Param("oneId") String oneId,
@Param("source") String source); @Param("source") String source,
@Param("twoId") String twoId,
List<SysCaseQuestion> selectCaseByConditionsByBind(@Param("title") String title); @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 != ''"> <if test="oneId != null and oneId != ''">
st.one_id = #{oneId} st.one_id = #{oneId}
</if> </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 != ''"> <if test="title != null and title != ''">
and s.title LIKE CONCAT('%', #{title}, '%') and s.title LIKE CONCAT('%', #{title}, '%')
</if> </if>
@ -467,6 +473,15 @@
<if test="title != null and title != ''"> <if test="title != null and title != ''">
and s.title LIKE CONCAT('%', #{title}, '%') and s.title LIKE CONCAT('%', #{title}, '%')
</if> </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 and s.unmount_status is false
</where> </where>
order by s.create_time order by s.create_time

Loading…
Cancel
Save