lyh
2025-01-16 700ac5685214d37f128b3ad3dfda59e80381b9f6
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?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.jeecg.modules.dnc.mapper.DepartmentMapper">
    <select id="getUserPermDepart" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String">
        select r.depart_id, r.depart_name, r.depart_code, r.description
        from
        (select depart_id, depart_name, depart_code, description from sys_department where delete_flag=0) r
        inner join
        (select depart_id from sys_depart_user where user_id=#{userId}) ur
        on r.depart_id=ur.depart_id
    </select>
 
    <select id="getUserNonPermDepart" resultType="org.jeecg.modules.dnc.ucenter.Department" parameterType="String">
        select r.depart_id, r.depart_name, r.depart_code, r.description
        from (select depart_id, depart_name, depart_code, description from sys_department where delete_flag=0) r
        where r.depart_id not in
        (select depart_id from sys_depart_user where user_id=#{userId})
    </select>
 
    <resultMap id="deptExtBaseResult" type="org.jeecg.modules.dnc.dto.DepartmentExt">
        <id column="depart_id"  property="departId" />
        <collection column="depart_id" property="childList" select="findByParentId">
        </collection>
    </resultMap>
 
    <select id="findExtAll" resultMap="deptExtBaseResult">
        select
         depart_id
        , depart_name
        , depart_code
        , parent_id
        , priority
        , rank_level
        , mgr_man
        , description
        from sys_department
        where rank_level= 1 and delete_flag = 0
    </select>
 
    <select id="findByParentId" resultMap="deptExtBaseResult">
        select
         depart_id
        , depart_name
        , depart_code
        , parent_id
        , priority
        , rank_level
        , mgr_man
        , description
        from sys_department
        where delete_flag = 0 and parent_id=#{parentId}
    </select>
 
    <select id="getUserApproveDepart" parameterType="String" resultType="org.jeecg.modules.system.entity.SysUser">
        select u.id
        , u.username
        , u.realname
        , u.password
        , u.user_type
        , u.status
        , u.avatar
        , u.birthday
        , u.sex
        , u.phone
        , u.email
        from sys_user u
        inner join (select user_id from sys_depart_approve_user where depart_id=#{departId}) d
        on u.id=d.user_id
    </select>
 
    <select id="getUserNonApproveDepart" parameterType="String" resultType="org.jeecg.modules.system.entity.SysUser">
        select u.id
        , u.username
        , u.realname
        , u.password
        , u.user_type
        , u.status
        , u.avatar
        , u.birthday
        , u.sex
        , u.phone
        , u.email
        from sys_user u
        where u.id not in (select user_id from sys_depart_approve_user where depart_id=#{departId})
    </select>
</mapper>