Explorar el Código

fix 模拟随机做题

he2802 hace 2 años
padre
commit
a9b4d95f92

+ 39 - 2
zhongzheng-system/src/main/resources/mapper/modules/user/UserBankRecordMapper.xml

@@ -54,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <select id="getUserBankList" parameterType="com.zhongzheng.modules.user.bo.UserBankRecordQueryBo" resultType="com.zhongzheng.modules.user.vo.UserBankRecordVo">
-        SELECT
+        SELECT * from (SELECT
         ue.*,
         e.exam_name,
         ep.paper_name
@@ -64,6 +64,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id
         WHERE
         ue.user_id = #{userId}
+        AND ud.do_mode in (1,2)
+        AND ue.grade_id = #{gradeId}
         <if test="gradeId != null and gradeId != ''">
             AND ue.grade_id = #{gradeId}
         </if>
@@ -85,7 +87,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="chapterId != null and chapterId != ''">
             AND ue.chapter_id = #{chapterId}
         </if>
-        ORDER by ue.create_time DESC
+        UNION ALL
+        SELECT
+        ue.*,
+        e.exam_name,
+        ep.paper_name
+        FROM
+        user_bank_record ue
+        LEFT JOIN exam_simulate e ON ue.simulate_exam_id = e.simulate_exam_id
+        LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id
+        WHERE
+        ue.user_id = #{userId}
+        AND ud.do_mode in (3)
+        AND ue.grade_id = #{gradeId}
+        <if test="gradeId != null and gradeId != ''">
+            AND ue.grade_id = #{gradeId}
+        </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="courseId != null and courseId != ''">
+            AND ue.course_id = #{courseId}
+        </if>
+        <if test="sectionId != null and sectionId != ''">
+            AND ue.section_id = #{sectionId}
+        </if>
+        <if test="moduleId != null and moduleId != ''">
+            AND ue.module_id = #{moduleId}
+        </if>
+        <if test="chapterId != null and chapterId != ''">
+            AND ue.chapter_id = #{chapterId}
+        </if>)
+        ORDER by create_time DESC
+
     </select>
 
     <select id="getUserExamDoNum" parameterType="com.zhongzheng.modules.user.bo.UserBankRecordQueryBo" resultType="Long">