he2802 2 年之前
父节点
当前提交
aa8cd0803d

+ 5 - 4
zhongzheng-api/src/main/java/com/zhongzheng/controller/goods/GoodsController.java

@@ -116,16 +116,17 @@ public class GoodsController extends BaseController {
         UserExamWrongRecordQueryBo wBo = new UserExamWrongRecordQueryBo();
         wBo.setOrderGoodsId(orderGoodsId);
         wBo.setUserId(loginUser.getUser().getUserId());
-        wBo.setDoMode(1L);
+        List<Long> listMode = new ArrayList<>();
+        listMode.add(1L);
+        listMode.add(3L);
+        wBo.setDoModes(listMode);
         Long wrongNum = iUserExamWrongRecordService.recordNum(wBo);
         numMap.put("wrongNum",wrongNum);
 
         CollectQuestionQueryBo collectQuestionQueryBo = new CollectQuestionQueryBo();
         collectQuestionQueryBo.setOrderGoodsId(orderGoodsId);
         collectQuestionQueryBo.setUserId(loginUser.getUser().getUserId());
-        List<Long> listMode = new ArrayList<>();
-        listMode.add(1L);
-        listMode.add(3L);
+
         collectQuestionQueryBo.setDoModes(listMode);
         Integer collectNum = iCollectQuestionService.collectNum(collectQuestionQueryBo);
         numMap.put("collectNum",collectNum);

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/bo/UserExamWrongRecordQueryBo.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
 
@@ -73,4 +74,6 @@ public class UserExamWrongRecordQueryBo extends BaseEntity {
 	/** 类型1,题库 2,视频 */
 	@ApiModelProperty("类型1,题库 2,视频 ")
 	private Integer courseType;
+	@ApiModelProperty("做题模式 1章卷 2随机练习")
+	private List<Long> doModes;
 }

+ 38 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserExamWrongRecordMapper.xml

@@ -236,6 +236,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
         GROUP BY
         q.type
+        UNION ALL
+        SELECT
+        q.type,
+        count(DISTINCT q.question_id ) AS num,
+        3 as do_mode
+        FROM
+        ( SELECT ue.* FROM user_exam_wrong_record ue
+        LEFT JOIN exam e ON ue.exam_id = e.exam_id
+        LEFT JOIN exam_paper ep ON ep.paper_id = e.exam_paper_id
+        WHERE ue.user_id = #{userId}
+        AND ue.do_mode = 3
+        <if test="paperId != null and paperId != ''">
+            AND e.exam_paper_id = #{paperId}
+        </if>) uew
+        LEFT JOIN question q ON uew.question_id = q.question_id
+        LEFT JOIN goods g ON g.goods_id = uew.goods_id
+        WHERE
+        1 = 1
+        <if test="goodsId != null and goodsId != ''">
+            AND uew.goods_id = #{goodsId}
+        </if>
+        <if test="orderGoodsId != null and orderGoodsId != ''">
+            AND uew.order_goods_id = #{orderGoodsId}
+        </if>
+        <if test="educationTypeId != null and educationTypeId != ''">
+            AND g.education_type_id = #{educationTypeId}
+        </if>
+        <if test="businessId != null and businessId != ''">
+            AND g.business_id = #{businessId}
+        </if>
+        GROUP BY
+        q.type
     </select>
 
     <select id="selectTypeQuestionList" parameterType="com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo"  resultMap="UserExamWrongRecordVoResult">
@@ -283,6 +315,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="courseType != null and courseType != ''">
             AND course_type = #{courseType}
         </if>
+        <if test="doModes != null and doModes.size()!=0 ">
+            AND do_mode in
+            <foreach collection="doModes" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         GROUP BY
         exam_id
         ) uewr