<?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="com.panzhihua.service_grid.dao.EventMapper">
|
|
<resultMap id="baseResult" type="com.panzhihua.service_grid.model.dos.EventDO">
|
<result property="id" column="id"/>
|
<result property="orderSn" column="order_sn"/>
|
<result property="eventCategory" column="event_category"/>
|
<result property="gridMemberStreet" column="grid_member_street"/>
|
<result property="gridMemberCommunity" column="grid_member_community"/>
|
<result property="gridId" column="grid_id"/>
|
<result property="gridMemberId" column="grid_member_id"/>
|
<result property="gridMemberName" column="grid_member_name"/>
|
<result property="gridMemberTelephone" column="grid_member_telephone"/>
|
<result property="eventTitle" column="event_title"/>
|
<result property="propagandaType" column="propaganda_type"/>
|
<result property="propagandaTime" column="propaganda_time"/>
|
<result property="eventType" column="event_type"/>
|
<result property="eventDes" column="event_des"/>
|
<result property="propagandaObject" column="propaganda_object"/>
|
<result property="propagandaNum" column="propaganda_num"/>
|
<result property="communityProcess" column="community_process"/>
|
<result property="happenTime" column="happen_time"/>
|
<result property="happentAddress" column="happent_address"/>
|
<result property="happenAddress" column="happen_address"/>
|
<result property="happentLatLng" column="happent_lat_lng"/>
|
<result property="eventStatus" column="event_status"/>
|
<result property="eventProcessStatus" column="event_process_status"/>
|
<result property="processType" column="process_type"/>
|
<result property="processUserId" column="process_user_id"/>
|
<result property="processUserName" column="process_user_name"/>
|
<result property="processDate" column="process_date"/>
|
<result property="processDesc" column="process_desc"/>
|
<result property="eventResource" column="event_resource"/>
|
<result property="dangerLevel" column="danger_level"/>
|
<result property="redCard" column="red_card"/>
|
<result property="yellowCard" column="yellow_card"/>
|
<result property="invalid" column="invalid"/>
|
<result property="major" column="major"/>
|
<result property="deathsNumber" column="deaths_number"/>
|
<result property="injuriesNumber" column="injuries_number"/>
|
<result property="difficult" column="difficult"/>
|
<result property="urgent" column="urgent"/>
|
<result property="urgentDell" column="urgent_dell"/>
|
<result property="submitDate" column="submit_date"/>
|
<result property="createBy" column="create_by"/>
|
<result property="createAt" column="create_at"/>
|
<result property="updateBy" column="update_by"/>
|
<result property="updateAt" column="update_at"/>
|
<result property="eventClazz" column="event_clazz"/>
|
<result property="eventDealStatus" column="event_deal_status"/>
|
</resultMap>
|
|
<sql id="columns">
|
<![CDATA[
|
id,order_sn,event_category,grid_member_street,happen_address,grid_member_community,event_clazz,grid_id,grid_member_id,grid_member_name,grid_member_telephone,
|
event_title,propaganda_type,propaganda_time,event_type,event_des,propaganda_object,propaganda_num,community_process,happen_time,happent_address,happent_lat_lng,
|
event_status,event_process_status,process_type,process_user_id,process_user_name,process_date,process_desc,event_resource,danger_level,red_card,yellow_card,invalid,
|
major,deaths_number,injuries_number,difficult,urgent,urgent_dell,submit_date,create_by,create_at,update_by,update_at,event_deal_status
|
]]>
|
</sql>
|
|
|
<select id="findByPage" resultType="com.panzhihua.common.model.vos.grid.EventVO"
|
parameterType="com.panzhihua.common.model.dtos.grid.PageEventDTO">
|
SELECT <include refid="columns" />
|
FROM event
|
<where>
|
event_status != 3 AND event_category = 1
|
<if test="pageEventDTO.eventDealStatus!=null">
|
AND event_deal_status = #{pageEventDTO.eventDealStatus}
|
</if>
|
<if test="pageEventDTO.isAll!=null and pageEventDTO.isAll == 1">
|
AND event_deal_status in (1,2,4)
|
</if>
|
<if test="pageEventDTO.revokeType!=null">
|
AND ( revoke_type = #{pageEventDTO.revokeType} OR revoke_type is null )
|
</if>
|
<if test="pageEventDTO.id!=null">
|
AND id = #{pageEventDTO.id}
|
</if>
|
<if test="pageEventDTO.orderSn!=null">
|
AND order_sn = #{pageEventDTO.orderSn}
|
</if>
|
<if test="pageEventDTO.eventCategory!=null">
|
AND event_category = #{pageEventDTO.eventCategory}
|
</if>
|
<if test="pageEventDTO.gridMemberStreet!=null">
|
AND grid_member_street = #{pageEventDTO.gridMemberStreet}
|
</if>
|
<if test="pageEventDTO.gridMemberCommunity!=null">
|
AND grid_member_community = #{pageEventDTO.gridMemberCommunity}
|
</if>
|
<if test="pageEventDTO.gridId!=null">
|
AND grid_id = #{pageEventDTO.gridId}
|
</if>
|
<if test="pageEventDTO.gridMemberId!=null">
|
AND grid_member_id = #{pageEventDTO.gridMemberId}
|
</if>
|
<if test="pageEventDTO.gridMemberName!=null">
|
AND grid_member_name = #{pageEventDTO.gridMemberName}
|
</if>
|
<if test="pageEventDTO.gridMemberTelephone!=null">
|
AND grid_member_telephone = #{pageEventDTO.gridMemberTelephone}
|
</if>
|
<if test="pageEventDTO.eventTitle!=null">
|
AND event_title = #{pageEventDTO.eventTitle}
|
</if>
|
<if test="pageEventDTO.propagandaType!=null">
|
AND propaganda_type = #{pageEventDTO.propagandaType}
|
</if>
|
<if test="pageEventDTO.propagandaTimeBegin!=null">
|
AND propaganda_time <![CDATA[>=]]> #{pageEventDTO.propagandaTimeBegin}
|
</if>
|
<if test="pageEventDTO.propagandaTimeEnd!=null">
|
AND propaganda_time <![CDATA[<=]]> #{pageEventDTO.propagandaTimeEnd}
|
</if>
|
<if test="pageEventDTO.eventType!=null">
|
AND event_type = #{pageEventDTO.eventType}
|
</if>
|
<if test="pageEventDTO.eventDes!=null">
|
AND event_des = #{pageEventDTO.eventDes}
|
</if>
|
<if test="pageEventDTO.eventClazz!=null">
|
AND event_clazz like concat(#{pageEventDTO.eventClazz},'%')
|
</if>
|
<if test="pageEventDTO.propagandaObject!=null">
|
AND propaganda_object = #{pageEventDTO.propagandaObject}
|
</if>
|
<if test="pageEventDTO.propagandaNum!=null">
|
AND propaganda_num = #{pageEventDTO.propagandaNum}
|
</if>
|
<if test="pageEventDTO.communityProcess!=null">
|
AND community_process = #{pageEventDTO.communityProcess}
|
</if>
|
<if test="pageEventDTO.happenTimeBegin!=null">
|
AND happen_time <![CDATA[>=]]> #{pageEventDTO.happenTimeBegin}
|
</if>
|
<if test="pageEventDTO.happenTimeEnd!=null">
|
AND happen_time <![CDATA[<=]]> #{pageEventDTO.happenTimeEnd}
|
</if>
|
<if test="pageEventDTO.happentAddress!=null">
|
AND happent_address = #{pageEventDTO.happentAddress}
|
</if>
|
<if test="pageEventDTO.happentLatLng!=null">
|
AND happent_lat_lng = #{pageEventDTO.happentLatLng}
|
</if>
|
<if test="pageEventDTO.eventStatus!=null">
|
AND event_status = #{pageEventDTO.eventStatus}
|
</if>
|
<if test="pageEventDTO.eventProcessStatus!=null">
|
AND event_process_status = #{pageEventDTO.eventProcessStatus}
|
</if>
|
<if test="pageEventDTO.processType!=null">
|
AND process_type = #{pageEventDTO.processType}
|
</if>
|
<if test="pageEventDTO.processUserId!=null">
|
AND process_user_id = #{pageEventDTO.processUserId}
|
</if>
|
<if test="pageEventDTO.processUserName!=null">
|
AND process_user_name = #{pageEventDTO.processUserName}
|
</if>
|
<if test="pageEventDTO.processDateBegin!=null">
|
AND process_date <![CDATA[>=]]> #{pageEventDTO.processDateBegin}
|
</if>
|
<if test="pageEventDTO.processDateEnd!=null">
|
AND process_date <![CDATA[<=]]> #{pageEventDTO.processDateEnd}
|
</if>
|
<if test="pageEventDTO.processDesc!=null">
|
AND process_desc = #{pageEventDTO.processDesc}
|
</if>
|
<if test="pageEventDTO.eventResource!=null">
|
AND event_resource = #{pageEventDTO.eventResource}
|
</if>
|
<if test="pageEventDTO.dangerLevel!=null">
|
AND danger_level = #{pageEventDTO.dangerLevel}
|
</if>
|
<if test="pageEventDTO.redCard!=null">
|
AND red_card = #{pageEventDTO.redCard}
|
</if>
|
<if test="pageEventDTO.yellowCard!=null">
|
AND yellow_card = #{pageEventDTO.yellowCard}
|
</if>
|
<if test="pageEventDTO.invalid!=null">
|
AND invalid = #{pageEventDTO.invalid}
|
</if>
|
<if test="pageEventDTO.major!=null">
|
AND major = #{pageEventDTO.major}
|
</if>
|
<if test="pageEventDTO.deathsNumber!=null">
|
AND deaths_number = #{pageEventDTO.deathsNumber}
|
</if>
|
<if test="pageEventDTO.injuriesNumber!=null">
|
AND injuries_number = #{pageEventDTO.injuriesNumber}
|
</if>
|
<if test="pageEventDTO.difficult!=null">
|
AND difficult = #{pageEventDTO.difficult}
|
</if>
|
<if test="pageEventDTO.urgent!=null">
|
AND urgent = #{pageEventDTO.urgent}
|
</if>
|
<if test="pageEventDTO.urgentDell!=null">
|
AND urgent_dell = #{pageEventDTO.urgentDell}
|
</if>
|
<if test="pageEventDTO.submitDateBegin!=null">
|
AND submit_date <![CDATA[>=]]> #{pageEventDTO.submitDateBegin}
|
</if>
|
<if test="pageEventDTO.submitDateEnd!=null">
|
AND submit_date <![CDATA[<=]]> #{pageEventDTO.submitDateEnd}
|
</if>
|
<if test="pageEventDTO.createBy!=null">
|
AND create_by = #{pageEventDTO.createBy}
|
</if>
|
<if test="pageEventDTO.createAtBegin!=null">
|
AND create_at <![CDATA[>=]]> #{pageEventDTO.createAtBegin}
|
</if>
|
<if test="pageEventDTO.createAtEnd!=null">
|
AND create_at <![CDATA[<=]]> #{pageEventDTO.createAtEnd}
|
</if>
|
<if test="pageEventDTO.updateBy!=null">
|
AND update_by = #{pageEventDTO.updateBy}
|
</if>
|
<if test="pageEventDTO.updateAtBegin!=null">
|
AND update_at <![CDATA[>=]]> #{pageEventDTO.updateAtBegin}
|
</if>
|
<if test="pageEventDTO.updateAtEnd!=null">
|
AND update_at <![CDATA[<=]]> #{pageEventDTO.updateAtEnd}
|
</if>
|
</where>
|
order by event_deal_status asc,create_at desc
|
</select>
|
<select id="findPublicityByPage" resultType="com.panzhihua.common.model.vos.grid.EventVO"
|
parameterType="com.panzhihua.common.model.dtos.grid.PagePublicityEventDTO">
|
SELECT
|
e.id,e.order_sn,e.event_category,e.grid_member_street,e.happen_address,e.grid_member_community,e.event_clazz,e.grid_id,e.grid_member_id,e.grid_member_name,e.grid_member_telephone,
|
e.event_title,e.propaganda_type,e.propaganda_time,e.event_type,e.event_des,e.propaganda_object,e.propaganda_num,e.community_process,e.happen_time,e.happent_address,e.happent_lat_lng,
|
e.event_status,e.event_process_status,e.process_type,e.process_user_id,e.process_user_name,e.process_date,e.process_desc,e.event_resource,e.danger_level,e.red_card,e.yellow_card,e.invalid,
|
e.major,e.deaths_number,e.injuries_number,e.difficult,e.urgent,e.urgent_dell,e.submit_date,e.create_by,e.create_at,e.update_by,e.update_at,e.event_deal_status
|
FROM
|
event e left join event_grid_data egd on e.grid_id = egd.id
|
<where>
|
e.event_status != 3 AND e.event_category = 2
|
<if test="pagePublicityEventDTO.communityId!=null">
|
AND egd.grid_community_id = ${pagePublicityEventDTO.communityId}
|
</if>
|
|
<if test="pagePublicityEventDTO.revokeType!=null">
|
AND ( e.revoke_type = #{pagePublicityEventDTO.revokeType} OR e.revoke_type is null )
|
</if>
|
<if test="pagePublicityEventDTO.eventDealStatus!=null">
|
AND e.event_deal_status = #{pagePublicityEventDTO.eventDealStatus}
|
</if>
|
<if test="pagePublicityEventDTO.id!=null">
|
AND e.id = #{pagePublicityEventDTO.id}
|
</if>
|
<if test="pagePublicityEventDTO.orderSn!=null">
|
AND e.order_sn = #{pagePublicityEventDTO.orderSn}
|
</if>
|
<if test="pagePublicityEventDTO.eventCategory!=null">
|
AND e.event_category = #{pagePublicityEventDTO.eventCategory}
|
</if>
|
<if test="pagePublicityEventDTO.gridMemberStreet!=null">
|
AND e.grid_member_street = #{pagePublicityEventDTO.gridMemberStreet}
|
</if>
|
<if test="pagePublicityEventDTO.gridMemberCommunity!=null">
|
AND e.grid_member_community = #{pagePublicityEventDTO.gridMemberCommunity}
|
</if>
|
<if test="pagePublicityEventDTO.gridId!=null">
|
AND e.grid_id = #{pagePublicityEventDTO.gridId}
|
</if>
|
<if test="pagePublicityEventDTO.gridMemberId!=null">
|
AND e.grid_member_id = #{pagePublicityEventDTO.gridMemberId}
|
</if>
|
<if test="pagePublicityEventDTO.gridMemberName!=null">
|
AND e.grid_member_name = #{pagePublicityEventDTO.gridMemberName}
|
</if>
|
<if test="pagePublicityEventDTO.gridMemberTelephone!=null">
|
AND e.grid_member_telephone = #{pagePublicityEventDTO.gridMemberTelephone}
|
</if>
|
<if test="pagePublicityEventDTO.eventTitle!=null">
|
AND e.event_title = #{pagePublicityEventDTO.eventTitle}
|
</if>
|
<if test="pagePublicityEventDTO.propagandaType!=null">
|
AND e.propaganda_type = #{pagePublicityEventDTO.propagandaType}
|
</if>
|
<if test="pagePublicityEventDTO.propagandaTimeBegin!=null">
|
AND e.propaganda_time <![CDATA[>=]]> #{pagePublicityEventDTO.propagandaTimeBegin}
|
</if>
|
<if test="pagePublicityEventDTO.propagandaTimeEnd!=null">
|
AND e.propaganda_time <![CDATA[<=]]> #{pagePublicityEventDTO.propagandaTimeEnd}
|
</if>
|
<if test="pagePublicityEventDTO.eventDes!=null">
|
AND e.event_des = #{pagePublicityEventDTO.eventDes}
|
</if>
|
<if test="pagePublicityEventDTO.propagandaObject!=null">
|
AND e.propaganda_object = #{pagePublicityEventDTO.propagandaObject}
|
</if>
|
<if test="pagePublicityEventDTO.propagandaNum!=null">
|
AND e.propaganda_num = #{pagePublicityEventDTO.propagandaNum}
|
</if>
|
<if test="pagePublicityEventDTO.communityProcess!=null">
|
AND e.community_process = #{pagePublicityEventDTO.communityProcess}
|
</if>
|
<if test="pagePublicityEventDTO.happenTimeBegin!=null">
|
AND e.happen_time <![CDATA[>=]]> #{pagePublicityEventDTO.happenTimeBegin}
|
</if>
|
<if test="pagePublicityEventDTO.happenTimeEnd!=null">
|
AND e.happen_time <![CDATA[<=]]> #{pagePublicityEventDTO.happenTimeEnd}
|
</if>
|
<if test="pagePublicityEventDTO.happentAddress!=null">
|
AND e.happent_address = #{pagePublicityEventDTO.happentAddress}
|
</if>
|
<if test="pagePublicityEventDTO.happentLatLng!=null">
|
AND e.happent_lat_lng = #{pagePublicityEventDTO.happentLatLng}
|
</if>
|
<if test="pagePublicityEventDTO.eventStatus!=null">
|
AND e.event_status = #{pagePublicityEventDTO.eventStatus}
|
</if>
|
<if test="pagePublicityEventDTO.eventProcessStatus!=null">
|
AND e.event_process_status = #{pagePublicityEventDTO.eventProcessStatus}
|
</if>
|
<if test="pagePublicityEventDTO.processType!=null">
|
AND e.process_type = #{pagePublicityEventDTO.processType}
|
</if>
|
<if test="pagePublicityEventDTO.processUserId!=null">
|
AND e.process_user_id = #{pagePublicityEventDTO.processUserId}
|
</if>
|
<if test="pagePublicityEventDTO.processUserName!=null">
|
AND e.process_user_name = #{pagePublicityEventDTO.processUserName}
|
</if>
|
<if test="pagePublicityEventDTO.processDateBegin!=null">
|
AND e.process_date <![CDATA[>=]]> #{pagePublicityEventDTO.processDateBegin}
|
</if>
|
<if test="pagePublicityEventDTO.processDateEnd!=null">
|
AND e.process_date <![CDATA[<=]]> #{pagePublicityEventDTO.processDateEnd}
|
</if>
|
<if test="pagePublicityEventDTO.processDesc!=null">
|
AND e.process_desc = #{pagePublicityEventDTO.processDesc}
|
</if>
|
<if test="pagePublicityEventDTO.eventResource!=null">
|
AND e.event_resource = #{pagePublicityEventDTO.eventResource}
|
</if>
|
<if test="pagePublicityEventDTO.dangerLevel!=null">
|
AND e.danger_level = #{pagePublicityEventDTO.dangerLevel}
|
</if>
|
<if test="pagePublicityEventDTO.redCard!=null">
|
AND e.red_card = #{pagePublicityEventDTO.redCard}
|
</if>
|
<if test="pagePublicityEventDTO.yellowCard!=null">
|
AND e.yellow_card = #{pagePublicityEventDTO.yellowCard}
|
</if>
|
<if test="pagePublicityEventDTO.invalid!=null">
|
AND e.invalid = #{pagePublicityEventDTO.invalid}
|
</if>
|
<if test="pagePublicityEventDTO.major!=null">
|
AND e.major = #{pagePublicityEventDTO.major}
|
</if>
|
<if test="pagePublicityEventDTO.deathsNumber!=null">
|
AND e.deaths_number = #{pagePublicityEventDTO.deathsNumber}
|
</if>
|
<if test="pagePublicityEventDTO.injuriesNumber!=null">
|
AND e.injuries_number = #{pagePublicityEventDTO.injuriesNumber}
|
</if>
|
<if test="pagePublicityEventDTO.difficult!=null">
|
AND e.difficult = #{pagePublicityEventDTO.difficult}
|
</if>
|
<if test="pagePublicityEventDTO.urgent!=null">
|
AND e.urgent = #{pagePublicityEventDTO.urgent}
|
</if>
|
<if test="pagePublicityEventDTO.urgentDell!=null">
|
AND e.urgent_dell = #{pagePublicityEventDTO.urgentDell}
|
</if>
|
<if test="pagePublicityEventDTO.submitDateBegin!=null">
|
AND e.submit_date <![CDATA[>=]]> #{pagePublicityEventDTO.submitDateBegin}
|
</if>
|
<if test="pagePublicityEventDTO.submitDateEnd!=null">
|
AND e.submit_date <![CDATA[<=]]> #{pagePublicityEventDTO.submitDateEnd}
|
</if>
|
<if test="pagePublicityEventDTO.createBy!=null">
|
AND e.create_by = #{pagePublicityEventDTO.createBy}
|
</if>
|
<if test="pagePublicityEventDTO.createAtBegin!=null">
|
AND e.create_at <![CDATA[>=]]> #{pagePublicityEventDTO.createAtBegin}
|
</if>
|
<if test="pagePublicityEventDTO.createAtEnd!=null">
|
AND e.create_at <![CDATA[<=]]> #{pagePublicityEventDTO.createAtEnd}
|
</if>
|
<if test="pagePublicityEventDTO.updateBy!=null">
|
AND e.update_by = #{pagePublicityEventDTO.updateBy}
|
</if>
|
<if test="pagePublicityEventDTO.updateAtBegin!=null">
|
AND e.update_at <![CDATA[>=]]> #{pagePublicityEventDTO.updateAtBegin}
|
</if>
|
<if test="pagePublicityEventDTO.updateAtEnd!=null">
|
AND e.update_at <![CDATA[<=]]> #{pagePublicityEventDTO.updateAtEnd}
|
</if>
|
</where>
|
<if test="pagePublicityEventDTO.sortColumns!=null">
|
ORDER BY e.${pagePublicityEventDTO.sortColumns} ${pagePublicityEventDTO.sortType}
|
</if>
|
</select>
|
|
<select id="getEventByGridId" resultType="com.panzhihua.common.model.vos.grid.ComMapGridEventVO">
|
SELECT
|
id,
|
event_type AS type,
|
event_des AS eventTitle,
|
happent_address AS happentAddress,
|
happen_address AS happenAddress,
|
happent_lat_lng AS happentLatLng
|
FROM
|
`event`
|
WHERE
|
( event_category = 1 OR event_category = 2 )
|
AND event_process_status = 1
|
AND event_status = 2
|
AND grid_id = #{gridId}
|
AND process_type = 1 UNION ALL
|
SELECT
|
id,
|
IFNULL( NULL, 7 ) AS type,
|
event_des AS eventTitle,
|
happent_address AS happentAddress,
|
happen_address AS happenAddress,
|
happent_lat_lng AS happentLatLng
|
FROM
|
event_visiting_tasks
|
WHERE
|
event_status = 1
|
AND dell_type = 1
|
AND grid_id = #{gridId}
|
</select>
|
|
<select id="getGridMemberImageUrl" resultType="Map">
|
select image_url,nick_name from sys_user where user_id = #{gridMemberId}
|
</select>
|
<select id="findToManageByPage" resultType="com.panzhihua.common.model.vos.grid.EventVO"
|
parameterType="com.panzhihua.common.model.dtos.grid.PageEventManageDTO">
|
SELECT
|
e.id,e.order_sn,e.event_category,e.grid_member_street,e.happen_address,e.grid_member_community,e.event_clazz,e.grid_id,e.grid_member_id,e.grid_member_name,e.grid_member_telephone,
|
e.event_title,e.propaganda_type,e.propaganda_time,e.event_type,e.event_des,e.propaganda_object,e.propaganda_num,e.community_process,e.happen_time,e.happent_address,e.happent_lat_lng,
|
e.event_status,e.event_process_status,e.process_type,e.process_user_id,e.process_user_name,e.process_date,e.process_desc,e.event_resource,e.danger_level,e.red_card,e.yellow_card,e.invalid,
|
e.major,e.deaths_number,e.injuries_number,e.difficult,e.urgent,e.urgent_dell,e.submit_date,e.create_by,e.create_at,e.update_by,e.update_at,e.event_deal_status,egd.grid_name
|
FROM
|
event e left join event_grid_data egd on e.grid_id = egd.id
|
<where>
|
e.event_status != 3 AND e.event_category = 1
|
<if test="pageEventManageDTO.communityId!=null">
|
AND egd.grid_community_id = ${pageEventManageDTO.communityId}
|
</if>
|
<if test='pageEventManageDTO.keyWord != null and pageEventManageDTO.keyWord != ""'>
|
AND (
|
e.grid_member_name like concat('%', #{pageEventManageDTO.keyWord},'%') OR
|
e.event_title like concat('%', #{pageEventManageDTO.keyWord},'%') OR
|
e.happen_address like concat('%', #{pageEventManageDTO.keyWord},'%') OR
|
e.order_sn like concat('%', #{pageEventManageDTO.keyWord},'%') OR
|
e.event_clazz like concat('%', #{pageEventManageDTO.keyWord},'%') OR
|
e.event_des like concat('%', #{pageEventManageDTO.keyWord},'%')
|
)
|
</if>
|
<if test="pageEventManageDTO.revokeType!=null">
|
AND ( e.revoke_type = #{pageEventManageDTO.revokeType} OR e.revoke_type is null )
|
</if>
|
<if test="pageEventManageDTO.eventDealStatus!=null">
|
AND e.event_deal_status = #{pageEventManageDTO.eventDealStatus}
|
</if>
|
<if test="pageEventManageDTO.communityProcess!=null">
|
AND e.community_process = #{pageEventManageDTO.communityProcess}
|
</if>
|
<if test="pageEventManageDTO.eventType!=null">
|
AND e.event_type = #{pageEventManageDTO.eventType}
|
</if>
|
<if test="pageEventManageDTO.dangerLevel!=null">
|
AND e.danger_level = #{pageEventManageDTO.dangerLevel}
|
</if>
|
<if test="pageEventManageDTO.redCard!=null">
|
AND e.red_card = #{pageEventManageDTO.redCard}
|
</if>
|
<if test="pageEventManageDTO.yellowCard!=null">
|
AND e.yellow_card = #{pageEventManageDTO.yellowCard}
|
</if>
|
<if test="pageEventManageDTO.eventClazz != null and pageEventManageDTO.eventClazz != """>
|
AND e.event_clazz like concat('%',#{pageEventDTO.eventClazz},'%')
|
</if>
|
<if test="pageEventManageDTO.urgent!=null">
|
AND e.urgent = #{pageEventManageDTO.urgent}
|
</if>
|
<if test="pageEventManageDTO.major!=null">
|
AND e.major = #{pageEventManageDTO.major}
|
</if>
|
<if test="pageEventManageDTO.invalid!=null">
|
AND e.invalid = #{pageEventManageDTO.invalid}
|
</if>
|
</where>
|
<if test="pageEventManageDTO.sortColumns!=null">
|
ORDER BY e.${pageEventManageDTO.sortColumns} ${pageEventManageDTO.sortType}
|
</if>
|
</select>
|
|
<select id="findCommunityPublicityByPage" resultType="com.panzhihua.common.model.vos.grid.EventVO"
|
parameterType="com.panzhihua.common.model.dtos.grid.PagePublicityEventCommunityDTO">
|
SELECT
|
e.id,e.order_sn,e.event_category,e.grid_member_street,e.happen_address,e.grid_member_community,e.event_clazz,e.grid_id,e.grid_member_id,e.grid_member_name,e.grid_member_telephone,
|
e.event_title,e.propaganda_type,e.propaganda_time,e.event_type,e.event_des,e.propaganda_object,e.propaganda_num,e.community_process,e.happen_time,e.happent_address,e.happent_lat_lng,
|
e.event_status,e.event_process_status,e.process_type,e.process_user_id,e.process_user_name,e.process_date,e.process_desc,e.event_resource,e.danger_level,e.red_card,e.yellow_card,e.invalid,
|
e.major,e.deaths_number,e.injuries_number,e.difficult,e.urgent,e.urgent_dell,e.submit_date,e.create_by,e.create_at,e.update_by,e.update_at,e.event_deal_status, egd.grid_name
|
FROM
|
event e left join event_grid_data egd on e.grid_id = egd.id
|
<where>
|
e.event_status != 3 AND e.event_category = 2
|
<if test='pagePublicityEventCommunityDTO.keyWord != null and pagePublicityEventCommunityDTO.keyWord != ""'>
|
AND (
|
e.grid_member_name like concat('%', #{pagePublicityEventCommunityDTO.keyWord},'%') OR
|
e.event_title like concat('%', #{pagePublicityEventCommunityDTO.keyWord},'%') OR
|
e.happen_address like concat('%', #{pagePublicityEventCommunityDTO.keyWord},'%') OR
|
e.order_sn like concat('%', #{pagePublicityEventCommunityDTO.keyWord},'%') OR
|
e.propaganda_type like concat('%', #{pagePublicityEventCommunityDTO.keyWord},'%') OR
|
egd.grid_name like concat('%', #{pagePublicityEventCommunityDTO.keyWord},'%')
|
)
|
</if>
|
<if test="pagePublicityEventCommunityDTO.revokeType!=null">
|
AND ( e.revoke_type = #{pagePublicityEventCommunityDTO.revokeType} OR e.revoke_type is null )
|
</if>
|
<if test="pagePublicityEventCommunityDTO.communityId!=null">
|
AND egd.grid_community_id = ${pagePublicityEventCommunityDTO.communityId}
|
</if>
|
<if test="pagePublicityEventCommunityDTO.eventDealStatus!=null">
|
AND e.event_deal_status = #{pagePublicityEventCommunityDTO.eventDealStatus}
|
</if>
|
</where>
|
<if test="pagePublicityEventCommunityDTO.sortColumns!=null">
|
ORDER BY e.${pagePublicityEventCommunityDTO.sortColumns} ${pagePublicityEventCommunityDTO.sortType}
|
</if>
|
</select>
|
<select id="eventStatistics" resultType="com.panzhihua.common.model.vos.grid.EventStatisticsAllAdminVO">
|
SELECT
|
count( e.id ) AS eventTotal,(
|
SELECT
|
count( e.id )
|
FROM
|
`event` AS e
|
LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
|
WHERE
|
e.event_status = 2
|
AND e.event_process_status = 2
|
) AS handleEventTotal,
|
(
|
SELECT
|
count( e.id )
|
FROM
|
`event` AS e
|
LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
|
WHERE
|
e.event_category = 2
|
AND e.event_status = 2
|
) AS propagandaEducationTotal,
|
( SELECT count( id ) FROM com_act_easy_photo WHERE handle_status = 2 ) AS easyPhotoTotal
|
FROM
|
`event` AS e
|
LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
|
WHERE
|
e.event_status = 2
|
</select>
|
|
<select id="getEventCountByGridIds" resultType="Integer">
|
select count(id) from event where grid_id in
|
<foreach item="item" collection="ids" separator="," open="(" close=")" index="">
|
#{item}
|
</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 process_date 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 process_date 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
|
<if test="gridId!=null">
|
AND grid_id = #{gridId}
|
</if>) AS educationNum,
|
(
|
SELECT
|
count( cmph.id )
|
FROM
|
com_mng_population_house AS cmph
|
LEFT JOIN event_grid_data AS egd ON egd.grid_community_id = cmph.community_id
|
WHERE
|
<if test="gridId!=null">
|
egd.id = #{gridId}
|
</if>
|
) AS houseTotal,
|
(
|
SELECT
|
count( id )
|
FROM
|
event_visiting_tasks
|
WHERE
|
event_status = 2 AND submit_date BETWEEN DATE_FORMAT( CURDATE(), '%Y-%m-%d %H:%i:%s' )
|
AND DATE_SUB( DATE_ADD(CURDATE(), INTERVAL 1 DAY),INTERVAL 1 SECOND)
|
<if test="gridId!=null">
|
AND grid_id = #{gridId}
|
</if>
|
) as zfTodayNum,
|
(
|
SELECT
|
count( id )
|
FROM
|
event_visiting_tasks
|
WHERE
|
event_status = 2 AND submit_date 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 zfMonthNum,(
|
SELECT
|
count( caep.id )
|
FROM
|
com_act_easy_photo as caep
|
left join event_grid_data as egd on egd.grid_community_id = caep.community_id
|
WHERE
|
handle_status = 2
|
AND feedback_at BETWEEN DATE_FORMAT( CURDATE(), '%Y-%m-%d %H:%i:%s' )
|
AND DATE_SUB(DATE_ADD( CURDATE(), INTERVAL 1 DAY ),INTERVAL 1 SECOND)
|
<if test="gridId!=null">
|
AND egd.id = #{gridId}
|
</if>
|
) as sspTodayNum,
|
(
|
SELECT
|
count( caep.id )
|
FROM
|
com_act_easy_photo as caep
|
left join event_grid_data as egd on egd.grid_community_id = caep.community_id
|
WHERE
|
handle_status = 2
|
AND feedback_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 egd.id = #{gridId}
|
</if>
|
) as sspMonthNum
|
FROM
|
`event`
|
WHERE
|
event_category = 1
|
AND event_process_status = 2
|
AND process_date 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.startTime}
|
</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.startTime}
|
</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.startTime}
|
</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.startTime}
|
</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.startTime}
|
</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.startTime}
|
</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.startTime}
|
</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.startTime}
|
</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.startTime}
|
</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.startTime}
|
</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.startTime}
|
</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.startTime}
|
</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 submit_date <![CDATA[ >= ]]> #{statisticsDTO.startTime}
|
</if>
|
<if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'>
|
AND submit_date <![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.startTime}
|
</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.startTime}
|
</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.startTime}
|
</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 e.grid_id = #{statisticsDTO.gridId}
|
</if>
|
<if test='statisticsDTO.startTime != null and statisticsDTO.startTime != ""'>
|
AND e.create_at <![CDATA[ >= ]]> #{statisticsDTO.startTime}
|
</if>
|
<if test='statisticsDTO.endTime != null and statisticsDTO.endTime != ""'>
|
AND e.create_at <![CDATA[ <= ]]> #{statisticsDTO.endTime}
|
</if>
|
</select>
|
|
<select id="getUserBaseInfo" parameterType="java.lang.Long" resultType="java.util.Map">
|
select nick_name,image_url from sys_user where user_id = #{gridMemberId}
|
</select>
|
|
<select id="getScreenEventList" parameterType="com.panzhihua.common.model.dtos.community.bigscreen.event.ScreenEventListDTO"
|
resultType="com.panzhihua.common.model.vos.community.screen.event.EventListVO">
|
SELECT
|
e.id,
|
e.grid_member_id,
|
su.image_url,
|
su.nick_name AS userName,
|
e.happen_time as createAt,
|
e.urgent,
|
e.danger_level,
|
e.major,
|
e.process_desc,
|
e.event_des,
|
e.event_category,
|
e.event_type,
|
e.event_clazz,
|
e.happen_address,
|
e.happent_lat_lng,
|
e.happent_address,
|
e.event_deal_status,
|
egd.grid_name
|
FROM
|
`event` AS e
|
LEFT JOIN sys_user AS su ON su.user_id = e.grid_member_id
|
LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
|
<where>
|
event_status = 2
|
<if test='eventListDTO.communityId != null'>
|
and egd.grid_community_id = ${eventListDTO.communityId}
|
</if>
|
|
<if test='eventListDTO.startTime != null and eventListDTO.startTime != ""'>
|
and e.create_at <![CDATA[>=]]> #{eventListDTO.startTime}
|
</if>
|
|
<if test='eventListDTO.endTime != null and eventListDTO.endTime != ""'>
|
and e.create_at <![CDATA[<=]]> #{eventListDTO.endTime}
|
</if>
|
|
<if test='eventListDTO.gridIds != null and eventListDTO.gridIds.size > 0'>
|
and e.grid_id in
|
<foreach collection='eventListDTO.gridIds' item='id' index='index' open='(' close=')' separator=',' >
|
#{id}
|
</foreach>
|
</if>
|
|
<if test='eventListDTO.eventCategory != null'>
|
and e.event_category = #{eventListDTO.eventCategory}
|
</if>
|
|
<if test='eventListDTO.eventTypes != null and eventListDTO.eventTypes.size > 0'>
|
and e.event_type in
|
<foreach collection='eventListDTO.eventTypes' item='id' index='index' open='(' close=')' separator=',' >
|
#{id}
|
</foreach>
|
</if>
|
|
<if test='eventListDTO.eventDealStatus != null'>
|
and e.event_deal_status = #{eventListDTO.eventDealStatus}
|
</if>
|
|
<if test='eventListDTO.urgent != null and eventListDTO.urgent != ""'>
|
and e.urgent = #{eventListDTO.urgent}
|
</if>
|
|
<if test='eventListDTO.major != null and eventListDTO.major != ""'>
|
and e.major = #{eventListDTO.major}
|
</if>
|
</where>
|
order by e.create_at desc
|
</select>
|
|
<select id="specialPopulationList" resultType="com.panzhihua.common.model.vos.grid.EventSpecialPopulationVO"
|
parameterType="com.panzhihua.common.model.dtos.grid.PageEventSpecialPopulationDTO">
|
SELECT
|
cmp.id,
|
cmp.`name`,
|
cmp.card_no as idCard,
|
cmpct.label,
|
cmp.sex,
|
cmp.phone,
|
cmp.address,
|
cmp.political_outlook
|
FROM
|
com_mng_population AS cmp
|
left join com_mng_population_community_tags AS cmpct on cmp.id = cmpct.population_id
|
<where>
|
and cmpct.label IS NOT NULL
|
<if test='specialPopulationDTO.communityId != null'>
|
and cmpct.community_id = ${specialPopulationDTO.communityId}
|
</if>
|
<if test="specialPopulationDTO.keyWord!=null and specialPopulationDTO.keyWord!= """>
|
AND (cmp.name like concat(#{specialPopulationDTO.keyWord},'%') or cmp.card_no_str like concat(#{specialPopulationDTO.keyWord},'%'))
|
</if>
|
</where>
|
ORDER BY
|
cmp.create_at DESC
|
</select>
|
|
<select id="countByCommunityId" resultType="Map">
|
SELECT
|
count( e.id ) AS resolvedNum,
|
(
|
SELECT
|
count( e1.id )
|
FROM
|
`event` AS e1
|
LEFT JOIN event_grid_data AS egd1 ON egd1.id = e1.grid_id
|
WHERE
|
egd1.grid_community_id = ${communityId}
|
AND e1.event_category = 1
|
AND e1.event_process_status = 1
|
AND e1.event_status = 2
|
AND e1.event_deal_status = 1
|
) AS pendingNum,
|
(
|
SELECT
|
count( e2.id )
|
FROM
|
`event` AS e2
|
LEFT JOIN event_grid_data AS egd2 ON egd2.id = e2.grid_id
|
WHERE
|
egd2.grid_community_id = ${communityId}
|
AND e2.event_category = 2
|
AND e2.event_status = 2
|
) AS propagandaNum,
|
(
|
SELECT
|
count( e3.id )
|
FROM
|
`event` AS e3
|
LEFT JOIN event_grid_data AS egd3 ON egd3.id = e3.grid_id
|
WHERE
|
e3.event_status = 2
|
AND e3.create_at LIKE CONCAT(#{nowDate},'%')) as currentNum,
|
(select count(id) from com_act_easy_photo where community_id = ${communityId} and del_tag = 0 and create_at LIKE CONCAT(#{nowDate},'%')) as sspCurrentNum
|
|
FROM
|
`event` AS e
|
LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
|
WHERE
|
egd.grid_community_id = ${communityId}
|
AND e.event_category = 1
|
AND e.event_process_status = 2
|
AND e.event_deal_status = 4
|
</select>
|
|
<select id="countByAvgCommunityId" resultType="com.panzhihua.common.model.vos.screen.DateScreenVO">
|
SELECT
|
e.create_at AS startTime,(
|
SELECT
|
e1.create_at
|
FROM
|
`event` AS e1
|
LEFT JOIN event_grid_data AS egd1 ON egd1.id = e1.grid_id
|
WHERE
|
egd1.grid_community_id = ${communityId}
|
AND e1.event_process_status = 2
|
ORDER BY
|
e1.create_at DESC
|
LIMIT 1
|
) AS endTime
|
FROM
|
`event` AS e
|
LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
|
WHERE
|
egd.grid_community_id = ${communityId}
|
AND e.event_process_status = 2
|
ORDER BY
|
e.create_at ASC
|
LIMIT 1
|
</select>
|
|
<select id="getWorkScreenEventList" resultType="com.panzhihua.common.model.vos.screen.EventDetailWorkVO">
|
SELECT
|
e.id,
|
su.nick_name AS userName,
|
su.image_url,
|
e.create_at,
|
e.event_type,
|
e.event_process_status,
|
e.event_deal_status,
|
e.major,
|
e.red_card,
|
e.yellow_card,
|
e.urgent,
|
e.danger_level,
|
e.event_des,
|
e.happen_address,
|
e.happent_address,
|
e.happent_lat_lng
|
FROM
|
`event` AS e
|
LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
|
LEFT JOIN sys_user AS su ON su.user_id = e.grid_member_id
|
WHERE
|
egd.grid_community_id = ${communityId}
|
AND e.event_status = 2
|
AND e.event_deal_status in (1,2,3,4,6,8)
|
ORDER BY
|
e.create_at DESC
|
LIMIT 10
|
</select>
|
|
<select id="countByTime" resultType="com.panzhihua.common.model.vos.screen.EventWorkVO">
|
SELECT
|
(
|
SELECT
|
COUNT( e.id )
|
FROM
|
`event` AS e
|
LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
|
WHERE
|
egd.grid_community_id = ${communityId} and e.event_status = 2 AND e.create_at <![CDATA[<=]]> #{end}) AS eventTotal,
|
(select count(id) from com_act_easy_photo where community_id = ${communityId} and del_tag = 0 and create_at <![CDATA[<=]]> #{end}) as sspTotal,
|
(select count(id) from com_act_easy_photo where community_id = ${communityId} and del_tag = 0 and #{start} <![CDATA[<=]]> create_at AND create_at <![CDATA[<=]]> #{end}) as sspAdd,
|
(select count(id) from com_act_easy_photo where community_id = ${communityId} and handle_status = 2 and del_tag = 0 and #{start} <![CDATA[<=]]> create_at AND create_at <![CDATA[<=]]> #{end}) as sspSolve,
|
(
|
SELECT
|
COUNT( e1.id )
|
FROM
|
`event` AS e1
|
LEFT JOIN event_grid_data AS egd1 ON egd1.id = e1.grid_id
|
WHERE
|
egd1.grid_community_id = ${communityId} and e1.event_status = 2 AND #{start} <![CDATA[<=]]> e1.create_at AND e1.create_at <![CDATA[<=]]> #{end}) AS eventAdd,
|
(
|
SELECT
|
COUNT( e2.id )
|
FROM
|
`event` AS e2
|
LEFT JOIN event_grid_data AS egd2 ON egd2.id = e2.grid_id
|
WHERE
|
egd2.grid_community_id = ${communityId} and e2.event_process_status = 2 AND #{start} <![CDATA[<=]]> e2.create_at AND e2.create_at <![CDATA[<=]]> #{end}) AS eventSolve
|
FROM
|
DUAL
|
</select>
|
|
<select id="getComplete" resultType="com.panzhihua.common.model.vos.screen.EventTypeWorkVO">
|
SELECT
|
count( e.id ) AS zaTotal,(
|
SELECT
|
count( e1.id )
|
FROM
|
`event` AS e1
|
LEFT JOIN event_grid_data AS egd1 ON egd1.id = e1.grid_id
|
WHERE
|
e1.event_category = 1
|
AND e1.event_process_status = 2
|
AND e1.event_type = 2
|
AND egd1.grid_community_id = ${communityId}
|
) AS ggTotal,(
|
SELECT
|
count( e2.id )
|
FROM
|
`event` AS e2
|
LEFT JOIN event_grid_data AS egd2 ON egd2.id = e2.grid_id
|
WHERE
|
e2.event_category = 1
|
AND e2.event_process_status = 2
|
AND e2.event_type = 3
|
AND egd2.grid_community_id = ${communityId}
|
) AS mdTotal,(
|
SELECT
|
count( e3.id )
|
FROM
|
`event` AS e3
|
LEFT JOIN event_grid_data AS egd3 ON egd3.id = e3.grid_id
|
WHERE
|
e3.event_category = 1
|
AND e3.event_process_status = 2
|
AND e3.event_type = 4
|
AND egd3.grid_community_id = ${communityId}
|
) AS bwdTotal,(
|
SELECT
|
count( e4.id )
|
FROM
|
`event` AS e4
|
LEFT JOIN event_grid_data AS egd4 ON egd4.id = e4.grid_id
|
WHERE
|
e4.event_category = 1
|
AND e4.event_process_status = 2
|
AND e4.event_type = 5
|
AND egd4.grid_community_id = ${communityId}
|
) AS tfTotal,(
|
SELECT
|
count( e5.id )
|
FROM
|
`event` AS e5
|
LEFT JOIN event_grid_data AS egd5 ON egd5.id = e5.grid_id
|
WHERE
|
e5.event_category = 1
|
AND e5.event_process_status = 2
|
AND e5.event_type = 6
|
AND egd5.grid_community_id = ${communityId}
|
) AS tsTotal,
|
(select count(id) from com_act_easy_photo as caep where community_id = ${communityId} and del_tag = 0 and status = 4) as sspTotal
|
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_process_status = 2
|
AND e.event_type = 1
|
AND egd.grid_community_id = ${communityId}
|
</select>
|
|
<select id="getNoComplete" resultType="com.panzhihua.common.model.vos.screen.EventTypeWorkVO">
|
SELECT
|
count( e.id ) AS zaTotal,(
|
SELECT
|
count( e1.id )
|
FROM
|
`event` AS e1
|
LEFT JOIN event_grid_data AS egd1 ON egd1.id = e1.grid_id
|
WHERE
|
e1.event_category = 1
|
AND e1.event_process_status = 1
|
AND e1.event_status = 2
|
AND e1.event_type = 2
|
AND egd1.grid_community_id = ${communityId}
|
) AS ggTotal,(
|
SELECT
|
count( e2.id )
|
FROM
|
`event` AS e2
|
LEFT JOIN event_grid_data AS egd2 ON egd2.id = e2.grid_id
|
WHERE
|
e2.event_category = 1
|
AND e2.event_process_status = 1
|
AND e2.event_status = 2
|
AND e2.event_type = 3
|
AND egd2.grid_community_id = ${communityId}
|
) AS mdTotal,(
|
SELECT
|
count( e3.id )
|
FROM
|
`event` AS e3
|
LEFT JOIN event_grid_data AS egd3 ON egd3.id = e3.grid_id
|
WHERE
|
e3.event_category = 1
|
AND e3.event_process_status = 1
|
AND e3.event_status = 2
|
AND e3.event_type = 4
|
AND egd3.grid_community_id = ${communityId}
|
) AS bwdTotal,(
|
SELECT
|
count( e4.id )
|
FROM
|
`event` AS e4
|
LEFT JOIN event_grid_data AS egd4 ON egd4.id = e4.grid_id
|
WHERE
|
e4.event_category = 1
|
AND e4.event_process_status = 1
|
AND e4.event_status = 2
|
AND e4.event_type = 5
|
AND egd4.grid_community_id = ${communityId}
|
) AS tfTotal,(
|
SELECT
|
count( e5.id )
|
FROM
|
`event` AS e5
|
LEFT JOIN event_grid_data AS egd5 ON egd5.id = e5.grid_id
|
WHERE
|
e5.event_category = 1
|
AND e5.event_process_status = 1
|
AND e5.event_status = 2
|
AND e5.event_type = 6
|
AND egd5.grid_community_id = ${communityId}
|
) AS tsTotal,
|
(select count(id) from com_act_easy_photo as caep where community_id = ${communityId} and del_tag = 0 and status in (1,2)) as sspTotal
|
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_process_status = 1
|
AND e.event_status = 2
|
AND e.event_type = 1
|
AND egd.grid_community_id = ${communityId}
|
</select>
|
|
<select id="getSSPEventTotal" resultType="Map">
|
SELECT
|
count( id ) as noEventSSPTotal,
|
( SELECT count( id ) FROM com_act_easy_photo WHERE handle_status = 2 and del_tag = 0 AND community_id = ${communityId} ) AS eventSSPTotal
|
FROM
|
com_act_easy_photo
|
WHERE
|
handle_status = 1 and del_tag = 0
|
AND community_id = ${communityId}
|
</select>
|
|
<select id="getEventListByCommunityId" parameterType="Long"
|
resultType="com.panzhihua.common.model.vos.community.screen.event.EventGridIncidentStatisticsVO">
|
SELECT
|
e.id,
|
e.event_type AS type,
|
e.happent_lat_lng AS latLng,
|
e.event_deal_status as status
|
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_status = 2
|
AND egd.grid_community_id = ${communityId}
|
AND e.event_deal_status IN (1,2,3,4)
|
union all
|
select id,7 as type,lng_lat as latLng,handle_status as status from com_act_easy_photo as caep where community_id = ${communityId} and lng_lat is not null
|
</select>
|
|
<select id="getCivilScreenVillageList" parameterType="Long" resultType="com.panzhihua.common.model.vos.community.screen.civil.CivilVillageStatisticsVO">
|
SELECT `NAME`, user_sum, lng, lat, village_images, village_id FROM com_mng_village AS cmv WHERE community_id = ${communityId}
|
</select>
|
|
<select id="getVillagePopulationTotal" parameterType="Long" resultType="com.panzhihua.common.model.vos.screen.ScreenDrawEventPopulationTotalVO">
|
SELECT
|
count( id ) as populationTotal,
|
(select count(id) from com_mng_population where village_id = #{villageId} and out_or_local = 1) as localTotal,
|
(select count(id) from com_mng_population where village_id = #{villageId} and out_or_local = 2) as outTotal,
|
(select count(cmp.id) from com_mng_population_community_tags as cmpct left join com_mng_population as cmp on cmpct.population_id = cmp.id where cmp.village_id = #{villageId} and cmpct.label is not null) as specialTotal,
|
(select count(id) from com_mng_building where village_id = #{villageId}) as buildTotal
|
FROM
|
com_mng_population AS cmp
|
WHERE
|
village_id = #{villageId}
|
</select>
|
|
<select id="getMemberBuildName" resultType="Map">
|
SELECT
|
cmb.`name`,egmbr.village_id
|
FROM
|
event_grid_member_building_relation AS egmbr
|
LEFT JOIN com_mng_building AS cmb ON cmb.id = egmbr.building_id
|
WHERE
|
egmbr.grid_member_id = #{userId}
|
</select>
|
|
<select id="getPopulationByLabelCount" resultType="Integer">
|
select count(cmpct.id) from com_mng_population_community_tags AS cmpct
|
left join com_mng_population AS cmp on cmp.id = cmpct.population_id
|
where cmtct.label is not null and cmp.village_id = #{villageId} and floor = #{floor}
|
</select>
|
<select id="selectComprehensiveGovernanceStatics"
|
resultType="com.panzhihua.common.model.vos.community.screen.event.EventComprehensiveGovernanceStatisticsVO">
|
SELECT
|
(SELECT COUNT( e.id ) FROM `event` AS e
|
LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
|
LEFT JOIN com_act AS a ON egd.grid_community_id = a.community_id
|
WHERE e.event_category = 1 AND e.event_type = 5 AND e.event_deal_status = 4 AND a.area_code = 510423) AS eventTFTotal,
|
|
(SELECT COUNT( e1.id ) FROM `event` AS e1
|
LEFT JOIN event_grid_data AS egd1 ON egd1.id = e1.grid_id
|
LEFT JOIN com_act AS a1 ON egd1.grid_community_id = a1.community_id
|
WHERE event_category = 1 AND event_type = 1 AND e1.event_deal_status = 4 AND a1.area_code = 510423) AS eventZATotal,
|
|
(SELECT COUNT( e2.id ) FROM `event` AS e2
|
LEFT JOIN event_grid_data AS egd2 ON egd2.id = e2.grid_id
|
LEFT JOIN com_act AS a2 ON egd2.grid_community_id = a2.community_id
|
WHERE event_category = 1 AND event_type = 3 AND e2.event_deal_status = 4 AND a2.area_code = 510423) AS eventMDTotal,
|
|
(SELECT COUNT( e3.id ) FROM `event` AS e3
|
LEFT JOIN event_grid_data AS egd3 ON egd3.id = e3.grid_id
|
LEFT JOIN com_act AS a3 ON egd3.grid_community_id = a3.community_id
|
WHERE event_category = 1 AND event_type = 6 AND e3.event_deal_status = 4 AND a3.area_code = 510423) AS eventTSTotal,
|
|
(SELECT COUNT( e5.id ) FROM `event` AS e5
|
LEFT JOIN event_grid_data AS egd5 ON egd5.id = e5.grid_id
|
LEFT JOIN com_act AS a5 ON egd5.grid_community_id = a5.community_id
|
WHERE event_category = 1 AND event_type = 2 AND e5.event_deal_status = 4 AND a5.area_code = 510423) AS eventMSTotal,
|
|
(SELECT COUNT(p.id) FROM com_act_easy_photo p
|
LEFT JOIN com_act AS a ON p.community_id = a.community_id
|
WHERE p.`status` = 4 AND p.del_tag = 0 AND a.area_code = 510423) AS eventSSPTotal
|
</select>
|
<select id="getGridsGovernanceEventList"
|
resultType="com.panzhihua.common.model.vos.community.screen.event.EventGridIncidentStatisticsVO">
|
SELECT event_type AS type, IFNULL( NULL, 1 ) AS eventType, e.id AS eventId, happent_lat_lng AS latLng, event_des AS content,
|
(SELECT url FROM event_resource WHERE ref_id = e.id AND classification = 1 AND `type` = 1 LIMIT 1) AS cover, e.create_at,
|
CASE
|
WHEN event_deal_status = 4 THEN 1
|
ELSE 2 END `status`
|
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 IN ( 1, 2, 3, 5, 6 ) AND e.event_status = 2 AND egd.grid_community_id = ${communityId}
|
UNION ALL SELECT
|
CASE
|
WHEN classify_id = 4 THEN 1
|
WHEN classify_id = 6 THEN 2
|
WHEN classify_id = 5 THEN 3
|
WHEN classify_id = 7 THEN 5
|
WHEN classify_id = 3 THEN 6
|
WHEN classify_id = 8 THEN 9
|
WHEN classify_id = 1 THEN 10
|
END type, IFNULL( NULL, 2 ) AS eventType, id AS eventId, lng_lat AS latLng, detail AS content, substring_index(photo_path_list, ',', 1) AS cover, create_at,
|
CASE
|
WHEN `status` = 4 THEN 1
|
ELSE 2 END `status`
|
FROM com_act_easy_photo WHERE community_id = ${communityId} AND `status` IN (1,2,4) AND del_tag = 0 AND classify_id IN (1,3,4,5,6,7,8)
|
</select>
|
<select id="getVillagePopulationTotalNew"
|
resultType="com.panzhihua.common.model.vos.screen.ScreenDrawEventPopulationTotalVO">
|
SELECT
|
(SELECT count(id) FROM com_mng_population WHERE village_id = #{villageId}) as populationTotal,
|
(SELECT count(id) from com_mng_building where village_id = #{villageId}) as buildTotal,
|
(SELECT count(id) FROM com_mng_population_house WHERE village_id = #{villageId}) as houseTotal,
|
(select count(id) from com_mng_population where village_id = #{villageId} and out_or_local = 1) as localTotal,
|
(select count(id) from com_mng_population where village_id = #{villageId} and out_or_local = 2) as outTotal,
|
(SELECT COUNT(t1.id) FROM com_disability_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId}) as disabilityTotal,
|
(SELECT COUNT(t1.id) FROM com_low_security_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId}) as lowSecurityTotal,
|
(SELECT COUNT(id) FROM com_mng_population WHERE village_id = #{villageId} AND TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) > 80) as elderTotal,
|
(SELECT COUNT(t1.id) FROM com_mng_population t1 LEFT JOIN com_mng_population_community_tags t2 ON t1.id = t2.population_id WHERE t1.village_id = #{villageId} AND t2.label LIKE '%特殊情况%') as specialSituationTotal,
|
(SELECT COUNT(id) FROM
|
(SELECT t1.id FROM com_drug_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId}
|
UNION ALL
|
SELECT t1.id FROM com_correct_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId}
|
UNION ALL
|
SELECT t1.id FROM com_cult_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId}
|
UNION ALL
|
SELECT t1.id FROM com_rehabilitation_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId}
|
UNION ALL
|
SELECT t1.id FROM com_key_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId}
|
UNION ALL
|
SELECT t1.id FROM com_major_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId}
|
) temp) as otherTotal,
|
(SELECT COUNT(t1.id) FROM com_mng_population t1 LEFT JOIN com_mng_population_community_tags t2 ON t1.id = t2.population_id WHERE t1.village_id = #{villageId} AND t2.label LIKE '%特扶家庭%') as specialHelpTotal,
|
(SELECT COUNT(t1.id) FROM com_veterans_population t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId}) as veteransTotal,
|
(SELECT COUNT(id) FROM com_mng_population WHERE village_id = #{villageId} AND TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) > 60) as oldTotal,
|
(SELECT COUNT(t1.id) FROM com_pension_auth_pensioners t1 LEFT JOIN com_mng_population t2 ON t1.population_id = t2.id WHERE t2.village_id = #{villageId}) as pensionTotal,
|
(SELECT COUNT(id) FROM renting_hourse_register WHERE village_id = #{villageId} AND auth_status = 2) as rentingHouseTotal,
|
(SELECT COUNT(id) FROM com_mng_population t1 LEFT JOIN sys_user t2 ON t1.card_no_str = t2.id_card WHERE t1.village_id = #{villageId} AND t2.is_volunteer = 1) as volunteerTotal,
|
(SELECT ROUND(AVG(TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()))) FROM com_mng_population) as averageAge
|
</select>
|
<select id="selectStatisticsForAge" resultType="com.panzhihua.common.model.vos.community.StatisticsCommVO">
|
SELECT filed, SUM(num) AS num FROM (
|
SELECT filed, COUNT(filed) AS num FROM (
|
SELECT
|
CASE
|
WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) BETWEEN 0 AND 18 THEN '0-18岁'
|
WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) BETWEEN 19 AND 30 THEN '19-30岁'
|
WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) BETWEEN 31 AND 40 THEN '31-40岁'
|
WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) BETWEEN 41 AND 50 THEN '41-50岁'
|
WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) BETWEEN 51 AND 60 THEN '51-60岁'
|
WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) BETWEEN 61 AND 79 THEN '61-79岁'
|
WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) BETWEEN 80 AND 89 THEN '80-89岁'
|
WHEN TIMESTAMPDIFF(YEAR, SUBSTRING(card_no_str, 7, 8), NOW()) > 89 THEN '89岁以上'
|
END filed
|
FROM com_mng_population WHERE village_id IN
|
<foreach collection="villageIds" index="index" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
) temp WHERE filed is not null GROUP BY filed
|
UNION ALL
|
(SELECT '0-18岁' AS filed, 0 AS num)
|
UNION ALL
|
(SELECT '19-30岁' AS filed, 0 AS num)
|
UNION ALL
|
(SELECT '31-40岁' AS filed, 0 AS num)
|
UNION ALL
|
(SELECT '41-50岁' AS filed, 0 AS num)
|
UNION ALL
|
(SELECT '51-60岁' AS filed, 0 AS num)
|
UNION ALL
|
(SELECT '61-79岁' AS filed, 0 AS num)
|
UNION ALL
|
(SELECT '80-89岁' AS filed, 0 AS num)
|
UNION ALL
|
(SELECT '89岁以上' AS filed, 0 AS num)
|
) t GROUP BY filed
|
</select>
|
<select id="getById" resultType="com.panzhihua.common.model.vos.grid.EventDetailsVO">
|
SELECT t1.*,
|
CASE
|
t1.revoke_type
|
WHEN 1 THEN
|
t2.`name`
|
WHEN 2 THEN
|
t3.`name`
|
ELSE
|
NULL
|
END AS `revoke`
|
FROM event t1
|
LEFT JOIN sys_user t2 ON t1.revoke_id = t2.user_id
|
LEFT JOIN com_act t3 ON t1.revoke_id = t3.community_id
|
WHERE t1.id = #{id}
|
</select>
|
|
</mapper>
|