From c447386e06ce5927fb6e3ccb22ee673535b3f566 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期一, 08 七月 2024 18:21:26 +0800 Subject: [PATCH] 标签增加部门字段、分页调整(未做权限) --- src/main/resources/mapper/UserMapper.xml | 58 ++++++++++++++++++++++++++++++++++------------------------ 1 files changed, 34 insertions(+), 24 deletions(-) diff --git a/src/main/resources/mapper/UserMapper.xml b/src/main/resources/mapper/UserMapper.xml index d7252e5..4d49779 100644 --- a/src/main/resources/mapper/UserMapper.xml +++ b/src/main/resources/mapper/UserMapper.xml @@ -23,7 +23,7 @@ </resultMap> <sql id="Base_Column_List"> id, user_uuid, user_name, password, real_name, age, sex, birth_day, user_level, phone, - role, status, image_path, create_time, modify_time, last_active_time, deleted, wx_open_id, `condition`, condition_detail + role, status, image_path, create_time, modify_time, last_active_time, deleted, wx_open_id, `condition` </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> select @@ -329,30 +329,27 @@ </select> - <select id="userPage" resultMap="BaseResultMap" - parameterType="com.mindskip.xzs.viewmodel.admin.user.UserPageRequestVM"> + <select id="userPage" resultType="com.mindskip.xzs.viewmodel.admin.user.UserResponseVM" parameterType="com.mindskip.xzs.viewmodel.admin.user.UserPageRequestVM"> SELECT - a.* + a.*, + c.result as departmentExamineResult, + d.result as conditionExamineResult FROM t_user a - lEFT join - (select * from t_user_department - <if test="departmentId != null and departmentId.size() > 0"> - where department_id in <foreach collection="departmentId" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach> - </if> - group by user_id - ) - b on a.id = b.user_id - where + LEFT JOIN t_user_department b ON a.id = b.user_id + LEFT JOIN t_department_examine c ON a.id = c.user_id AND c.deleted = 0 AND c.result = 0 + LEFT JOIN t_user_condition_examine d ON a.id = d.user_id AND d.deleted = 0 AND d.result = 0 + WHERE a.deleted=0 <if test="departmentId != null and departmentId.size() > 0"> - and b.department_id in <foreach collection="departmentId" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach> + AND b.department_id IN <foreach collection="departmentId" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="userName != null and userName != ''"> - and real_name like concat('%',#{userName},'%') + AND real_name LIKE concat('%',#{userName},'%') </if> - <if test="role != null and role.size() > 0"> - and role in <foreach collection="role" item="item" open="(" separator="," close=")"> #{item} </foreach> + <if test="roles != null and roles.size() > 0"> + AND role IN <foreach collection="roles" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> + GROUP BY a.id </select> @@ -469,11 +466,10 @@ </update> <update id="setStatus"> - UPDATE t_user - SET `condition` = #{condition}, - `condition_detail` = #{conditionDetail} - WHERE id = #{id} - AND deleted = 0 + UPDATE t_user + SET `condition` = #{condition} + WHERE id = #{id} + AND deleted = 0 </update> <update id="clearDeptAdmin"> @@ -547,11 +543,25 @@ <select id="getDeptAdmins" resultType="com.mindskip.xzs.domain.Department" parameterType="java.lang.Integer"> <if test="id != null"> - select a.id, a.name from t_department a inner join t_user_department b on a.id = b.department_id where a.deleted = 0 and b.dept_admin = 1 and b.user_id = #{id} order by a.id desc + select a.id, a.name, a.parent_id from t_department a inner join t_user_department b on a.id = b.department_id where a.deleted = 0 and b.dept_admin = 1 and b.user_id = #{id} order by a.id </if> <if test="id == null"> - select a.id, a.name from t_department a where a.deleted = 0 order by a.id desc + select a.id, a.name, a.parent_id from t_department a where a.deleted = 0 order by a.id </if> </select> + <select id="getUserByExamByTemplateId" resultType="com.mindskip.xzs.domain.User" parameterType="com.mindskip.xzs.domain.ExamPaper"> + select * + from t_user + where id in + (select user_id from t_exam_templates_user WHERE templates_id = #{id} and user_id not in + (SELECT create_user from t_exam_paper_answer where (user_score / paper_score) > 0.6 and (invalid = 0 or invalid is null) and exam_paper_id in + (select exam_paper_id from t_exam_templates_user_count WHERE exam_templates_id = #{id}))) + and id = #{createUser} + </select> + + <select id="getDeptIds" resultType="integer"> + SELECT department_id FROM t_user_department WHERE user_id = #{userId} AND dept_admin != 1 + </select> + </mapper> -- Gitblit v1.8.0