| | |
| | | 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!=''"> |
| | |
| | | update sys_dispatcher set end_time =#{endTime} where dispatcher_unit_id =#{disId} |
| | | </update> |
| | | |
| | | <select id="getDispatcherStatisticsList" |
| | | resultType="org.springblade.modules.dispatcher.vo.DispatcherStatistics"> |
| | | |
| | | <!-- SELECT--> |
| | | <!-- sd.dept_id,--> |
| | | <!-- bd.dept_name,--> |
| | | <!-- COUNT(*) total,--> |
| | | <!-- SUM( CASE WHEN bu.hold = '1' THEN 1 ELSE 0 END ) AS holdNum,--> |
| | | <!-- SUM( CASE WHEN bu.hold = '2' THEN 1 ELSE 0 END ) AS unholdNum--> |
| | | <!-- FROM--> |
| | | <!-- sys_dispatcher sd--> |
| | | <!-- LEFT JOIN blade_user bu ON bu.id = sd.user_ids--> |
| | | <!-- LEFT JOIN blade_dept bd ON bd.id = sd.dept_id--> |
| | | <!-- WHERE sd.`status` = 0--> |
| | | <!-- <if test="statistics.deptId != null and statistics.deptId !='' ">--> |
| | | <!-- AND sd.dept_id = #{statistics.deptId}--> |
| | | <!-- </if>--> |
| | | <!-- GROUP BY--> |
| | | <!-- sd.dept_id,--> |
| | | <!-- bd.dept_name--> |
| | | |
| | | SELECT |
| | | sdu.id unitId, |
| | | sdu.name unitName, |
| | | COUNT(*) total, |
| | | SUM( CASE WHEN bu.hold = '1' THEN 1 ELSE 0 END ) AS holdNum, |
| | | SUM( CASE WHEN bu.hold = '2' THEN 1 ELSE 0 END ) AS unholdNum |
| | | FROM |
| | | sys_dispatcher sd |
| | | LEFT JOIN blade_user bu ON bu.id = sd.user_ids |
| | | LEFT JOIN sys_dispatcher_unit sdu ON sdu.id = sd.dispatcher_unit_id |
| | | LEFT JOIN blade_dept bd ON bd.id = sd.dept_id |
| | | WHERE |
| | | sd.`status` = 0 |
| | | <if test="statistics.deptId != null and statistics.deptId !='' "> |
| | | AND sd.dept_id = #{statistics.deptId} |
| | | </if> |
| | | GROUP BY |
| | | sdu.id, |
| | | sdu.name |
| | | |
| | | </select> |
| | | <select id="selectDispatcherUnitExist" |
| | | resultType="org.springblade.modules.dispatcher.entity.DispatcherUnit"> |
| | | |
| | | SELECT * FROM sys_dispatcher_unit WHERE name = #{dispatchUnitName} limit 1 |
| | | |
| | | </select> |
| | | |
| | | </mapper> |