瀏覽代碼

fix 组卷

he2802 2 年之前
父節點
當前提交
ba6fabf20c

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/ExamSimulateQueryBo.java

@@ -74,4 +74,7 @@ public class ExamSimulateQueryBo extends BaseEntity {
 	private Integer randomNum;
 	@ApiModelProperty("模拟做题试卷ID")
 	private Long simulateExamId;
+
+	@ApiModelProperty("做题来源 1题库 2视频章卷 3模考")
+	private Integer from;
 }

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamSimulateServiceImpl.java

@@ -167,6 +167,7 @@ public class ExamSimulateServiceImpl extends ServiceImpl<ExamSimulateMapper, Exa
                     allQ.addAll(qk3);
                 }
             }
+            Collections.reverse(allQ);
         }else{//题型随机
             Map<Integer,Integer> map = new HashMap<>();
             for(int i=1;i<50;i++){

+ 33 - 0
zhongzheng-system/src/main/resources/mapper/modules/bank/ExamSimulateMapper.xml

@@ -40,6 +40,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 LEFT JOIN question q ON eq.question_id = q.question_id
         WHERE
             eq.exam_id = #{examId}
+        <if test="from != null and from == 1">
+            AND NOT FIND_IN_SET(
+            q.question_id,(
+            SELECT
+            IFNULL(GROUP_CONCAT( right_question_ids ),'')
+            FROM
+            user_exam_record uer
+            WHERE
+            order_goods_id = #{orderGoodsId} and exam_id = #{examId} and do_mode = 3
+            ))
+        </if>
+        <if test="from != null and from == 2">
+            AND NOT FIND_IN_SET(
+            q.question_id,(
+            SELECT
+            IFNULL(GROUP_CONCAT( right_question_ids ),'')
+            FROM
+            user_bank_record uer
+            WHERE
+            order_goods_id = #{orderGoodsId} and exam_id = #{examId} and do_mode = 3
+            ))
+        </if>
+        <if test="from != null and from == 3">
+            AND NOT FIND_IN_SET(
+            q.question_id,(
+            SELECT
+            IFNULL(GROUP_CONCAT( right_question_ids ),'')
+            FROM
+            user_mock_record uer
+            WHERE
+            order_goods_id = #{orderGoodsId} and exam_id = #{examId} and do_mode = 3
+            ))
+        </if>
         <if test="type != null and type != ''">
           AND q.`type` = #{type}
         </if>

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

@@ -138,6 +138,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         e.exam_id
         ORDER BY
         create_time desc
+        UNION ALL
+        SELECT
+        e.exam_id,
+        e.exam_name,
+        e.create_time,
+        COUNT( cq.question_id ) question_num,
+        3 AS do_mode
+        FROM
+        collect_question cq
+        LEFT JOIN exam_simulate e ON cq.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 = cq.goods_id
+        WHERE
+        1 = 1
+        AND cq.do_mode = 3
+        AND cq.user_id = #{userId}
+        <if test="paperId != null and paperId != ''">
+            AND e.exam_paper_id = #{paperId}
+        </if>
+        <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
+        e.exam_id
+        ORDER BY
+        create_time desc
     </select>
 
     <select id="selectExamQuestionList" parameterType="com.zhongzheng.modules.collect.bo.CollectQuestionQueryBo"  resultMap="QuestionResultVo">