From 99b29966852e4f8e1dfb2e444db4f86ce786a3b1 Mon Sep 17 00:00:00 2001
From: qirong <2032486488@qq.com>
Date: 星期二, 28 十一月 2023 11:08:35 +0800
Subject: [PATCH] 随机试卷修改

---
 src/main/resources/mapper/ExamTemplatesUserCountMapper.xml |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/main/resources/mapper/ExamTemplatesUserCountMapper.xml b/src/main/resources/mapper/ExamTemplatesUserCountMapper.xml
index 94acd87..fe5bc7d 100644
--- a/src/main/resources/mapper/ExamTemplatesUserCountMapper.xml
+++ b/src/main/resources/mapper/ExamTemplatesUserCountMapper.xml
@@ -19,17 +19,23 @@
     </insert>
 
     <select id="list" resultType="com.mindskip.xzs.domain.vo.ExamTemplatesUserCountVO" parameterType="com.mindskip.xzs.viewmodel.admin.exam.ExamPaperPageRequestVM">
-        SELECT exam_templates_id as id, count(*) as count, user_id as userId FROM `t_exam_templates_user_count`
+        SELECT u.exam_templates_id as id, count(*) as count, u.user_id as userId FROM `t_exam_templates_user_count` u
+        left join t_exam_templates e on u.exam_templates_id = e.id
         <where>
-            <if test="templatesId != null">
-                and exam_templates_id = #{templatesId}
-            </if>
-            <if test="userId != null">
-                and user_id = #{userId}
-            </if>
-
+                <if test="templatesId != null">
+                    and u.exam_templates_id = #{templatesId}
+                </if>
+                <if test="userId != null">
+                    and u.user_id = #{userId}
+                </if>
+                <if test="status != null">
+                    and e.status = 0
+                </if>
+                <if test="status == null">
+                    and e.status is null
+                </if>
         </where>
-        GROUP BY exam_templates_id, user_id
+        GROUP BY u.exam_templates_id, u.user_id
     </select>
 
     <select id="getByTemplatesIds" resultMap="BaseResultMap">

--
Gitblit v1.8.0