From e897dfa023634f08d47e4d0ba2bcf19a05b9006e Mon Sep 17 00:00:00 2001
From: ZQN <364596817@qq.com>
Date: 星期三, 26 六月 2024 20:17:52 +0800
Subject: [PATCH] 用户列表去除企业

---
 project-system/src/main/resources/mapper/system/SysUserMapper.xml |   33 ++++++++++++++++++++++++---------
 1 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/project-system/src/main/resources/mapper/system/SysUserMapper.xml b/project-system/src/main/resources/mapper/system/SysUserMapper.xml
index 70b1c79..ed2462e 100644
--- a/project-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/project-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -69,12 +69,15 @@
 		       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.user_name!='admin' and u.user_type!='02'
 		<if test="userId != null and userId != 0">
 			AND u.user_id = #{userId}
 		</if>
 		<if test="userName != null and userName != ''">
 			AND u.user_name like concat('%', #{userName}, '%')
+		</if>
+		<if test="nickName != null and nickName != ''">
+			AND u.nick_name like concat('%', #{nickName}, '%')
 		</if>
 		<if test="status != null and status != ''">
 			AND u.status = #{status}
@@ -92,7 +95,9 @@
 			AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
 		</if>
 		<!-- 鏁版嵁鑼冨洿杩囨护 -->
-		${params.dataScope}
+		<if test="params != null and params.dataScope != null and params.dataScope != ''">
+			AND ${params.dataScope}
+		</if>
 	</select>
 
 	<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
@@ -109,7 +114,9 @@
 			AND u.phonenumber like concat('%', #{phonenumber}, '%')
 		</if>
 		<!-- 鏁版嵁鑼冨洿杩囨护 -->
-		${params.dataScope}
+		<if test="params != null and params.dataScope != null and params.dataScope != ''">
+			AND ${params.dataScope}
+		</if>
 	</select>
 
 	<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
@@ -127,7 +134,9 @@
 			AND u.phonenumber like concat('%', #{phonenumber}, '%')
 		</if>
 		<!-- 鏁版嵁鑼冨洿杩囨护 -->
-		${params.dataScope}
+		<if test="params != null and params.dataScope != null and params.dataScope != ''">
+			AND ${params.dataScope}
+		</if>
 	</select>
 
 	<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
@@ -223,6 +232,10 @@
  		update sys_user set password = #{password}, recommend_user = #{recommendUser} where user_name = #{userName}
 	</update>
 
+	<update id="resetPhone" parameterType="SysUser">
+		update sys_user set phonenumber = #{phone}, user_name = #{phone} where user_id = #{userId}
+	</update>
+
 	<delete id="deleteUserById" parameterType="Long">
  		update sys_user set del_flag = '1' where user_id = #{userId}
  	</delete>
@@ -235,15 +248,17 @@
  	</delete>
 
 
-	<select id="getNumByRoleKey"  resultType="Long">
-		select u.user_id
+	<select id="getPhonesByRoleKey"  resultType="String">
+		select u.phonenumber
 			from sys_user u
 			join sys_user_role ur on u.user_id = ur.user_id
-			join sys_role r on r.role_id=ur.role_id
+			join sys_role r on r.role_id = ur.role_id
+			join sys_user_dept ud on u.user_id = ud.user_id
 		where
-		  u.user_type = '01'
+		  u.user_type != '02'
+		  and u.status='0'
 		  and r.role_key = #{roleKey}
-		  and (u.dept_id = #{deptId} or u.dept_id in (SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors)))
+		  and ud.dept_id = #{deptId}
 	</select>
 
 </mapper>

--
Gitblit v1.9.1