| | |
| | | </foreach> |
| | | </select> |
| | | |
| | | <select id="getGridEventStatisticsByApp" resultType="com.panzhihua.common.model.vos.grid.GridEventStatisticsVO"> |
| | | SELECT |
| | | count( id ) AS todayNum, |
| | | ( |
| | | SELECT |
| | | count( id ) |
| | | FROM |
| | | `event` |
| | | WHERE |
| | | event_category = 1 |
| | | AND event_process_status = 2 |
| | | AND create_at BETWEEN DATE_FORMAT( DATE_ADD( curdate(), INTERVAL - DAY ( curdate())+ 1 DAY ), '%Y-%m-%d %H:%i:%s' ) |
| | | AND NOW() |
| | | <if test="gridId!=null"> |
| | | AND grid_id = #{gridId} |
| | | </if> |
| | | ) AS monthNum, |
| | | ( |
| | | SELECT |
| | | count( id ) |
| | | FROM |
| | | `event` |
| | | WHERE |
| | | event_category = 2 |
| | | AND event_status = 2 |
| | | AND create_at BETWEEN DATE_FORMAT( CURDATE(), '%Y-%m-%d %H:%i:%s' ) |
| | | AND NOW() |
| | | <if test="gridId!=null"> |
| | | AND grid_id = #{gridId} |
| | | </if> |
| | | ) AS todayEducationNum, |
| | | ( SELECT count( id ) FROM `event` WHERE event_category = 2 AND event_status = 2 ) AS educationNum, |
| | | ( |
| | | SELECT |
| | | count( id ) |
| | | FROM |
| | | `event` |
| | | WHERE |
| | | event_category = 1 |
| | | AND event_type = 6 |
| | | AND event_status = 2 |
| | | AND event_process_status = 2 |
| | | AND create_at BETWEEN DATE_FORMAT( CURDATE(), '%Y-%m-%d %H:%i:%s' ) |
| | | AND NOW() |
| | | <if test="gridId!=null"> |
| | | AND grid_id = #{gridId} |
| | | </if> |
| | | ) AS todaySpecialTotal, |
| | | ( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 6 AND event_status = 2 AND event_process_status = 2 ) AS specialTotal |
| | | FROM |
| | | `event` |
| | | WHERE |
| | | event_category = 1 |
| | | AND event_process_status = 2 |
| | | AND create_at BETWEEN DATE_FORMAT( CURDATE(), '%Y-%m-%d %H:%i:%s' ) |
| | | AND NOW() |
| | | <if test="gridId!=null"> |
| | | AND grid_id = #{gridId} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getGridEventDetailStatisticsByApp" parameterType="com.panzhihua.common.model.dtos.grid.GridEventStatisticsDTO" |
| | | resultType="com.panzhihua.common.model.vos.grid.GridEventStatisticsDetailVO"> |
| | | SELECT |
| | | count( e.id ) AS eventTFTotal, |
| | | ( |
| | | SELECT |
| | | count( id ) |
| | | FROM |
| | | `event` |
| | | WHERE |
| | | event_category = 1 |
| | | AND event_type = 5 |
| | | AND event_process_status IN ( 1, 3 ) |
| | | AND event_status = 2 |
| | | <if test="statisticsDTO.gridId!=null"> |
| | | AND grid_id = #{statisticsDTO.gridId} |
| | | </if> |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS noEventTFTotal, |
| | | ( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 3 AND event_process_status = 2 |
| | | <if test="statisticsDTO.gridId!=null"> |
| | | AND grid_id = #{statisticsDTO.gridId} |
| | | </if> |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS eventMDTotal, |
| | | ( |
| | | SELECT |
| | | count( id ) |
| | | FROM |
| | | `event` |
| | | WHERE |
| | | event_category = 1 |
| | | AND event_type = 3 |
| | | AND event_process_status IN ( 1, 3 ) |
| | | AND event_status = 2 |
| | | <if test="statisticsDTO.gridId!=null"> |
| | | AND grid_id = #{statisticsDTO.gridId} |
| | | </if> |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS noEventMDTotal, |
| | | ( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 1 AND event_process_status = 2 |
| | | <if test="statisticsDTO.gridId!=null"> |
| | | AND grid_id = #{statisticsDTO.gridId} |
| | | </if> |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS eventZATotal, |
| | | ( |
| | | SELECT |
| | | count( id ) |
| | | FROM |
| | | `event` |
| | | WHERE |
| | | event_category = 1 |
| | | AND event_type = 1 |
| | | AND event_process_status IN ( 1, 3 ) |
| | | AND event_status = 2 |
| | | <if test="statisticsDTO.gridId!=null"> |
| | | AND grid_id = #{statisticsDTO.gridId} |
| | | </if> |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS noEventZATotal, |
| | | ( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 4 AND event_process_status = 2 |
| | | <if test="statisticsDTO.gridId!=null"> |
| | | AND grid_id = #{statisticsDTO.gridId} |
| | | </if> |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS eventBWDTotal, |
| | | ( |
| | | SELECT |
| | | count( id ) |
| | | FROM |
| | | `event` |
| | | WHERE |
| | | event_category = 1 |
| | | AND event_type = 4 |
| | | AND event_process_status IN ( 1, 3 ) |
| | | AND event_status = 2 |
| | | <if test="statisticsDTO.gridId!=null"> |
| | | AND grid_id = #{statisticsDTO.gridId} |
| | | </if> |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS noEventBWDTotal, |
| | | ( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 6 AND event_process_status = 2 |
| | | <if test="statisticsDTO.gridId!=null"> |
| | | AND grid_id = #{statisticsDTO.gridId} |
| | | </if> |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS eventTSTotal, |
| | | ( |
| | | SELECT |
| | | count( id ) |
| | | FROM |
| | | `event` |
| | | WHERE |
| | | event_category = 1 |
| | | AND event_type = 6 |
| | | AND event_process_status IN ( 1, 3 ) |
| | | AND event_status = 2 |
| | | <if test="statisticsDTO.gridId!=null"> |
| | | AND grid_id = #{statisticsDTO.gridId} |
| | | </if> |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS noEventTSTotal, |
| | | ( SELECT count( id ) FROM `event` WHERE event_category = 1 AND event_type = 2 AND event_process_status = 2 |
| | | <if test="statisticsDTO.gridId!=null"> |
| | | AND grid_id = #{statisticsDTO.gridId} |
| | | </if> |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS eventGGTotal, |
| | | ( |
| | | SELECT |
| | | count( id ) |
| | | FROM |
| | | `event` |
| | | WHERE |
| | | event_category = 1 |
| | | AND event_type = 2 |
| | | AND event_process_status IN ( 1, 3 ) |
| | | AND event_status = 2 |
| | | <if test="statisticsDTO.gridId!=null"> |
| | | AND grid_id = #{statisticsDTO.gridId} |
| | | </if> |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS noEventGGTotal, |
| | | ( SELECT count( id ) FROM `event` WHERE event_category = 2 AND event_status = 2 |
| | | <if test="statisticsDTO.gridId!=null"> |
| | | AND grid_id = #{statisticsDTO.gridId} |
| | | </if> |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS eventXCTotal, |
| | | ( SELECT count( id ) FROM event_visiting_tasks WHERE event_status = 2 |
| | | <if test="statisticsDTO.gridId!=null"> |
| | | AND grid_id = #{statisticsDTO.gridId} |
| | | </if> |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS eventZFTotal, |
| | | ( |
| | | SELECT |
| | | count( id ) |
| | | FROM |
| | | event_visiting_tasks |
| | | WHERE |
| | | event_status IN ( 1, 3 ) |
| | | <if test="statisticsDTO.gridId!=null"> |
| | | AND grid_id = #{statisticsDTO.gridId} |
| | | </if> |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS noEventZFTotal, |
| | | ( SELECT count( id ) FROM com_act_easy_photo WHERE handle_status = 2 AND community_id = egd.grid_community_id |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS eventSSPTotal, |
| | | ( SELECT count( id ) FROM com_act_easy_photo WHERE handle_status = 1 AND community_id = egd.grid_community_id |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | ) AS noEventSSPTotal |
| | | FROM |
| | | `event` AS e |
| | | LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id |
| | | WHERE |
| | | e.event_category = 1 |
| | | AND e.event_type = 5 |
| | | AND e.event_process_status = 2 |
| | | <if test="statisticsDTO.gridId!=null"> |
| | | AND grid_id = #{statisticsDTO.gridId} |
| | | </if> |
| | | <if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'> |
| | | AND create_at <![CDATA[ >= ]]> #{statisticsDTO.ageStartTime} |
| | | </if> |
| | | <if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'> |
| | | AND create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |