he2802 3 жил өмнө
parent
commit
6afd9f405e

+ 9 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsAttachedMapper.xml

@@ -130,6 +130,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				WHEN ga.type = 3 THEN
 				(select do_question_num from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and uer.chapter_exam_id = 0 and uer.module_exam_id = 0 ORDER BY uer.record_id desc limit 1)
 				END do_question_num
+				,
+				CASE
+				WHEN ga.type = 1 THEN
+				-1
+				WHEN ga.type = 2 THEN
+				-1
+				WHEN ga.type = 3 THEN
+				(select right_question_num from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and uer.chapter_exam_id = 0 and uer.module_exam_id = 0 ORDER BY uer.record_id desc limit 1)
+				END right_question_num
 			</if>
 		FROM
 			goods_attached ga

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

@@ -170,7 +170,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     e.exam_id,
                     q.*
                 FROM
-                    ( SELECT exam_id, group_concat( do_question_ids ) AS ids FROM user_exam_record WHERE user_id = #{userId} AND order_goods_id = #{orderGoodsId} and `status` = 1 GROUP BY exam_id ) e
+                    ( SELECT exam_id, group_concat( do_question_ids ) AS ids FROM user_exam_record WHERE user_id = #{userId} AND order_goods_id = #{orderGoodsId} 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>