|
@@ -56,7 +56,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
SELECT
|
|
|
e.exam_name,
|
|
|
e.exam_id,
|
|
|
- COUNT( DISTINCT uew.question_id ) AS wrong_question_num
|
|
|
+ COUNT( DISTINCT uew.question_id ) AS wrong_question_num,
|
|
|
+ 1 AS do_mode
|
|
|
FROM
|
|
|
user_exam_wrong_record uew
|
|
|
LEFT JOIN exam e ON uew.exam_id = e.exam_id
|
|
@@ -64,6 +65,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
LEFT JOIN goods g ON g.goods_id = uew.goods_id
|
|
|
WHERE
|
|
|
uew.user_id = #{userId}
|
|
|
+ AND uew.do_mode = 1
|
|
|
+ <if test="goodsId != null and goodsId != ''">
|
|
|
+ AND uew.goods_id = #{goodsId}
|
|
|
+ </if>
|
|
|
+ <if test="orderGoodsId != null and orderGoodsId != ''">
|
|
|
+ AND uew.order_goods_id = #{orderGoodsId}
|
|
|
+ </if>
|
|
|
+ <if test="paperId != null and paperId != ''">
|
|
|
+ AND e.exam_paper_id = #{paperId}
|
|
|
+ </if>
|
|
|
+ <if test="educationTypeId != null and educationTypeId != ''">
|
|
|
+ AND g.education_type_id = #{educationTypeId}
|
|
|
+ </if>
|
|
|
+ <if test="businessId != null and businessId != ''">
|
|
|
+ AND g.business_id = #{businessId}
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ e.exam_id
|
|
|
+ ORDER BY
|
|
|
+ e.create_time desc
|
|
|
+ UNION ALL
|
|
|
+ SELECT
|
|
|
+ e.exam_name,
|
|
|
+ e.exam_id,
|
|
|
+ COUNT( DISTINCT uew.question_id ) AS wrong_question_num,
|
|
|
+ 2 AS do_mode
|
|
|
+ FROM
|
|
|
+ user_exam_wrong_record uew
|
|
|
+ LEFT JOIN exam_temp e ON uew.exam_id = e.exam_id
|
|
|
+ LEFT JOIN exam_paper ep ON ep.paper_id = e.exam_paper_id
|
|
|
+ LEFT JOIN goods g ON g.goods_id = uew.goods_id
|
|
|
+ WHERE
|
|
|
+ uew.user_id = #{userId}
|
|
|
+ AND uew.do_mode = 2
|
|
|
<if test="goodsId != null and goodsId != ''">
|
|
|
AND uew.goods_id = #{goodsId}
|
|
|
</if>
|
|
@@ -113,12 +148,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<select id="selectTypeNum" parameterType="com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo" resultMap="UserExamWrongRecordVoResult">
|
|
|
SELECT
|
|
|
q.type,
|
|
|
- count(DISTINCT q.question_id ) AS num
|
|
|
+ count(DISTINCT q.question_id ) AS num,
|
|
|
+ 1 as do_mode
|
|
|
FROM
|
|
|
( 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}
|
|
|
+ WHERE ue.user_id = #{userId}
|
|
|
+ AND ue.do_mode = 1
|
|
|
<if test="paperId != null and paperId != ''">
|
|
|
AND e.exam_paper_id = #{paperId}
|
|
|
</if>) uew
|
|
@@ -140,6 +177,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</if>
|
|
|
GROUP BY
|
|
|
q.type
|
|
|
+ UNION ALL
|
|
|
+ SELECT
|
|
|
+ q.type,
|
|
|
+ count(DISTINCT q.question_id ) AS num,
|
|
|
+ 2 as do_mode
|
|
|
+ FROM
|
|
|
+ ( SELECT ue.* FROM user_exam_wrong_record ue
|
|
|
+ LEFT JOIN exam_temp e ON ue.exam_id = e.exam_id
|
|
|
+ LEFT JOIN exam_paper ep ON ep.paper_id = e.exam_paper_id
|
|
|
+ WHERE ue.user_id = #{userId}
|
|
|
+ AND ue.do_mode = 2
|
|
|
+ <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
|
|
|
+ LEFT JOIN goods g ON g.goods_id = uew.goods_id
|
|
|
+ WHERE
|
|
|
+ 1 = 1
|
|
|
+ <if test="goodsId != null and goodsId != ''">
|
|
|
+ AND uew.goods_id = #{goodsId}
|
|
|
+ </if>
|
|
|
+ <if test="orderGoodsId != null and orderGoodsId != ''">
|
|
|
+ AND uew.order_goods_id = #{orderGoodsId}
|
|
|
+ </if>
|
|
|
+ <if test="educationTypeId != null and educationTypeId != ''">
|
|
|
+ AND g.education_type_id = #{educationTypeId}
|
|
|
+ </if>
|
|
|
+ <if test="businessId != null and businessId != ''">
|
|
|
+ AND g.business_id = #{businessId}
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ q.type
|
|
|
</select>
|
|
|
|
|
|
<select id="selectTypeQuestionList" parameterType="com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo" resultMap="UserExamWrongRecordVoResult">
|