Bladeren bron

错误历史

he2802 3 jaren geleden
bovenliggende
commit
d5ff29e10e

+ 11 - 2
zhongzheng-api/src/main/java/com/zhongzheng/controller/collect/CollectQuestionController.java

@@ -44,11 +44,11 @@ public class CollectQuestionController extends BaseController {
      */
     @ApiOperation("查询收藏题目列表,按题型")
     @GetMapping("/list")
-    public TableDataInfo<CollectQuestionVo> list(CollectQuestionQueryBo bo) {
+    public TableDataInfo<QuestionVo> list(CollectQuestionQueryBo bo) {
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
         bo.setUserId(loginUser.getUser().getUserId());
         startPage();
-        List<CollectQuestionVo> list = iCollectQuestionService.selectList(bo);
+        List<QuestionVo> list = iCollectQuestionService.selectList(bo);
         return getDataTable(list);
     }
     /**
@@ -74,6 +74,15 @@ public class CollectQuestionController extends BaseController {
         return getDataTable(list);
     }
 
+    @ApiOperation("按类型获取收藏数量")
+    @GetMapping("/type_list")
+    public TableDataInfo<CollectQuestionVo> type_list(CollectQuestionQueryBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
+        List<CollectQuestionVo> list = iCollectQuestionService.selectTypeNum(bo);
+        return getDataTable(list);
+    }
 
     /**
      * 获取收藏题目详细信息

+ 35 - 1
zhongzheng-api/src/main/java/com/zhongzheng/controller/user/UserExamWrongRecordController.java

@@ -5,6 +5,9 @@ import java.util.Arrays;
 
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.framework.web.service.WxTokenService;
+import com.zhongzheng.modules.bank.vo.QuestionVo;
+import com.zhongzheng.modules.collect.bo.CollectQuestionQueryBo;
+import com.zhongzheng.modules.collect.vo.CollectQuestionVo;
 import com.zhongzheng.modules.user.bo.UserExamWrongRecordAddBo;
 import com.zhongzheng.modules.user.bo.UserExamWrongRecordEditBo;
 import com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo;
@@ -50,7 +53,7 @@ public class UserExamWrongRecordController extends BaseController {
     /**
      * 查询用户我的题库错题记录列表
      */
-    @ApiOperation("查询用户我的题库错题记录列表")
+    @ApiOperation("查询用户我的题库错题记录列表-按试卷")
     @GetMapping("/list")
     public TableDataInfo<UserExamWrongRecordVo> list(UserExamWrongRecordQueryBo bo) {
         ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
@@ -60,7 +63,38 @@ public class UserExamWrongRecordController extends BaseController {
         return getDataTable(list);
     }
 
+    @ApiOperation("按类型获取收藏数量")
+    @GetMapping("/type_list")
+    public TableDataInfo<UserExamWrongRecordVo> type_list(UserExamWrongRecordQueryBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
+        List<UserExamWrongRecordVo> list = iUserExamWrongRecordService.selectTypeNum(bo);
+        return getDataTable(list);
+    }
+
+    @ApiOperation("试卷获取题目列表")
+    @GetMapping("/exam_question_list")
+    public TableDataInfo<QuestionVo> selectQuestionList(UserExamWrongRecordQueryBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
+        List<QuestionVo> list = iUserExamWrongRecordService.selectQuestionList(bo);
+        return getDataTable(list);
+    }
+
+    @ApiOperation("类型获取题目列表")
+    @GetMapping("/type_question_list")
+    public TableDataInfo<QuestionVo> type_question_list(UserExamWrongRecordQueryBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        startPage();
+        List<QuestionVo> list = iUserExamWrongRecordService.selectTypeQuestionList(bo);
+        return getDataTable(list);
+    }
+
     /**
+     *
      * 导出用户我的题库错题记录列表
      */
     /*@ApiOperation("导出用户我的题库错题记录列表")

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionChildAddBo.java

@@ -25,6 +25,9 @@ public class QuestionChildAddBo{
     /** 答案  判断题1正确 0错误; 单选为数字; 多选数字用,拼接; 从1坐标开始; */
     @ApiModelProperty("答案  判断题1正确 0错误; 单选为数字; 多选数字用,拼接; 从1坐标开始;")
     private String answerQuestion;
+    /** 解析 */
+    @ApiModelProperty("解析")
+    private String analysisContent;
     @ApiModelProperty("选项列表")
     private List<QuestionOptionsAddBo> optionsList;
 

+ 3 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/collect/mapper/CollectQuestionMapper.java

@@ -16,9 +16,11 @@ import java.util.List;
  */
 public interface CollectQuestionMapper extends BaseMapper<CollectQuestion> {
 
-    List<CollectQuestionVo> selectList(CollectQuestionQueryBo bo);
+    List<QuestionVo> selectList(CollectQuestionQueryBo bo);
 
     List<CollectQuestionVo> selectExamList(CollectQuestionQueryBo bo);
 
     List<QuestionVo> selectExamQuestionList(CollectQuestionQueryBo bo);
+
+    List<CollectQuestionVo> selectTypeNum(CollectQuestionQueryBo bo);
 }

+ 3 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/collect/service/ICollectQuestionService.java

@@ -35,10 +35,12 @@ public interface ICollectQuestionService extends IService<CollectQuestion> {
 	 */
 	List<CollectQuestionVo> queryList(CollectQuestionQueryBo bo);
 
-	List<CollectQuestionVo> selectList(CollectQuestionQueryBo bo);
+	List<QuestionVo> selectList(CollectQuestionQueryBo bo);
 
 	List<QuestionVo> selectExamQuestionList(CollectQuestionQueryBo bo);
 
+	List<CollectQuestionVo> selectTypeNum(CollectQuestionQueryBo bo);
+
 
 
 	/**

+ 6 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/collect/service/impl/CollectQuestionServiceImpl.java

@@ -75,7 +75,7 @@ public class CollectQuestionServiceImpl extends ServiceImpl<CollectQuestionMappe
     }
 
     @Override
-    public List<CollectQuestionVo> selectList(CollectQuestionQueryBo bo) {
+    public List<QuestionVo> selectList(CollectQuestionQueryBo bo) {
         return collectQuestionMapper.selectList(bo);
     }
 
@@ -84,6 +84,11 @@ public class CollectQuestionServiceImpl extends ServiceImpl<CollectQuestionMappe
         return collectQuestionMapper.selectExamQuestionList(bo);
     }
 
+    @Override
+    public List<CollectQuestionVo> selectTypeNum(CollectQuestionQueryBo bo) {
+        return collectQuestionMapper.selectTypeNum(bo);
+    }
+
 
     /**
     * 实体类转化成视图对象

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/collect/vo/CollectQuestionVo.java

@@ -45,4 +45,10 @@ public class CollectQuestionVo {
 	@ApiModelProperty("题目文本")
 	private String content;
 
+	@ApiModelProperty("题目类型")
+	private Integer type;
+
+	@ApiModelProperty("类型数量")
+	private Integer num;
+
 }

+ 4 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserExamWrongRecordMapper.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.user.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.bank.vo.QuestionVo;
 import com.zhongzheng.modules.user.bo.UserExamRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo;
 import com.zhongzheng.modules.user.domain.UserExamWrongRecord;
@@ -17,5 +18,7 @@ import java.util.List;
  */
 public interface UserExamWrongRecordMapper extends BaseMapper<UserExamWrongRecord> {
     List<UserExamWrongRecordVo> selectList(UserExamWrongRecordQueryBo bo);
-    List<UserExamWrongRecordVo> selectQuestionList(UserExamWrongRecordQueryBo bo);
+    List<QuestionVo> selectQuestionList(UserExamWrongRecordQueryBo bo);
+    List<UserExamWrongRecordVo> selectTypeNum(UserExamWrongRecordQueryBo bo);
+    List<QuestionVo> selectTypeQuestionList(UserExamWrongRecordQueryBo bo);
 }

+ 6 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserExamWrongRecordService.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.user.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.bank.vo.QuestionVo;
 import com.zhongzheng.modules.user.bo.UserExamRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserExamWrongRecordAddBo;
 import com.zhongzheng.modules.user.bo.UserExamWrongRecordEditBo;
@@ -32,7 +33,11 @@ public interface IUserExamWrongRecordService extends IService<UserExamWrongRecor
 
 	List<UserExamWrongRecordVo> selectList(UserExamWrongRecordQueryBo bo);
 
-	List<UserExamWrongRecordVo> selectQuestionList(UserExamWrongRecordQueryBo bo);
+	List<QuestionVo> selectQuestionList(UserExamWrongRecordQueryBo bo);
+
+	List<UserExamWrongRecordVo> selectTypeNum(UserExamWrongRecordQueryBo bo);
+
+	List<QuestionVo> selectTypeQuestionList(UserExamWrongRecordQueryBo bo);
 
 	/**
 	 * 根据新增业务对象插入用户我的题库错题记录

+ 12 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserExamWrongRecordServiceImpl.java

@@ -3,6 +3,7 @@ package com.zhongzheng.modules.user.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.bank.vo.QuestionVo;
 import com.zhongzheng.modules.user.bo.UserExamWrongRecordAddBo;
 import com.zhongzheng.modules.user.bo.UserExamWrongRecordEditBo;
 import com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo;
@@ -58,10 +59,20 @@ public class UserExamWrongRecordServiceImpl extends ServiceImpl<UserExamWrongRec
     }
 
     @Override
-    public List<UserExamWrongRecordVo> selectQuestionList(UserExamWrongRecordQueryBo bo) {
+    public List<QuestionVo> selectQuestionList(UserExamWrongRecordQueryBo bo) {
         return userExamWrongRecordMapper.selectQuestionList(bo);
     }
 
+    @Override
+    public List<UserExamWrongRecordVo> selectTypeNum(UserExamWrongRecordQueryBo bo) {
+        return userExamWrongRecordMapper.selectTypeNum(bo);
+    }
+
+    @Override
+    public List<QuestionVo> selectTypeQuestionList(UserExamWrongRecordQueryBo bo) {
+        return userExamWrongRecordMapper.selectTypeQuestionList(bo);
+    }
+
     /**
     * 实体类转化成视图对象
     *

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserExamWrongRecordVo.java

@@ -50,4 +50,10 @@ public class UserExamWrongRecordVo {
 
 	@ApiModelProperty("错题题数")
 	private Long wrongQuestionNum;
+
+	@ApiModelProperty("题目类型")
+	private Integer type;
+
+	@ApiModelProperty("类型数量")
+	private Integer num;
 }

+ 16 - 3
zhongzheng-system/src/main/resources/mapper/modules/collect/CollectQuestionMapper.xml

@@ -22,6 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="questionNum" column="question_num"/>
         <result property="content" column="content"/>
         <result property="goodsId" column="goods_id"/>
+        <result property="type" column="type"/>
+        <result property="num" column="num"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.bank.vo.QuestionVo" id="QuestionResultVo">
@@ -39,9 +41,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="code" column="code"/>
     </resultMap>
 
-    <select id="selectList" parameterType="com.zhongzheng.modules.collect.bo.CollectQuestionQueryBo"  resultMap="CollectQuestionVoResult">
+    <select id="selectList" parameterType="com.zhongzheng.modules.collect.bo.CollectQuestionQueryBo"  resultMap="QuestionResultVo">
         SELECT
-        q.*
+        DISTINCT q.*
         FROM
         collect_question cq
         LEFT JOIN question q ON cq.question_id = q.question_id
@@ -71,7 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectExamQuestionList" parameterType="com.zhongzheng.modules.collect.bo.CollectQuestionQueryBo"  resultMap="QuestionResultVo">
         SELECT
-        q.*
+            DISTINCT q.*
         FROM
         collect_question cq
         LEFT JOIN question q ON q.question_id = cq.question_id
@@ -82,4 +84,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     </select>
 
+    <select id="selectTypeNum" parameterType="com.zhongzheng.modules.collect.bo.CollectQuestionQueryBo"  resultMap="CollectQuestionVoResult">
+        SELECT
+            q.type,
+            count( q.question_id ) AS num
+        FROM
+                ( SELECT * FROM collect_question WHERE user_id = #{userId} ) cq
+                    LEFT JOIN question q ON cq.question_id = q.question_id
+        GROUP BY
+            q.type
+    </select>
+
 </mapper>

+ 47 - 8
zhongzheng-system/src/main/resources/mapper/modules/user/UserExamWrongRecordMapper.xml

@@ -27,21 +27,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
         <result property="examName" column="exam_name"/>
         <result property="wrongQuestionNum" column="wrong_question_num"/>
+        <result property="type" column="type"/>
+        <result property="num" column="num"/>
+    </resultMap>
+
+    <resultMap type="com.zhongzheng.modules.bank.vo.QuestionVo" id="QuestionResultVo">
+        <result property="questionId" column="question_id"/>
+        <result property="content" column="content"/>
+        <result property="type" column="type"/>
+        <result property="answerQuestion" column="answer_question"/>
+        <result property="status" column="status"/>
+        <result property="analysisContent" column="analysis_content"/>
+        <result property="imgUrl" column="img_url"/>
+        <result property="jsonStr" column="json_str"/>
+        <result property="prefixName" column="prefix_name"/>
+        <result property="knowledgeIds" column="knowledge_ids"/>
+        <result property="publishStatus" column="publish_status"/>
+        <result property="code" column="code"/>
     </resultMap>
 
     <select id="selectList" parameterType="com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo" resultMap="UserExamWrongRecordVoResult">
         SELECT
         e.exam_name,
-        COUNT( DISTINCT uew.question_id ) AS question_num
+        e.exam_id,
+        COUNT( DISTINCT uew.question_id ) AS wrong_question_num
         FROM
         user_exam_wrong_record uew
         LEFT JOIN exam e ON uew.exam_id = e.exam_id
-        LEFT JOIN question q ON q.question_id = uew.question_id
         WHERE
         uew.user_id = #{userId}
-        <if test="type != null and type != ''">
-            AND q.type = #{type}
-        </if>
         <if test="goodsId != null and goodsId != ''">
             AND uew.goods_id = #{goodsId}
         </if>
@@ -49,8 +63,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         e.exam_id
     </select>
 
-    <select id="selectQuestionList" parameterType="com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo" resultMap="UserExamWrongRecordVoResult">
-        SELECT
+    <select id="selectQuestionList" parameterType="com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo" resultMap="QuestionResultVo">
+        SELECT DISTINCT
         q.*
         FROM
         user_exam_wrong_record uew
@@ -66,7 +80,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="examId != null and examId != ''">
             AND uew.exam_id = #{examId}
         </if>
+
+    </select>
+
+    <select id="selectTypeNum" parameterType="com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo"  resultMap="UserExamWrongRecordVoResult">
+        SELECT
+            q.type,
+            count( q.question_id ) AS num
+        FROM
+                ( SELECT * FROM user_exam_wrong_record WHERE user_id = #{userId} ) uew
+                    LEFT JOIN question q ON uew.question_id = q.question_id
         GROUP BY
-        q.question_id
+            q.type
+    </select>
+
+    <select id="selectTypeQuestionList" parameterType="com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo"  resultMap="QuestionResultVo">
+        SELECT DISTINCT
+        q.*
+        FROM
+        user_exam_wrong_record uew
+        LEFT JOIN question q ON uew.question_id = q.question_id
+        WHERE
+        1 = 1
+        AND uew.user_id =  #{userId}
+        <if test="type != null and type != ''">
+            AND q.type = #{type}
+        </if>
+
     </select>
 </mapper>