123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?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="com.platform.dao.mapper.upms.SysUserMapper">
- <select id="selectVOByKeyword" resultType="com.platform.dao.vo.SysUserVO"
- parameterType="com.platform.dao.dto.upms.SysUserDTO">
- select u.* from t_sys_user u
- join t_sys_user_role role
- on u.user_id=role.user_id
- where 1=1
- <if test="keyword !=null and keyword !=''">
- and (u.username like CONCAT('%',#{keyword},'%')
- or u.real_name like CONCAT('%',#{keyword},'%'))
- </if>
- <if test="deptId !=null and deptId !=''">
- and exists (select 1 from t_sys_user_dept t where t.user_id = u.user_id and t.dept_id = #{deptId}
- union select 1 from t_sys_dept t where t.dept_id = #{deptId} and t.parent_id = '0')
- </if>
- <if test="phone !=null and phone !=''">
- and u.phone = #{phone}
- </if>
- <if test="username !=null and username !=''">
- and u.username = #{username}
- </if>
- <if test="teamId !=null and teamId !=''">
- and exists (select 1 from t_sys_user_team t where t.user_id = u.user_id and t.team_id = #{teamId})
- </if>
- <if test="identityType !=null">
- and u.identity_type = #{identityType}
- </if>
- <if test="roleId!=null and roleId!=''">
- and role.role_id=#{roleId}
- </if>
- order by u.update_time desc
- </select>
- <select id="selectByDept" resultType="com.platform.dao.vo.SysUserVO"
- parameterType="com.platform.dao.dto.upms.SysUserDTO">
- select u.* from t_sys_user u
- left join t_sys_user_dept ud on u.user_id = ud.user_id
- where 1=1
- <if test="deptIds != null and deptIds.size >0">
- AND ud.dept_id in
- <foreach item="item" index="index" collection="deptIds" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- order by u.update_time desc
- </select>
- <select id="selectDeptRoleUser" resultType="com.platform.dao.vo.SysUserVO"
- parameterType="com.platform.dao.dto.upms.SysUserDTO">
- select distinct u.* from t_sys_user u, t_sys_user_dept ud, t_sys_user_role ur, t_sys_role r
- where u.user_id = ud.user_id and u.user_id = ur.user_id and ur.role_id = r.role_id
- <if test="deptIds != null and deptIds.size >0">
- AND ud.dept_id in
- <foreach item="item" index="index" collection="deptIds" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="roleCode !=null and roleCode !=''">
- and r.role_code = #{roleCode}
- </if>
- <if test="roleCodes != null and roleCodes.size >0">
- AND r.role_code in
- <foreach item="item" index="index" collection="roleCodes" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- order by u.update_time desc
- </select>
- <select id="selectUserNameById" resultType="java.lang.String" parameterType="java.lang.Object">
- select real_name
- from t_sys_user
- where user_id = #{value}
- </select>
- </mapper>
|