| | |
| | | and sd.dispatcher_unit_id = #{dispatcher.dispatcherUnitId} |
| | | </if> |
| | | <if test="dispatcher.deptId!=null"> |
| | | and sd.dept_id = #{dispatcher.deptId} |
| | | and sd.dept_id in |
| | | ( |
| | | select id from blade_dept where id = #{dispatcher.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 := #{dispatcher.deptId} ) t2 |
| | | ) t3 |
| | | WHERE |
| | | ischild != 0 |
| | | ) |
| | | </if> |
| | | <if test="dispatcher.dispatch!=null and dispatcher.dispatch!=''"> |
| | | and bu.dispatch = #{dispatcher.dispatch} |
| | | and sd.status = #{dispatcher.dispatch} |
| | | </if> |
| | | <if test="dispatcher.userIds!=null and dispatcher.userIds!=''"> |