From 68f85f044cd71cd3db6514c3bf5b5129ed2e3e78 Mon Sep 17 00:00:00 2001 From: zqy <2522236926> Date: 星期一, 10 六月 2024 23:44:50 +0800 Subject: [PATCH] 家庭小医生的分享 --- ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml | 46 +++++++++++++++++++++++++++++++++++----------- 1 files changed, 35 insertions(+), 11 deletions(-) diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index d86c444..0750bab 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -26,7 +26,7 @@ <association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" /> <collection property="roles" javaType="java.util.List" resultMap="RoleResult" /> </resultMap> - + <resultMap id="deptResult" type="SysDept"> <id property="deptId" column="dept_id" /> <result property="parentId" column="parent_id" /> @@ -45,9 +45,9 @@ <result property="dataScope" column="data_scope" /> <result property="status" column="role_status" /> </resultMap> - + <sql id="selectUserVo"> - select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, + select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status, r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status from sys_user u @@ -55,11 +55,19 @@ left join sys_user_role ur on u.user_id = ur.user_id left join sys_role r on r.role_id = ur.role_id </sql> - + <select id="findUserNames" parameterType="Long" resultMap="SysUserResult"> + SELECT + user_name + from sys_user + WHERE user_id IN + <foreach collection="array" item="id" index="index" open="(" close=")" separator=","> + #{id} + </foreach> + </select> <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u left join sys_dept d on u.dept_id = d.dept_id - where u.del_flag = '0' + where u.del_flag = '0' or u.del_flag = '2' <if test="userId != null and userId != 0"> AND u.user_id = #{userId} </if> @@ -141,7 +149,7 @@ <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult"> select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 </select> - + <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId"> insert into sys_user( <if test="userId != null and userId != 0">user_id,</if> @@ -207,12 +215,28 @@ update sys_user set password = #{password} where user_name = #{userName} </update> - <delete id="deleteUserById" parameterType="Long"> - update sys_user set del_flag = '2' where user_id = #{userId} + <delete id="deleteUserByUserName" parameterType="String"> + update sys_user set status = '1' where user_name= #{userName} </delete> - - <delete id="deleteUserByIds" parameterType="Long"> - update sys_user set del_flag = '2' where user_id in + <delete id="deleteUserByName" parameterType="String"> + delete from sys_user where user_name= #{userName} + </delete> + + <delete id="deleteUserById" parameterType="Long"> + update sys_user set status = '1' where user_id = #{userId} + </delete> + + + + <delete id="deleteById" parameterType="Long"> + delete from sys_user where user_id in + <foreach collection="array" item="userId" open="(" separator="," close=")"> + #{userId} + </foreach> + </delete> + + <delete id="deleteUserByIds" parameterType="Long"> + update sys_user set status = '1' where user_id in <foreach collection="array" item="userId" open="(" separator="," close=")"> #{userId} </foreach> -- Gitblit v1.9.1