he2802 1 rok temu
rodzic
commit
7fdaac5242

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

@@ -500,7 +500,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 <!--        ORDER by ue.record_id DESC-->
 <!--    </select>-->
 
-    <select id="selectDoNum" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultType="Long">
+    <!--<select id="selectDoNum" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultType="Long">
         SELECT
             IFNULL( COUNT(DISTINCT question_id), 0 ) num
         FROM
@@ -522,6 +522,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                                                                                                     </if>
                                                                                                      and do_question_ids is not null and `status` = 1 GROUP BY exam_id ) e
                         LEFT JOIN question q ON FIND_IN_SET( q.question_id, e.ids )) AS eq
+    </select>-->
+
+    <select id="selectDoNum" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultType="Long">
+        SELECT
+        IFNULL( COUNT( DISTINCT q.emp_id ), 0 ) num
+        FROM
+        (
+        SELECT
+        SUBSTRING_INDEX( SUBSTRING_INDEX( a.do_question_ids, ',', b.help_topic_id + 1 ), ',', - 1 ) AS emp_id
+        FROM
+        user_exam_record a
+        JOIN mysql.help_topic b ON b.help_topic_id <![CDATA[ < ]]> ( LENGTH( a.do_question_ids ) - LENGTH( REPLACE ( a.do_question_ids, ',', '' )) + 1 )
+        WHERE
+        user_id = #{userId}
+        AND order_goods_id = #{orderGoodsId}
+        <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>
+        <if test="doMode != null and doMode != ''">
+            AND do_mode = #{doMode}
+        </if>
+        and do_question_ids is not null and `status` = 1
+        ) q
     </select>
 
     <select id="selectRightNum" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultType="Long">