|
@@ -122,11 +122,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
ORDER by ue.record_id DESC
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectGroupList" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultMap="UserExamRecordVoResult">
|
|
|
+ <select id="selectGroupList" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultType="com.zhongzheng.modules.user.vo.UserExamRecordVo">
|
|
|
+ SELECT * FROM (
|
|
|
SELECT
|
|
|
- ue.*,
|
|
|
- e.exam_name,
|
|
|
- ep.paper_name
|
|
|
+ ue.record_id ,ue.user_id ,ue.exam_id ,1 AS courseType,null as type,ue.`status`,ue.goods_id
|
|
|
+ ,ue.report_status,ue.performance,ue.history_exam_json,
|
|
|
+ ue.update_time,ue.total_question_num,ue.right_question_num,ue.do_question_num,ue.module_exam_id as moduleExamId,
|
|
|
+ ue.chapter_exam_id as chapterExamId,NULL as courseId,NULL as moduleId,NULL as chapterId,NULL as sectionId,NULL
|
|
|
+ as gradeId,
|
|
|
+ ue.do_time,ue.exam_time,ue.total_score,ue.do_question_ids,ue.right_question_ids,ue.score,ue.all_question_num,ue.order_goods_id,
|
|
|
+ ue.less_question_num,ue.create_time,e.exam_name,ep.paper_name
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
@@ -162,15 +167,115 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="examId != null and examId != ''">
|
|
|
AND ue.exam_id = #{examId}
|
|
|
</if>
|
|
|
- <if test="educationTypeId != null and educationTypeId != ''">
|
|
|
- AND g.education_type_id = #{educationTypeId}
|
|
|
+ <if test="moduleExamId != null and moduleExamId != ''">
|
|
|
+ AND ue.module_exam_id = #{moduleExamId}
|
|
|
</if>
|
|
|
- <if test="businessId != null and businessId != ''">
|
|
|
- AND g.business_id = #{businessId}
|
|
|
+ <if test="orderGoodsId != null and orderGoodsId != ''">
|
|
|
+ AND ue.order_goods_id = #{orderGoodsId}
|
|
|
</if>
|
|
|
- ORDER by ue.record_id DESC
|
|
|
+ <if test="chapterExamId != null and chapterExamId != ''">
|
|
|
+ AND ue.chapter_exam_id = #{chapterExamId}</if>-- ORDER by ue.record_id DESC
|
|
|
+ UNION ALL
|
|
|
+ SELECT
|
|
|
+ ue.record_id,ue.user_id ,ue.exam_id,2 AS courseType,ue.type,ue.`status` ,ue.goods_id ,ue.
|
|
|
+ report_status,ue.performance,ue.history_exam_json,
|
|
|
+ ue.update_time,ue.total_question_num,ue.right_question_num,ue.do_question_num,NULL as moduleExamId,NULL as
|
|
|
+ chapterExamId,
|
|
|
+ ue.course_id as courseId,ue.module_id as moduleId,ue.chapter_id as chapterId,ue.section_id as
|
|
|
+ sectionId,ue.grade_id as gradeId,
|
|
|
+ ue.do_time,ue.exam_time,ue.total_score,ue.do_question_ids,ue.right_question_ids,ue.score,ue.all_question_num,ue.order_goods_id,
|
|
|
+ ue.less_question_num,ue.create_time,e.exam_name,ep.paper_name
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ ue.goods_id,
|
|
|
+ ue.exam_id,
|
|
|
+ MAX( ue.record_id ) record_id
|
|
|
+ FROM
|
|
|
+ user_bank_record ue
|
|
|
+ LEFT JOIN exam e ON ue.exam_id = e.exam_id
|
|
|
+ LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id
|
|
|
+ WHERE
|
|
|
+ ue.user_id = #{userId}
|
|
|
+ GROUP BY
|
|
|
+ ue.goods_id,
|
|
|
+ ue.exam_id,
|
|
|
+ ue.course_id,
|
|
|
+ ue.module_id,
|
|
|
+ ue.chapter_id,
|
|
|
+ ue.section_id
|
|
|
+ ) t
|
|
|
+ LEFT JOIN user_bank_record ue ON t.record_id = ue.record_id
|
|
|
+ LEFT JOIN exam e ON ue.exam_id = e.exam_id
|
|
|
+ LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id
|
|
|
+ LEFT JOIN goods g ON g.goods_id = ue.goods_id
|
|
|
+ WHERE
|
|
|
+ ue.user_id = #{userId}
|
|
|
+ <if test="paperId != null and paperId != ''">
|
|
|
+ AND ep.paper_id = #{paperId}
|
|
|
+ </if>
|
|
|
+ <if test="goodsId != null and goodsId != ''">
|
|
|
+ AND ue.goods_id = #{goodsId}
|
|
|
+ </if>
|
|
|
+ <if test="examId != null and examId != ''">
|
|
|
+ AND ue.exam_id = #{examId}
|
|
|
+ </if>
|
|
|
+ <if test="orderGoodsId != null and orderGoodsId != ''">
|
|
|
+ AND ue.order_goods_id = #{orderGoodsId}
|
|
|
+ </if>
|
|
|
+ ) a ORDER by a.create_time DESC
|
|
|
+ -- ORDER by ue.record_id DESC
|
|
|
</select>
|
|
|
|
|
|
+<!-- <select id="selectGroupList" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultMap="UserExamRecordVoResult">-->
|
|
|
+<!-- SELECT-->
|
|
|
+<!-- ue.*,-->
|
|
|
+<!-- e.exam_name,-->
|
|
|
+<!-- ep.paper_name-->
|
|
|
+<!-- FROM-->
|
|
|
+<!-- (-->
|
|
|
+<!-- SELECT-->
|
|
|
+<!-- ue.goods_id,-->
|
|
|
+<!-- ue.exam_id,-->
|
|
|
+<!-- ue.module_exam_id,-->
|
|
|
+<!-- ue.chapter_exam_id,-->
|
|
|
+<!-- MAX( UE.record_id ) record_id-->
|
|
|
+<!-- FROM-->
|
|
|
+<!-- user_exam_record ue-->
|
|
|
+<!-- LEFT JOIN exam e ON ue.exam_id = e.exam_id-->
|
|
|
+<!-- LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id-->
|
|
|
+<!-- WHERE-->
|
|
|
+<!-- ue.user_id = #{userId}-->
|
|
|
+<!-- GROUP BY-->
|
|
|
+<!-- ue.goods_id,-->
|
|
|
+<!-- ue.exam_id,-->
|
|
|
+<!-- ue.module_exam_id,-->
|
|
|
+<!-- ue.chapter_exam_id-->
|
|
|
+<!-- ) t-->
|
|
|
+<!-- LEFT JOIN user_exam_record ue ON t.record_id = ue.record_id-->
|
|
|
+<!-- LEFT JOIN exam e ON ue.exam_id = e.exam_id-->
|
|
|
+<!-- LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id-->
|
|
|
+<!-- LEFT JOIN goods g ON g.goods_id = ue.goods_id-->
|
|
|
+<!-- WHERE-->
|
|
|
+<!-- ue.user_id = #{userId}-->
|
|
|
+<!-- <if test="paperId != null and paperId != ''">-->
|
|
|
+<!-- AND ep.paper_id = #{paperId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="goodsId != null and goodsId != ''">-->
|
|
|
+<!-- AND ue.goods_id = #{goodsId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="examId != null and examId != ''">-->
|
|
|
+<!-- AND ue.exam_id = #{examId}-->
|
|
|
+<!-- </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>-->
|
|
|
+<!-- ORDER by ue.record_id DESC-->
|
|
|
+<!-- </select>-->
|
|
|
+
|
|
|
<select id="selectDoNum" parameterType="com.zhongzheng.modules.user.bo.UserExamRecordQueryBo" resultType="Long">
|
|
|
SELECT
|
|
|
IFNULL( COUNT(*), 0 ) num
|