huminmin
4 天以前 d6226c68162673d8f46ca63c053d56caa916cbe6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?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.ruoyi.project.system.mapper.SysUserDeptMapper">
    <select id="setSchemeApplicableStaffUserInfo" resultType="java.util.Map">
        SELECT
        T1.id as id,
        T1.staff_no as staffNo,
        T1.staff_name as staffName,
        T2.dept_id as deptId,
        T2.dept_name as deptName
        FROM
        staff_on_job T1
        LEFT JOIN sys_dept T2 ON T1.sys_dept_id = T2.dept_id
        <where>
            T1.sys_dept_id in<foreach collection="ids" item="id" separator="," close=")" open="(">#{id}</foreach>
        </where>
        GROUP BY
        T1.id
    </select>
 
    <select id="userLoginFacotryList" resultType="com.ruoyi.project.system.domain.vo.SysUserDeptVo">
        SELECT
            T1.user_id,
            T1.dept_id,
            T2.dept_name
        FROM
            sys_user_dept T1
        LEFT JOIN sys_dept T2 ON T1.dept_id = T2.dept_id
        <where>
            T1.dept_id IN (select dept_id from sys_dept where parent_id != 0)
            <if test="userDeptVo.userId != null">
                AND T1.user_id = #{userDeptVo.userId}
            </if>
            <if test="userDeptVo.userName != null and userDeptVo.userName != '' ">
                AND T1.user_id IN (
                SELECT user_id FROM sys_user WHERE user_name LIKE CONCAT('%',#{userDeptVo.userName},'%')
                )
            </if>
        </where>
    </select>
</mapper>