From cfc61445380851d621f4dd853fe62941f9c80207 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期四, 09 五月 2024 15:30:52 +0800
Subject: [PATCH] 部门管理员优化

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

diff --git a/src/main/resources/mapper/ExamTemplatesUserCountMapper.xml b/src/main/resources/mapper/ExamTemplatesUserCountMapper.xml
index a65f399..88435a4 100644
--- a/src/main/resources/mapper/ExamTemplatesUserCountMapper.xml
+++ b/src/main/resources/mapper/ExamTemplatesUserCountMapper.xml
@@ -19,15 +19,18 @@
     </insert>
 
     <select id="list" resultType="com.mindskip.xzs.domain.vo.ExamTemplatesUserCountVO" parameterType="com.mindskip.xzs.viewmodel.admin.exam.ExamPaperPageRequestVM">
-        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
+        SELECT
+               e.id as id,
+               count(u.user_id) as count,
+               u.user_id as userId
+        FROM
+            t_exam_templates e
+                left join `t_exam_templates_user_count` u on u.exam_templates_id = e.id <if test="userId != null">and u.user_id = #{userId}</if>
         <where>
                 <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>
@@ -93,4 +96,4 @@
         where c.templates_id = #{id}
     </select>
 
-</mapper>
\ No newline at end of file
+</mapper>

--
Gitblit v1.8.0