he2802 2 năm trước cách đây
mục cha
commit
d4ddafd5cd

+ 33 - 0
zhongzheng-system/src/main/resources/mapper/modules/collect/CollectQuestionMapper.xml

@@ -262,6 +262,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
         GROUP BY
         q.type
+        UNION ALL
+        SELECT
+        q.type,
+        count( q.question_id ) AS num,
+        3 AS do_mode
+        FROM
+        ( 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 c.user_id = #{userId}
+        AND c.do_mode = 3
+        <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
+        LEFT JOIN goods g ON g.goods_id = cq.goods_id
+        WHERE
+        1 = 1
+        <if test="goodsId != null and goodsId != ''">
+            AND cq.goods_id = #{goodsId}
+        </if>
+        <if test="orderGoodsId != null and orderGoodsId != ''">
+            AND cq.order_goods_id = #{orderGoodsId}
+        </if>
+        <if test="businessId != null and businessId != ''">
+            AND g.business_id = #{businessId}
+        </if>
+        <if test="educationTypeId != null and educationTypeId != ''">
+            AND g.education_type_id = #{educationTypeId}
+        </if>
+        GROUP BY
+        q.type
     </select>
 
 </mapper>