| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?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.ydtech.modules.admin.dao.SysUserLinkDeptInternalAgentMapper">
- <resultMap id="BaseResultMap" type="com.ydtech.modules.admin.model.po.SysUserLinkDeptInternalAgent">
- <id property="id" column="id" jdbcType="BIGINT"/>
- <result property="userId" column="user_id" jdbcType="VARCHAR"/>
- <result property="sysDeptInternalAgentId" column="sys_dept_internal_agent_id" jdbcType="VARCHAR"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="createUser" column="create_user" jdbcType="VARCHAR"/>
- <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
- <result property="updateUser" column="update_user" jdbcType="VARCHAR"/>
- </resultMap>
- <sql id="Base_Column_List">
- id,user_id,sys_dept_internal_agent_id,
- create_time,create_user,update_time,
- update_user
- </sql>
- <delete id="deleteByDeptId">
- delete from sys_user_link_dept_internal_agent
- where sys_dept_internal_agent_id =#{deptId}
- </delete>
- <select id="queryPage" resultType="com.ydtech.modules.admin.model.dto.SysUserLinkDeptInternalAgentDto">
- SELECT
- link.id AS id,
- su.id AS userId,
- su.NAME AS userName,
- sd.id AS deptId,
- sd.NAME AS deptName,
- link.create_time AS createTime
- FROM
- sys_user_link_dept_internal_agent link
- LEFT JOIN sys_user su ON link.user_id = su.id
- LEFT JOIN sys_dept_internal_agent sd ON link.sys_dept_internal_agent_id = sd.id
- <where>
- <if test="vo.userId != null and vo.userId != ''">
- and link.user_id = #{vo.userId}
- </if>
- <if test="vo.userName != null and vo.userName != ''">
- and su.name like CONCAT('%', #{vo.userName}, '%')
- </if>
- <if test="vo.deptId != null and vo.deptId != ''">
- and sd.id = #{vo.deptId}
- </if>
- </where>
- order by link.create_time desc
- </select>
- <select id="findUserListByDeptPage" resultType="com.ydtech.modules.admin.model.vo.SysUserBaseVO">
- SELECT
- t1.id AS userId,
- t1.NAME AS NAME,
- t1.mobile AS mobile,
- t1.`status` AS `status`,
- t2.id AS deptId,
- t2.`name` AS deptName,
- sd2.id AS pDeptId,
- sd2.`name` AS pDeptName,
- CASE
- WHEN ( SELECT count( 0 ) FROM sys_user_link_dept_internal_agent link WHERE link.user_id = t1.id and link.sys_dept_internal_agent_id = #{user.deptNBId}) > 0 THEN
- true ELSE false
- END AS flag
- FROM
- sys_user t1
- LEFT JOIN sys_dept t2 ON t1.dept_id = t2.id
- LEFT JOIN sys_dept sd2 ON sd2.id = t2.parent_id
- WHERE
- t1.`status` = 1
- AND t1.id NOT LIKE '%M%'
- <if test='user !=null '>
- <if test='user.name !=null and user.name!="" '>
- and t1.name like CONCAT('%', #{user.name}, '%')
- </if>
- <if test='user.userId !=null and user.userId!="" '>
- and t1.id = #{user.userId}
- </if>
- <if test='user.mobile !=null and user.mobile!="" '>
- and t1.mobile = #{user.mobile}
- </if>
- <if test='user.deptId !=null and user.deptId!="" '>
- and t2.id like CONCAT('', #{user.deptId}, '%')
- </if>
- </if>
- order by flag desc
- </select>
- <select id="getUserIdListByDeptPrentIds" resultType="java.lang.String">
- SELECT
- link.user_id
- FROM
- sys_user_link_dept_internal_agent link
- LEFT JOIN sys_dept_internal_agent sd ON link.sys_dept_internal_agent_id = sd.id
- <where>
- <if test="parentIds != null and parentIds != ''">
- AND sd.parent_ids like concat(#{parentIds},'%')
- </if>
- </where>
- </select>
- </mapper>
|