From 47cd9ecc0eff38ffe6b3b794b2bf197e958f4403 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期三, 14 五月 2025 15:50:57 +0800
Subject: [PATCH] bug:学员有状态不能修改问题
---
src/main/resources/mapper/ExamTemplatesUserCountMapper.xml | 32 ++++++++++++++++++++++++++------
1 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/src/main/resources/mapper/ExamTemplatesUserCountMapper.xml b/src/main/resources/mapper/ExamTemplatesUserCountMapper.xml
index fe5bc7d..569a336 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>
@@ -61,6 +64,12 @@
where user_id = #{userId} and exam_templates_id = #{id}
</select>
+ <select id="getCountByUserIdAndTemplatesId" resultType="java.lang.Integer" parameterType="com.mindskip.xzs.domain.vo.ExamTemplatesUserCountVO">
+ select count(*) from t_exam_templates_user_count a
+ inner join t_exam_paper_answer b on a.exam_paper_id = b.exam_paper_id and (b.invalid = 0 or b.invalid is null)
+ where user_id = #{userId} and exam_templates_id = #{id}
+ </select>
+
<select id="getByTemplates" resultMap="BaseResultMap">
select * from t_exam_templates_user_count
where exam_templates_id = #{id}
@@ -77,4 +86,15 @@
where c.exam_templates_id = #{id}
</select>
-</mapper>
\ No newline at end of file
+ <select id="getByExamTemplatesUser" resultType="com.mindskip.xzs.domain.vo.UserCountExcelVO" parameterType="java.lang.Integer">
+ SELECT t.`name`as name,d.`name` as departmentName,u.real_name as userName,SUBSTRING_INDEX(a.user_score/10,".",1) as userScore,SUBSTRING_INDEX(a.paper_score/10,".",1) as paperScore,a.do_time as doTime
+ from t_exam_templates_user c
+ LEFT JOIN t_exam_templates t on c.templates_id = t.id
+ left join t_exam_templates_user_count o on c.templates_id = o.exam_templates_id
+ LEFT JOIN t_exam_paper_answer a on (o.exam_paper_id = a.exam_paper_id and o.user_id = a.create_user)
+ LEFT JOIN t_user u on a.create_user = u.id
+ LEFT JOIN t_department d on d.id = u.user_level
+ where c.templates_id = #{id}
+ </select>
+
+</mapper>
--
Gitblit v1.8.0