From 13f796dc50449ae2ec525ef02aaf4b49a91a564b Mon Sep 17 00:00:00 2001 From: qirong <2032486488@qq.com> Date: 星期三, 29 十一月 2023 11:16:42 +0800 Subject: [PATCH] 修改重置 --- src/main/resources/mapper/ExamTemplatesUserCountMapper.xml | 29 ++++++++++++++++++++--------- 1 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/main/resources/mapper/ExamTemplatesUserCountMapper.xml b/src/main/resources/mapper/ExamTemplatesUserCountMapper.xml index 94acd87..15c3234 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"> @@ -55,6 +61,11 @@ 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 + 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} -- Gitblit v1.8.0