From c8ea9050a3e82eba68617c1a85ebb8b93eb885a3 Mon Sep 17 00:00:00 2001
From: feige <791364011@qq.com>
Date: 星期二, 03 九月 2024 00:06:11 +0800
Subject: [PATCH] 修改相关权限

---
 ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml |   61 ++++++++++++++++++++++--------
 1 files changed, 44 insertions(+), 17 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
index b42a4d4..1c14244 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -22,6 +22,7 @@
         <result property="createTime"   column="create_time"  />
         <result property="updateBy"     column="update_by"    />
         <result property="updateTime"   column="update_time"  />
+		<result property="clanId"   column="clan_id"  />
         <result property="remark"       column="remark"       />
         <association property="dept"    column="dept_id" javaType="SysDept" resultMap="deptResult" />
         <collection  property="roles"   javaType="java.util.List"           resultMap="RoleResult" />
@@ -47,7 +48,7 @@
     </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.clan_id,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
@@ -67,7 +68,7 @@
     <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' and u.clan_id = #{clanId}
 		<if test="userId != null and userId != 0">
 			AND u.user_id = #{userId}
 		</if>
@@ -94,7 +95,7 @@
 	</select>
 	
 	<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
-	    select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
+	    select distinct u.clan_id, u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
 	    from sys_user u
 			 left join sys_dept d on u.dept_id = d.dept_id
 			 left join sys_user_role ur on u.user_id = ur.user_id
@@ -132,7 +133,14 @@
 	    <include refid="selectUserVo"/>
 		where u.user_name = #{userName} and u.del_flag = '0'
 	</select>
-	
+
+
+	<select id="selectUserByNickName" parameterType="String" resultMap="SysUserResult">
+		<include refid="selectUserVo"/>
+		where u.nick_name = #{nickName} and u.del_flag = '0'
+	</select>
+
+
 	<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
 		<include refid="selectUserVo"/>
 		where u.user_id = #{userId}
@@ -141,7 +149,9 @@
 	<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
 		select user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1
 	</select>
-	
+	<select id="checkNickNameUnique" parameterType="String" resultMap="SysUserResult">
+		select user_id, nick_name from sys_user where nick_name = #{nickName} and del_flag = '0' limit 1
+	</select>
 	<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
 		select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
 	</select>
@@ -162,7 +172,9 @@
  			<if test="sex != null and sex != ''">sex,</if>
  			<if test="password != null and password != ''">password,</if>
  			<if test="status != null and status != ''">status,</if>
- 			<if test="createBy != null and createBy != ''">create_by,</if>
+		    <if test="clanId != null and clanId != 0">clan_id,</if>
+
+		<if test="createBy != null and createBy != ''">create_by,</if>
  			<if test="remark != null and remark != ''">remark,</if>
  			create_time
  		)values(
@@ -176,7 +188,9 @@
  			<if test="sex != null and sex != ''">#{sex},</if>
  			<if test="password != null and password != ''">#{password},</if>
  			<if test="status != null and status != ''">#{status},</if>
- 			<if test="createBy != null and createBy != ''">#{createBy},</if>
+		<if test="clanId != null and clanId != ''">#{clanId},</if>
+
+		<if test="createBy != null and createBy != ''">#{createBy},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
  			sysdate()
  		)
@@ -214,16 +228,29 @@
 	<update id="resetUserPwd" parameterType="SysUser">
  		update sys_user set password = #{password} where user_name = #{userName}
 	</update>
-	
+
+	<delete id="deleteUserByUserName" parameterType="String">
+		update sys_user set status = '1' where user_name= #{userName}
+	</delete>
+	<delete id="deleteUserByName" parameterType="String">
+		delete from sys_user where user_name= #{userName}
+	</delete>
+
 	<delete id="deleteUserById" parameterType="Long">
- 		update sys_user set del_flag = '2' where user_id = #{userId}
- 	</delete>
- 	
- 	<delete id="deleteUserByIds" parameterType="Long">
- 		update sys_user set del_flag = '2' where user_id in
- 		<foreach collection="array" item="userId" open="(" separator="," close=")">
- 			#{userId}
-        </foreach> 
- 	</delete>
+		update sys_user set status = '1' where user_id = #{userId}
+	</delete>
+
+
+
+	<delete id="deleteById" parameterType="Long">
+		delete from sys_user where user_id = #{userId}
+	</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>
+	</delete>
 	
 </mapper> 
\ No newline at end of file

--
Gitblit v1.9.1