瀏覽代碼

fix 学习记录题目数

he2802 3 年之前
父節點
當前提交
42e8ca7152
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      zhongzheng-system/src/main/resources/mapper/modules/user/UserExamRecordMapper.xml

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

@@ -156,7 +156,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             e.do_type,
             uer.total_question_num
         FROM
-            ( SELECT exam_id, MAX( total_question_num ) total_question_num FROM user_exam_record WHERE user_id = #{userId} AND goods_id = #{goodsId} GROUP BY exam_id ) uer
+            ( SELECT
+                  COUNT( question_id ) total_question_num,
+                  eq.exam_id
+              FROM
+                  exam_question eq
+              WHERE
+                      eq.exam_id IN ( SELECT DISTINCT exam_id FROM user_exam_record WHERE user_id = #{userId} AND goods_id = #{goodsId} )
+              GROUP BY
+                  eq.exam_id ) uer
                 LEFT JOIN exam e ON e.exam_id = uer.exam_id
 
     </select>