智慧保安后台管理-外网项目备份
钟日健
2026-06-01 62eb499b0c969f246d3245d1429a97da4de1ce28
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<?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.springblade.modules.dispatcher.mapper.DispatcherUnitMapper">
 
    <!--派遣公司分页信息-->
    <select id="selectDispatcherUnitPage" resultType="org.springblade.modules.dispatcher.vo.DispatcherUnitVO">
        select
            sdu.*,bt.dept_name deptName,sj.dept_name jurisdictionName
        from
            sys_dispatcher_unit sdu
        LEFT JOIN
            blade_dept bt
        ON
            sdu.dept_id = bt.id
        left join
            sys_jurisdiction sj
        on
            sj.id = sdu.jurisdiction
        LEFT JOIN blade_dict_biz bdb ON bdb.dict_key = sdu.profession and  bdb.is_deleted = 0
        WHERE
            1=1
        and bdb.code = 'dispatchProfession'
        <if test="dispatcherUnit.profession != null and dispatcherUnit.profession !=''">
            and sdu.profession in
            <foreach collection="dispatcherUnit.profession.split(',')" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="dispatcherUnit.deptName!=null and  dispatcherUnit.deptName!=''">
            and bt.dept_name like concat('%', #{dispatcherUnit.deptName},'%')
        </if>
        <if test="dispatcherUnit.name!=null and  dispatcherUnit.name!=''">
            and sdu.name like concat('%', #{dispatcherUnit.name},'%')
        </if>
        <if test="dispatcherUnit.linkman!=null and  dispatcherUnit.linkman!=''">
            and sdu.linkman like concat('%', #{dispatcherUnit.linkman},'%')
        </if>
        <if test="dispatcherUnit.phone!=null and  dispatcherUnit.phone!=''">
            and sdu.phone like concat('%', #{dispatcherUnit.phone},'%')
        </if>
        <if test="dispatcherUnit.province!=null">
            and sdu.province = #{dispatcherUnit.province}
        </if>
        <if test="dispatcherUnit.city!=null">
            and sdu.city = #{dispatcherUnit.city}
        </if>
        <if test="dispatcherUnit.jurisdiction!=null and dispatcherUnit.jurisdiction!='' and dispatcherUnit.jurisdiction!='1372091709474910209'">
            and (sj.id = #{dispatcherUnit.jurisdiction} or sj.parent_id = #{dispatcherUnit.jurisdiction})
        </if>
        <if test="dispatcherUnit.deptId!=null and dispatcherUnit.deptId!=''">
            and sdu.dept_id in
            (
                select id from blade_dept where id = #{dispatcherUnit.deptId}
                union
                SELECT
                id
                FROM
                (
                SELECT
                t1.id,t1.parent_id,t1.dept_name,
                IF
                ( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
                FROM
                ( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
                ( SELECT @pids := #{dispatcherUnit.deptId} ) t2
                ) t3
                WHERE
                ischild != 0
            )
        </if>
        <if test="dispatcherUnit.district!=null">
            and sdu.district = #{dispatcherUnit.district}
        </if>
        <if test="dispatcherUnit.beginTime!=null or dispatcherUnit.overTime!=null">
            <if test="dispatcherUnit.beginTime!='' or dispatcherUnit.overTime!=''">
                and sdu.end_time &lt;= #{dispatcherUnit.overTime} and sdu.end_time &gt;= #{dispatcherUnit.beginTime}
                or ( sdu.start_time &lt;= #{dispatcherUnit.overTime} and sdu.start_time &gt;= #{dispatcherUnit.beginTime})
            </if>
        </if>
        <if test="dispatcherUnit.isExpire==1">
            and sdu.start_time &lt;= now()
            and sdu.end_time &gt; now()
        </if>
        <if test="dispatcherUnit.isExpire==2">
            and sdu.end_time &lt;= now()
        </if>
    </select>
 
    <select id="getAll" resultType="org.springblade.modules.dispatcher.vo.DispatcherUnitVO">
        select
        sdu.*,bt.dept_name deptName,sj.dept_name jurisdictionName,bdb.dict_value as professionName
        from
        sys_dispatcher_unit sdu
        LEFT JOIN
        blade_dept bt
        ON
        sdu.dept_id = bt.id
        left join
        sys_jurisdiction sj
        on
        sj.id = sdu.jurisdiction
        LEFT JOIN blade_dict_biz bdb ON bdb.dict_key = sdu.profession and  bdb.is_deleted = 0
        WHERE
        1=1
        and bdb.code = 'dispatchProfession'
        <if test="dispatcherUnit.profession != null and dispatcherUnit.profession !=''">
            and sdu.profession in
            <foreach collection="dispatcherUnit.profession.split(',')" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="dispatcherUnit.deptName!=null and  dispatcherUnit.deptName!=''">
            and bt.dept_name like concat('%', #{dispatcherUnit.deptName},'%')
        </if>
        <if test="dispatcherUnit.name!=null and  dispatcherUnit.name!=''">
            and sdu.name like concat('%', #{dispatcherUnit.name},'%')
        </if>
        <if test="dispatcherUnit.linkman!=null and  dispatcherUnit.linkman!=''">
            and sdu.linkman like concat('%', #{dispatcherUnit.linkman},'%')
        </if>
        <if test="dispatcherUnit.phone!=null and  dispatcherUnit.phone!=''">
            and sdu.phone like concat('%', #{dispatcherUnit.phone},'%')
        </if>
        <if test="dispatcherUnit.province!=null">
            and sdu.province = #{dispatcherUnit.province}
        </if>
        <if test="dispatcherUnit.city!=null">
            and sdu.city = #{dispatcherUnit.city}
        </if>
        <if test="dispatcherUnit.jurisdiction!=null and dispatcherUnit.jurisdiction!='' and dispatcherUnit.jurisdiction!='1372091709474910209'">
            and (sj.id = #{dispatcherUnit.jurisdiction} or sj.parent_id = #{dispatcherUnit.jurisdiction})
        </if>
        <if test="dispatcherUnit.deptId!=null and dispatcherUnit.deptId!=''">
            and sdu.dept_id in
            (
            select id from blade_dept where id = #{dispatcherUnit.deptId}
            union
            SELECT
            id
            FROM
            (
            SELECT
            t1.id,t1.parent_id,t1.dept_name,
            IF
            ( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
            FROM
            ( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
            ( SELECT @pids := #{dispatcherUnit.deptId} ) t2
            ) t3
            WHERE
            ischild != 0
            )
        </if>
        <if test="dispatcherUnit.district!=null">
            and sdu.district = #{dispatcherUnit.district}
        </if>
        <if test="dispatcherUnit.beginTime!=null or dispatcherUnit.overTime!=null">
            <if test="dispatcherUnit.beginTime!='' or dispatcherUnit.overTime!=''">
                and sdu.end_time &lt;= #{dispatcherUnit.overTime} and sdu.end_time &gt;= #{dispatcherUnit.beginTime}
                or ( sdu.start_time &lt;= #{dispatcherUnit.overTime} and sdu.start_time &gt;= #{dispatcherUnit.beginTime})
            </if>
        </if>
        <if test="dispatcherUnit.isExpire==1">
            and sdu.start_time &lt;= now()
            and sdu.end_time &gt; now()
        </if>
        <if test="dispatcherUnit.isExpire==2">
            and sdu.end_time &lt;= now()
        </if>
    </select>
 
 
    <!--自定义树-->
    <select id="selectDispatcherUnitPageTree" resultType="org.springblade.modules.dispatcher.vo.DispatcherUnitVO">
        select
        sdu.id,sdu.name
        from
        sys_dispatcher_unit sdu
        LEFT JOIN
        blade_dept bt
        ON
        sdu.dept_id = bt.id
        WHERE
        1=1
        <if test="dispatcherUnit.deptName!=null and  dispatcherUnit.deptName!=''">
            and bt.dept_name like concat('%', #{dispatcherUnit.deptName},'%')
        </if>
        <if test="dispatcherUnit.deptId!=null and  dispatcherUnit.deptId!=''">
            and sdu.dept_id like concat('%', #{dispatcherUnit.deptId},'%')
        </if>
        <if test="dispatcherUnit.name!=null and  dispatcherUnit.name!=''">
            and sdu.name like concat('%', #{dispatcherUnit.name},'%')
        </if>
        <if test="dispatcherUnit.linkman!=null and  dispatcherUnit.linkman!=''">
            and sdu.linkman like concat('%', #{dispatcherUnit.linkman},'%')
        </if>
        <if test="dispatcherUnit.phone!=null and  dispatcherUnit.phone!=''">
            and sdu.phone like concat('%', #{dispatcherUnit.phone},'%')
        </if>
        <if test="dispatcherUnit.province!=null">
            and sdu.province = #{dispatcherUnit.province}
        </if>
        <if test="dispatcherUnit.city!=null">
            and sdu.city = #{dispatcherUnit.city}
        </if>
        <if test="dispatcherUnit.jurisdiction!=null">
            and sdu.jurisdiction = #{dispatcherUnit.jurisdiction}
        </if>
        <if test="dispatcherUnit.district!=null">
            and sdu.district = #{dispatcherUnit.district}
        </if>
    </select>
 
 
    <!--派遣公司详细信息-->
    <select id="selectDispatcherUnitInfo" resultType="org.springblade.modules.dispatcher.vo.DispatcherUnitVO">
        select
            sdu.*,bt.dept_name deptName
        from
            sys_dispatcher_unit sdu
        LEFT JOIN
            blade_dept bt
        ON
            sdu.dept_id = bt.id
        where
            1=1
        <if test="dispatcherUnit.id!=null">
            and sdu.id = #{dispatcherUnit.id}
        </if>
    </select>
</mapper>