Эх сурвалжийг харах

做题统计 历史目录

he2802 3 жил өмнө
parent
commit
28cfe78dc6

+ 10 - 1
zhongzheng-system/src/main/resources/mapper/modules/collect/CollectQuestionMapper.xml

@@ -100,13 +100,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             q.type,
             count( q.question_id ) AS num
         FROM
-                ( SELECT * FROM collect_question WHERE user_id = #{userId} ) cq
+                ( SELECT c.* FROM collect_question c
+        LEFT JOIN exam e ON c.exam_id = e.exam_id
+        LEFT JOIN exam_paper ep ON ep.paper_id = e.exam_paper_id
+                WHERE user_id = #{userId}
+        <if test="paperId != null and paperId != ''">
+            AND e.exam_paper_id = #{paperId}
+        </if>
+                    ) cq
                     LEFT JOIN question q ON cq.question_id = q.question_id
+
         WHERE
             1 = 1
         <if test="goodsId != null and goodsId != ''">
             AND cq.goods_id = #{goodsId}
         </if>
+
         GROUP BY
             q.type
     </select>

+ 1 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserExamRecordMapper.xml

@@ -59,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="goodsId != null and goodsId != ''">
             AND ue.goods_id = #{goodsId}
         </if>
+        ORDER by ue.record_id DESC
     </select>
 
     <select id="selectDoNum" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultType="Long">

+ 7 - 1
zhongzheng-system/src/main/resources/mapper/modules/user/UserExamWrongRecordMapper.xml

@@ -92,7 +92,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             q.type,
             count(DISTINCT q.question_id ) AS num
         FROM
-                ( SELECT * FROM user_exam_wrong_record WHERE user_id = #{userId} ) uew
+                ( 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 user_id = #{userId}
+        <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
         WHERE
         1 = 1