| | |
| | | |
| | | <select id="getGridTodoData" resultType="com.panzhihua.common.model.vos.grid.UserEventGridDataVO" |
| | | parameterType="com.panzhihua.common.model.dtos.grid.EventGridTodoDataDTO"> |
| | | SELECT IFNULL(SUM(t.todoNums), 0) todoNums, 1 event_type |
| | | FROM ( |
| | | SELECT IFNULL(count(e.id), 0) as todoNums |
| | | FROM EVENT e |
| | | WHERE e.event_category = 1 AND event_status = 2 |
| | | AND (event_process_status = 1 OR event_process_status=3) AND process_type = 1 |
| | | AND grid_id = #{eventGridTodoDataDTO.gridId} |
| | | AND e.event_type = 1 |
| | | GROUP BY e.event_type |
| | | ) t |
| | | UNION ALL |
| | | SELECT IFNULL(SUM(t.todoNums), 0) todoNums, 2 event_type |
| | | FROM ( |
| | | SELECT IFNULL(count(e.id), 0) as todoNums |
| | | FROM EVENT e |
| | | WHERE e.event_category = 1 AND event_status = 2 |
| | | AND (event_process_status = 1 OR event_process_status=3) AND process_type = 1 |
| | | AND grid_id = #{eventGridTodoDataDTO.gridId} |
| | | AND e.event_type =2 |
| | | GROUP BY e.event_type |
| | | ) t |
| | | UNION ALL |
| | | SELECT IFNULL(SUM(t.todoNums), 0) todoNums, 3 event_type |
| | | FROM ( |
| | | SELECT IFNULL(count(e.id), 0) as todoNums |
| | | FROM EVENT e |
| | | WHERE e.event_category = 1 AND event_status = 2 |
| | | AND (event_process_status = 1 OR event_process_status=3) AND process_type = 1 |
| | | AND grid_id = #{eventGridTodoDataDTO.gridId} |
| | | AND e.event_type =3 |
| | | GROUP BY e.event_type |
| | | ) t |
| | | UNION ALL |
| | | SELECT IFNULL(SUM(t.todoNums), 0) todoNums, 4 event_type |
| | | FROM ( |
| | | SELECT IFNULL(count(e.id), 0) as todoNums |
| | | FROM EVENT e |
| | | WHERE e.event_category = 1 AND event_status = 2 |
| | | AND (event_process_status = 1 OR event_process_status=3) AND process_type = 1 |
| | | AND grid_id = #{eventGridTodoDataDTO.gridId} |
| | | AND e.event_type =4 |
| | | GROUP BY e.event_type |
| | | ) t |
| | | UNION ALL |
| | | SELECT IFNULL(SUM(t.todoNums), 0) todoNums, 5 event_type |
| | | FROM ( |
| | | SELECT IFNULL(count(e.id), 0) as todoNums |
| | | FROM EVENT e |
| | | WHERE e.event_category = 1 AND event_status = 2 |
| | | AND (event_process_status = 1 OR event_process_status=3) AND process_type = 1 |
| | | AND grid_id = #{eventGridTodoDataDTO.gridId} |
| | | AND e.event_type =5 |
| | | GROUP BY e.event_type |
| | | ) t |
| | | |
| | | SELECT |
| | | IFNULL( SUM( t.todoNums ), 0 ) todoNums, |
| | | 1 event_type |
| | | FROM |
| | | ( |
| | | SELECT |
| | | IFNULL( count( e.id ), 0 ) AS todoNums |
| | | FROM |
| | | EVENT e |
| | | WHERE |
| | | e.event_category = 1 |
| | | AND event_status = 2 |
| | | AND ( event_process_status = 1 OR event_process_status = 3 ) |
| | | AND process_type = 1 |
| | | AND grid_id = #{eventGridTodoDataDTO.gridId} |
| | | AND e.event_type = 1 |
| | | GROUP BY |
| | | e.event_type |
| | | ) t UNION ALL |
| | | SELECT |
| | | IFNULL( SUM( t.todoNums ), 0 ) todoNums, |
| | | 2 event_type |
| | | FROM |
| | | ( |
| | | SELECT |
| | | IFNULL( count( e.id ), 0 ) AS todoNums |
| | | FROM |
| | | EVENT e |
| | | WHERE |
| | | e.event_category = 1 |
| | | AND event_status = 2 |
| | | AND ( event_process_status = 1 OR event_process_status = 3 ) |
| | | AND process_type = 1 |
| | | AND grid_id = #{eventGridTodoDataDTO.gridId} |
| | | AND e.event_type = 2 |
| | | GROUP BY |
| | | e.event_type |
| | | ) t UNION ALL |
| | | SELECT |
| | | IFNULL( SUM( t.todoNums ), 0 ) todoNums, |
| | | 3 event_type |
| | | FROM |
| | | ( |
| | | SELECT |
| | | IFNULL( count( e.id ), 0 ) AS todoNums |
| | | FROM |
| | | EVENT e |
| | | WHERE |
| | | e.event_category = 1 |
| | | AND event_status = 2 |
| | | AND ( event_process_status = 1 OR event_process_status = 3 ) |
| | | AND process_type = 1 |
| | | AND grid_id = #{eventGridTodoDataDTO.gridId} |
| | | AND e.event_type = 3 |
| | | GROUP BY |
| | | e.event_type |
| | | ) t UNION ALL |
| | | SELECT |
| | | IFNULL( SUM( t.todoNums ), 0 ) todoNums, |
| | | 4 event_type |
| | | FROM |
| | | ( |
| | | SELECT |
| | | IFNULL( count( e.id ), 0 ) AS todoNums |
| | | FROM |
| | | EVENT e |
| | | WHERE |
| | | e.event_category = 1 |
| | | AND event_status = 2 |
| | | AND ( event_process_status = 1 OR event_process_status = 3 ) |
| | | AND process_type = 1 |
| | | AND grid_id = #{eventGridTodoDataDTO.gridId} |
| | | AND e.event_type = 4 |
| | | GROUP BY |
| | | e.event_type |
| | | ) t UNION ALL |
| | | SELECT |
| | | IFNULL( SUM( t.todoNums ), 0 ) todoNums, |
| | | 5 event_type |
| | | FROM |
| | | ( |
| | | SELECT |
| | | IFNULL( count( e.id ), 0 ) AS todoNums |
| | | FROM |
| | | EVENT e |
| | | WHERE |
| | | e.event_category = 1 |
| | | AND event_status = 2 |
| | | AND ( event_process_status = 1 OR event_process_status = 3 ) |
| | | AND process_type = 1 |
| | | AND grid_id = #{eventGridTodoDataDTO.gridId} |
| | | AND e.event_type = 5 |
| | | GROUP BY |
| | | e.event_type |
| | | ) t UNION ALL |
| | | SELECT |
| | | IFNULL( count( e.id ), 0 ) AS todoNums |
| | | 6 AS event_type |
| | | FROM |
| | | `event` AS e |
| | | WHERE |
| | | e.event_category = 1 |
| | | AND e.event_type = 6 |
| | | AND event_status = 2 |
| | | AND ( event_process_status = 1 OR event_process_status = 3 ) |
| | | AND grid_id = #{eventGridTodoDataDTO.gridId} UNION ALL |
| | | SELECT |
| | | IFNULL( count( cmp.id ), 0 ) AS todoNums, |
| | | 8 AS event_type |
| | | FROM |
| | | com_mng_population AS cmp |
| | | LEFT JOIN event_grid_data AS egd ON egd.grid_community_id = cmp.act_id |
| | | WHERE |
| | | egd.id = #{eventGridTodoDataDTO.gridId} UNION ALL |
| | | SELECT |
| | | IFNULL( count( id ), 0 ) AS todoNums, |
| | | 9 AS event_type |
| | | FROM |
| | | event_visiting_tasks |
| | | WHERE |
| | | event_status = 1 |
| | | OR event_status = 3 |
| | | </select> |
| | | |
| | | <select id="getComActByActId" resultType="com.panzhihua.common.model.vos.grid.ComGridActVO"> |