From 1a7af6fff5185bb257c16b0445140c93263a3331 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期一, 15 一月 2024 11:18:17 +0800
Subject: [PATCH] 修改
---
zt/core/src/main/resources/mapper/sys/SysUserDao.xml | 259 ++++++++++++++++++++++++++++-----------------------
1 files changed, 143 insertions(+), 116 deletions(-)
diff --git a/zt/core/src/main/resources/mapper/sys/SysUserDao.xml b/zt/core/src/main/resources/mapper/sys/SysUserDao.xml
index b52d51f..868a4e6 100644
--- a/zt/core/src/main/resources/mapper/sys/SysUserDao.xml
+++ b/zt/core/src/main/resources/mapper/sys/SysUserDao.xml
@@ -4,17 +4,12 @@
<mapper namespace="com.zt.modules.sys.dao.SysUserDao">
<select id="getList" resultType="com.zt.core.sys.model.SysUser">
- select a.user_id as id
- ,a.dept_id
- ,a.dept_id as company_id
- ,a.user_name as username
- ,a.nick_name as real_name
- ,a.phonenumber as MOBILE
- ,(select t2.dept_name from SYS_DEPT t2 where t2.dept_id = a.dept_id) deptName
- from SYS_USER a
- where a.del_flag = 0
+ select a.*
+ ,(select t2.name from sys_dept t2 where t2.id = a.dept_id) deptName
+ from sys_user a
+ where a.is_delete = 0
<if test="username != null and username.trim() != ''">
- and (a.user_name like #{username} or a.nick_name like #{username})
+ and (a.username like #{username} or a.nick_name like #{username})
</if>
<if test="deptId != null and deptId != 0">
and a.dept_id = #{deptId}
@@ -34,70 +29,70 @@
</select>
<select id="getById" resultType="com.zt.core.sys.model.SysUser">
- select a.user_id as id
+ select a.id
, a.dept_id
- , a.dept_id as company_id
- , '1271368584383188993' as TENANT_ID
- , a.user_name as username
- , a.nick_name as real_name
- , a.phonenumber as MOBILE
- , (select t2.dept_name from SYS_DEPT t2 where t2.dept_id = a.dept_id) deptName
- from SYS_USER a
- where a.del_flag = 0
- and a.user_id = #{value}
+ , a.company_id
+ , '1271368584383188993' as TENANT_ID
+ , a.username
+ , a.real_name
+ , a.mobile
+ , (select t2.name from sys_dept t2 where t2.id = a.dept_id) deptName
+ from sys_user a
+ where a.is_delete = 0
+ and a.id = #{value}
limit 1
</select>
<select id="getByUsername" resultType="com.zt.core.sys.model.SysUser">
- select a.user_id as id
+ select a.id
, a.dept_id
- , a.dept_id as company_id
- , '1271368584383188993' as TENANT_ID
- , a.user_name as username
- , a.nick_name as real_name
- , a.phonenumber as MOBILE
- , (select t2.dept_name from SYS_DEPT t2 where t2.dept_id = a.dept_id) deptName
- , a.password as password
- from SYS_USER a
- where a.del_flag = 0
- and user_name = #{value}
+ , a.company_id
+ , '1271368584383188993' as TENANT_ID
+ , a.username
+ , a.real_name
+ , a.mobile
+ , (select t2.name from sys_dept t2 where t2.id = a.dept_id) deptName
+ , a.password
+ from sys_user a
+ where a.is_delete = 0
+ and username = #{value}
limit 1
</select>
<select id="checkUserArea" resultType="com.zt.core.sys.model.SysUser">
select a.*
- from SYS_USER a,
+ from sys_user a,
sys_role_user b,
sys_role c
- where b.IS_DELETE = 0
- and c.IS_DELETE = 0
- and a.user_id = #{userId}
- and b.user_id = a.user_id
+ where b.is_delete = 0
+ and c.is_delete = 0
+ and a.id = #{userId}
+ and b.user_id = a.id
and c.id = b.role_id
- and ((#{localServer} = 'jd' and c.code in ('cjbm','ztsxlbm'))
- or (#{localServer} = 'cj'
- and c.code in ('zlbm','tybm','ywzbm','tzbm','czbm','bzbm','dbsbm')
- )
+ and ((#{localServer} = 'jd' and c.code in ('cjbm', 'ztsxlbm'))
+ or (#{localServer} = 'cj'
+ and c.code in ('zlbm', 'tybm', 'ywzbm', 'tzbm', 'czbm', 'bzbm', 'dbsbm')
+ )
)
</select>
<select id="isGetByUsernameList" resultType="com.zt.core.sys.model.SysUser">
select
- a.user_id as id
+ a.id
,a.dept_id
- ,a.dept_id as company_id
+ ,a.company_id
,'1271368584383188993' as TENANT_ID
- ,a.user_name as username
- ,a.nick_name as real_name
- ,a.phonenumber as MOBILE
+ ,a.username
+ ,a.real_name
+ ,a.mobile
,a.password
from
- SYS_USER a
- where del_flag = 0
+ sys_user a
+ where is_delete = 0
and user_name = #{username}
<if test="unitid != null and unitid != ''">
and dept_id = #{unitid}
</if>
<if test="code != null and code != ''">
- or dept_id in (select dept_id from SYS_DEPT where dept_code=#{code}))
+ or dept_id in (select id from sys_dept where code=#{code}))
</if>
<if test="password != null and password != ''">
and password = #{password}
@@ -105,39 +100,39 @@
</select>
<select id="isDomainName" resultType="com.zt.core.sys.model.SysUser">
- select a.user_id as id
+ select a.id
, a.dept_id
- , a.dept_id as company_id
- , '1271368584383188993' as TENANT_ID
- , a.user_name as username
- , a.nick_name as real_name
- , a.phonenumber as MOBILE
- , (select t2.dept_name from SYS_DEPT t2 where t2.dept_id = a.dept_id) deptName
- from SYS_USER a
- where a.del_flag = 0
+ , a.company_id
+ , '1271368584383188993' as TENANT_ID
+ , a.username
+ , a.real_name
+ , a.mobile
+ , (select t2.name from sys_dept t2 where t2.id = a.dept_id) deptName
+ from sys_user a
+ where a.is_delete = 0
# and a.code = #{code}
</select>
<select id="userRoleInfo" resultType="com.zt.core.context.User">
SELECT
- a.nick_name as realName,
+ a.real_Name,
c.name as roleName,
- (select dept_name from SYS_DEPT d where a.DEPT_ID = d.DEPT_ID AND d.del_flag=0 limit 1 ) as deptName
+ (select name from sys_dept d where a.dept_id = d.ID AND d.is_delete=0 limit 1 ) as deptName
FROM
- SYS_USER a,
- SYS_ROLE_USER b,
- SYS_ROLE c,
- sys_ROLE_MENU e,
- sys_MENU f
+ sys_user a,
+ sys_role_user b,
+ sys_role c,
+ sys_role_menu e,
+ sys_menu f
WHERE 1=1
<if test="userId != null and userId != ''">
- and a.user_id = #{userId}
+ and a.id = #{userId}
</if>
<if test="username != null and username != ''">
- and a.user_name = #{username}
+ and a.username = #{username}
</if>
- and a.USER_ID = b.USER_ID
- AND b.ROLE_ID = c.id
+ and a.id = b.user_id
+ AND b.role_id = c.id
and c.id = e.role_id
and e.menu_id = f.id
AND b.is_delete=0
@@ -152,101 +147,133 @@
<select id="getRoles" resultType="java.lang.String">
SELECT group_concat(b.role_id) AS role_id
- FROM SYS_ROLE_USER b
+ FROM sys_role_user b
WHERE b.is_delete = 0
AND b.user_id = #{userId}
</select>
<select id="getRoleNames" resultType="java.lang.String">
SELECT group_concat(a.name) AS name
- FROM SYS_ROLE a,
- SYS_ROLE_USER b
+ FROM sys_role a,
+ sys_role_user b
WHERE b.is_delete = 0
AND b.user_id = #{userId}
and a.is_delete = 0
- and a.id =b.role_id
+ and a.id = b.role_id
</select>
<update id="updateLogin">
update
- SYS_USER
+ sys_user
<trim prefix="set" suffixOverrides=",">
<if test="loginErrorCount!=null">login_error_count=#{loginErrorCount},</if>
<if test="isLocked!=null">is_locked=#{isLocked},</if>
<if test="lastLoginErrorTime!=null">last_login_error_time=#{lastLoginErrorTime}</if>
</trim>
- WHERE user_id=#{id}
+ WHERE id=#{id}
</update>
<select id="getByDeptIds" resultType="com.zt.core.sys.model.SysUser">
SELECT
- b.user_id as id
+ b.id
,b.dept_id
- ,b.dept_id as company_id
+ ,b.company_id
,'1271368584383188993' as TENANT_ID
- ,b.user_name as username
- ,b.nick_name as real_name
- ,b.phonenumber as MOBILE
+ ,b.username
+ ,b.real_name
+ ,b.mobile
FROM
- SYS_USER b
+ sys_user b
WHERE
- b.del_flag = 0
+ b.is_delete = 0
and dept_id in
<foreach collection="deptIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getEntity" resultType="com.zt.core.sys.model.SysUser">
- SELECT b.user_id as id
+ SELECT b.id
, b.dept_id
- , b.dept_id as company_id
+ , b.company_id
, '1271368584383188993' as TENANT_ID
- , b.user_name as username
- , b.nick_name as real_name
- , b.phonenumber as MOBILE
- FROM SYS_USER b
- WHERE b.del_flag = 0
- and user_id = #{id}
+ , b.username
+ , b.real_name
+ , b.mobile
+ FROM sys_user b
+ WHERE b.is_delete = 0
+ and b.id = #{id}
limit 1
</select>
<select id="getNewConnectUser" resultType="com.zt.core.sys.model.SysUser">
select *
from sys_user
where dept_id = #{newShipTeam}
- and user_id in (select user_id
- from sys_role_user a,
- sys_role b
- where a.role_id = b.id
- and b.code = 'tybm')
+ and id in (select user_id
+ from sys_role_user a,
+ sys_role b
+ where a.role_id = b.id
+ and b.code = 'tybm')
</select>
<select id="checkTestHome" resultType="java.lang.Integer">
- SELECT
- count( 1 )
- FROM
- sys_user
- WHERE
- del_flag = 0
- AND user_id = #{userId}
+ SELECT count(1)
+ FROM sys_user
+ WHERE is_delete = 0
+ AND id = #{userId}
AND (
- user_name IN ( 'admin', 'yszl' )
- OR user_id IN (
- SELECT
- user_id
- FROM
- sys_role_user b,
- sys_role c
- WHERE
- b.IS_DELETE = 0
- AND c.IS_DELETE = 0
- AND c.id = b.ROLE_ID
- AND c.`CODE` IN ( 'xtglybm', 'ztsxlbm', 'dbsbm', 'zlbm', 'bzbm', 'czbm' )
+ user_name IN ('admin', 'yszl')
+ OR id IN (
+ SELECT user_id
+ FROM sys_role_user b,
+ sys_role c
+ WHERE b.is_delete = 0
+ AND c.is_delete = 0
+ AND c.id = b.role_id
+ AND c.`code` IN ('xtglybm', 'ztsxlbm', 'dbsbm', 'zlbm', 'bzbm', 'czbm')
)
)
</select>
-
+ <select id="getUsersList" resultType="com.zt.core.sys.model.SysUser">
+ select real_name as name,id as id from sys_user
+ where is_delete = 0
+ <if test="type == null or type == ''">
+ and id not in (
+ select user_id from sys_role_user where role_id
+ in (select id from sys_role where code in ('xtglybm','xtbmybm','xtsjybm','rx')and is_delete=0)and
+ is_delete=0)and is_delete=0
+ </if>
+ <if test="deptId != null and deptId != ''">
+ and dept_id = #{deptId}
+ </if>
+ <if test="type == 'zrr'">
+ and id in (
+ select user_id from sys_role_user where role_id
+ in (select id from sys_role where code in ('jcry')and is_delete=0)and is_delete=0)and is_delete=0
+ </if>
+ <if test="type == 'csry'">
+ and id in (
+ select user_id from sys_role_user where role_id
+ in (select id from sys_role where code in ('jcry')and is_delete=0)and is_delete=0)and is_delete=0
+ </if>
+ <if test="type == 'shry'">
+ and id in (
+ select user_id from sys_role_user where role_id
+ in (select id from sys_role where code in ('jcry','zljdy','shry')and is_delete=0)and is_delete=0) and
+ is_delete=0
+ </if>
+ <if test="type == 'pzry'">
+ and id in (
+ select user_id from sys_role_user where role_id
+ in (select id from sys_role where code in ('jcry','shry')and is_delete=0)and is_delete=0)and is_delete=0
+ </if>
+ </select>
+ <select id="getUsersName" resultType="java.lang.String">
+ select real_name
+ from sys_user
+ WHERE id = ${id}
+ </select>
<update id="updatePassword">
update
- SYS_USER
+ sys_user
set password = #{password}
- WHERE user_id=#{id}
+ WHERE id = #{id}
</update>
</mapper>
--
Gitblit v1.9.1