From 92ef8205925960aacf685d144aadd12c7e37ee88 Mon Sep 17 00:00:00 2001 From: xiaoCJ <406612557@qq.com> Date: Wed, 6 Nov 2024 17:14:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=98=E7=9B=AE=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=8E=A5=E5=8F=A3=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TopicController.java | 24 +++++++++---------- .../mapper/ObjectiveQuestionMapper.java | 2 +- .../mapper/ObjectiveQuestionMapper.xml | 10 ++++---- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/sztzjy/money_management/controller/TopicController.java b/src/main/java/com/sztzjy/money_management/controller/TopicController.java index 1041d94..160a917 100644 --- a/src/main/java/com/sztzjy/money_management/controller/TopicController.java +++ b/src/main/java/com/sztzjy/money_management/controller/TopicController.java @@ -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); diff --git a/src/main/java/com/sztzjy/money_management/mapper/ObjectiveQuestionMapper.java b/src/main/java/com/sztzjy/money_management/mapper/ObjectiveQuestionMapper.java index e3e62c2..b894699 100644 --- a/src/main/java/com/sztzjy/money_management/mapper/ObjectiveQuestionMapper.java +++ b/src/main/java/com/sztzjy/money_management/mapper/ObjectiveQuestionMapper.java @@ -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, diff --git a/src/main/resources/mapper/ObjectiveQuestionMapper.xml b/src/main/resources/mapper/ObjectiveQuestionMapper.xml index 89f2654..dcaa336 100644 --- a/src/main/resources/mapper/ObjectiveQuestionMapper.xml +++ b/src/main/resources/mapper/ObjectiveQuestionMapper.xml @@ -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>