|
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
<!DOCTYPE mapper
|
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="org.dromara.system.mapper.SysUserMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="org.dromara.system.domain.vo.SysUserVo" id="SysUserResult">
|
|
|
|
|
<id property="userId" column="user_id"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
<resultMap type="org.dromara.system.domain.vo.SysUserExportVo" id="SysUserExportResult">
|
|
|
|
|
<id property="userId" column="user_id"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<select id="selectUserExportList" resultMap="SysUserExportResult">
|
|
|
|
|
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, u1.user_name as leaderName
|
|
|
|
|
from sys_user u
|
|
|
|
|
left join sys_dept d on u.dept_id = d.dept_id
|
|
|
|
|
left join sys_user u1 on u1.user_id = d.leader
|
|
|
|
|
${ew.getCustomSqlSegment}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectAllocatedList" 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
|
|
|
|
|
from sys_user u
|
|
|
|
|
left join sys_dept d on u.dept_id = d.dept_id
|
|
|
|
|
left join sys_user_role sur on u.user_id = sur.user_id
|
|
|
|
|
left join sys_role r on r.role_id = sur.role_id
|
|
|
|
|
${ew.getCustomSqlSegment}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectUnallocatedList" 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
|
|
|
|
|
from sys_user u
|
|
|
|
|
left join sys_dept d on u.dept_id = d.dept_id
|
|
|
|
|
left join sys_user_role sur on u.user_id = sur.user_id
|
|
|
|
|
left join sys_role r on r.role_id = sur.role_id
|
|
|
|
|
${ew.getCustomSqlSegment}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectUserListByHave" parameterType="org.dromara.system.domain.bo.QuerySysUserBo" resultMap="SysUserResult">
|
|
|
|
|
select u.user_id, u.dept_id, u.login_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex,
|
|
|
|
|
u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.type, d.dept_name,d.zzDisplayPath, u.law_certificate_num,
|
|
|
|
|
d.leader,u.tenant_code,t.tenant_code, t.tenant_name, t.contact_man, t.contact_number, t.address
|
|
|
|
|
from sys_user u
|
|
|
|
|
left join sys_dept d on u.dept_id = d.dept_id
|
|
|
|
|
left join sys_tenant t on t.tenant_code = u.tenant_code
|
|
|
|
|
where u.del_flag = '0'
|
|
|
|
|
<if test="user.userId != null and user.userId != ''">
|
|
|
|
|
AND u.user_id = #{user.userId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="user.loginName != null and user.loginName != ''">
|
|
|
|
|
AND u.login_name like concat('%', #{user.loginName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="user.userName != null and user.userName != ''">
|
|
|
|
|
AND (
|
|
|
|
|
u.user_name like concat('%', #{user.userName}, '%')
|
|
|
|
|
or
|
|
|
|
|
u.law_certificate_num like concat('%', #{user.userName}, '%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="user.status != null and user.status != ''">
|
|
|
|
|
AND u.status = #{user.status}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="user.phonenumber != null and user.phonenumber != ''">
|
|
|
|
|
AND u.phonenumber like concat('%', #{user.phonenumber}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="user.params.beginTime != null and user.params.beginTime != ''"><!-- 开始时间检索 -->
|
|
|
|
|
AND date_format(u.create_time,'%y%m%d') >= date_format(#{user.params.beginTime},'%y%m%d')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="user.params.endTime != null and user.params.endTime != ''"><!-- 结束时间检索 -->
|
|
|
|
|
AND date_format(u.create_time,'%y%m%d') <= date_format(#{user.params.endTime},'%y%m%d')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="user.deptId != null and user.deptId != ''">
|
|
|
|
|
and u.dept_id = #{user.deptId}
|
|
|
|
|
</if>
|
|
|
|
|
<!-- <!– 租户数据过滤 –>-->
|
|
|
|
|
<!-- <if test="user.tenantCode != @com.zdxt.auth.common.constant.Constants@DEFAULT_TENANT_CODE and user.tenantCode != null and user.tenantCode != ''">-->
|
|
|
|
|
<!-- AND u.tenant_code = #{user.tenantCode}-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<if test="user.notUserId != null and user.notUserId != ''">
|
|
|
|
|
and u.user_id not in
|
|
|
|
|
<foreach item="uid" collection="user.params.notUserIds" open="(" separator="," close=")">
|
|
|
|
|
#{uid}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="user.params.showCardId != null and user.params.showCardId == 0">
|
|
|
|
|
AND (
|
|
|
|
|
(u.law_certificate_num is not null AND u.law_certificate_num !="")
|
|
|
|
|
or (d.`zone` = 5 or d.`zone` = 15)
|
|
|
|
|
or (d.parent_id in (select dept_id from sys_dept where `zone` = 5 or `zone` = 15))
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
and u.dept_id != 405
|
|
|
|
|
<if test="user.params.dataScope != null and user.params.dataScope != ''">
|
|
|
|
|
<!-- 数据范围过滤 -->
|
|
|
|
|
${user.params.dataScope}
|
|
|
|
|
</if>
|
|
|
|
|
and (phonenumber is not null and phonenumber !='')
|
|
|
|
|
and u.login_name != 'admin'
|
|
|
|
|
ORDER BY u.create_time DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<sql id="selectUserVo">
|
|
|
|
|
select
|
|
|
|
|
u.user_id,
|
|
|
|
|
u.dept_id,
|
|
|
|
|
u.login_name,
|
|
|
|
|
u.user_name,
|
|
|
|
|
u.email,
|
|
|
|
|
u.avatar,
|
|
|
|
|
u.phonenumber,
|
|
|
|
|
u.sex,
|
|
|
|
|
u.password,
|
|
|
|
|
u.law_certificate_num,
|
|
|
|
|
u.salt,
|
|
|
|
|
u.status,
|
|
|
|
|
u.del_flag,
|
|
|
|
|
u.login_ip,
|
|
|
|
|
u.login_date,
|
|
|
|
|
u.create_time,
|
|
|
|
|
u.remark,
|
|
|
|
|
u.kingdee_org_id,
|
|
|
|
|
u.kingdee_user_id,
|
|
|
|
|
u.type,
|
|
|
|
|
u.certificateNumber,
|
|
|
|
|
u.strUserId,
|
|
|
|
|
u.user_source,
|
|
|
|
|
d.dept_id,
|
|
|
|
|
d.parent_id,
|
|
|
|
|
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,
|
|
|
|
|
u.tenant_code,
|
|
|
|
|
t.tenant_code,
|
|
|
|
|
t.tenant_name,
|
|
|
|
|
t.contact_man,
|
|
|
|
|
t.contact_number,
|
|
|
|
|
t.address
|
|
|
|
|
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
|
|
|
|
|
left join sys_role r on
|
|
|
|
|
r.role_id = ur.role_id
|
|
|
|
|
left join sys_tenant t on
|
|
|
|
|
t.tenant_code = u.tenant_code
|
|
|
|
|
</sql>
|
|
|
|
|
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
|
|
|
|
<include refid="selectUserVo"/>
|
|
|
|
|
where u.user_id = #{userId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectUserByIds" parameterType="string" resultMap="SysUserResult">
|
|
|
|
|
<include refid="selectUserVo"/>
|
|
|
|
|
where u.user_id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|