修改题目查询接口逻辑

master
xiaoCJ 4 months ago
parent 82880ba6bd
commit 92ef820592

@ -131,22 +131,22 @@ public class TopicController {
@PostMapping("/getObjectiveCountByChapterId")
@ApiOperation("根据章节查看题目类型数量/模拟认证题库通用")
@AnonymousAccess
private ResultEntity<List<TopicDto>> getObjectiveCountByChapterId(@ApiParam("普通题库/金融智能/银行从业") @RequestParam String outLine) {
private ResultEntity<List<TopicDto>> getObjectiveCountByChapterId(@ApiParam("金融智能/银行从业") @RequestParam String outLine) {
List<TopicDto> list = new ArrayList<>();
if (outLine.equals("金融智能")) {
List<TopicDto> list1 = objectiveQuestionMapper.getObjectiveCountByChapterId("金融智能", "13");
List<TopicDto> list2 = objectiveQuestionMapper.getObjectiveCountByChapterId("金融智能", "14");
list.addAll(list2);
List<TopicDto> list1 = objectiveQuestionMapper.getObjectiveCountByChapterId("金融智能", "理论知识");
List<TopicDto> list2 = objectiveQuestionMapper.getObjectiveCountByChapterId("金融智能", "专业能力");
list.addAll(list1);
list.addAll(list2);
}
if (outLine.equals("银行从业")) {
List<TopicDto> list1 = objectiveQuestionMapper.getObjectiveCountByChapterId("银行从业", "15");
List<TopicDto> list2 = objectiveQuestionMapper.getObjectiveCountByChapterId("银行从业", "16");
List<TopicDto> list3 = objectiveQuestionMapper.getObjectiveCountByChapterId("银行从业", "17");
List<TopicDto> list4 = objectiveQuestionMapper.getObjectiveCountByChapterId("银行从业", "18");
List<TopicDto> list5 = objectiveQuestionMapper.getObjectiveCountByChapterId("银行从业", "19");
list.addAll(list2);
List<TopicDto> list1 = objectiveQuestionMapper.getObjectiveCountByChapterId("银行从业", "公共基础");
List<TopicDto> list2 = objectiveQuestionMapper.getObjectiveCountByChapterId("银行从业", "个人理财");
List<TopicDto> list3 = objectiveQuestionMapper.getObjectiveCountByChapterId("银行从业", "风险管理");
List<TopicDto> list4 = objectiveQuestionMapper.getObjectiveCountByChapterId("银行从业", "公司信贷");
List<TopicDto> list5 = objectiveQuestionMapper.getObjectiveCountByChapterId("银行从业", "个人贷款");
list.addAll(list1);
list.addAll(list2);
list.addAll(list3);
list.addAll(list4);
list.addAll(list5);
@ -162,10 +162,10 @@ public class TopicController {
@RequestParam Integer size,
@ApiParam("0单选1多选2判断") @RequestParam(required = false) Integer type,
@ApiParam("普通题库/金融智能/银行从业") @RequestParam String outLine,
@ApiParam("理论知识/专业能力公共基础/个人理财/风险管理/公司信贷/个人贷款") @RequestParam(required = false) String subClass,
@ApiParam("理论知识/专业能力/公共基础/个人理财/风险管理/公司信贷/个人贷款") @RequestParam(required = false) String subClass,
@RequestParam(required = false) String content,
@RequestParam(required = false) String schoolId,
@RequestParam String chapterId) {
@RequestParam(required = false) String chapterId) {
PageHelper.startPage(index, size);
List<ObjectiveQuestionWithBLOBs> list = objectiveQuestionMapper.getObjectiveByType(type, outLine, subClass, content, schoolId, chapterId);
PageInfo pageInfo = new PageInfo(list);

@ -41,7 +41,7 @@ public interface ObjectiveQuestionMapper {
int updateByPrimaryKey(ObjectiveQuestion record);
List<TopicDto> getObjectiveCountByChapterId(@Param("outLine") String outLine,
@Param("chapterId") String chapterId);
@Param("subClass") String subClass);
List<ObjectiveQuestionWithBLOBs> getObjectiveByType(@Param("type") Integer type,
@Param("outLine") String outLine,

@ -466,7 +466,9 @@
<select id="getObjectiveByType" resultMap="ResultMapWithBLOBs">
select * from objective_question
<where>
chapter_id = #{chapterId}
<if test="chapterId !=null">
and chapter_id = #{chapterId}
</if>
<if test="type !=null">
and type = #{type}
</if>
@ -492,12 +494,12 @@
count(*) AS count
FROM objective_question
<where>
<if test="chapterId !=null">
chapter_id = #{chapterId}
</if>
<if test="outLine !=null and outLine !=''">
and outline = #{outLine}
</if>
<if test="subClass !=null and subClass!=''">
and subclass = #{subClass}
</if>
</where>
GROUP BY type
</select>

Loading…
Cancel
Save