101captain
2022-03-07 da8cca4d320908b672f439369e65e9e6a95374e3
springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/resources/mapper/EventMapper.xml
@@ -243,7 +243,7 @@
      <where>
         e.event_status != 3 AND e.event_category = 2
         <if test="pagePublicityEventDTO.communityId!=null">
            AND egd.grid_community_id = #{pagePublicityEventDTO.communityId}
            AND egd.grid_community_id = ${pagePublicityEventDTO.communityId}
         </if>
         <if test="pagePublicityEventDTO.revokeType!=null">
@@ -448,7 +448,7 @@
      <where>
         e.event_status != 3 AND e.event_category = 1
         <if test="pageEventManageDTO.communityId!=null">
            AND egd.grid_community_id = #{pageEventManageDTO.communityId}
            AND egd.grid_community_id = ${pageEventManageDTO.communityId}
         </if>
         <if test='pageEventManageDTO.keyWord != null and pageEventManageDTO.keyWord != &quot;&quot;'>
            AND (
@@ -524,7 +524,7 @@
            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}
            AND egd.grid_community_id = ${pagePublicityEventCommunityDTO.communityId}
         </if>
         <if test="pagePublicityEventCommunityDTO.eventDealStatus!=null">
            AND e.event_deal_status = #{pagePublicityEventCommunityDTO.eventDealStatus}
@@ -946,6 +946,7 @@
         e.urgent,
         e.danger_level,
         e.major,
         e.process_desc,
         e.event_des,
         e.event_category,
         e.event_type,
@@ -962,7 +963,7 @@
         <where>
            and event_status = 2
            <if test='eventListDTO.communityId != null'>
               and egd.grid_community_id = #{eventListDTO.communityId}
               and egd.grid_community_id = ${eventListDTO.communityId}
            </if>
            <if test='eventListDTO.startTime != null and eventListDTO.startTime != &quot;&quot;'>
@@ -1023,7 +1024,7 @@
         <where>
            and cmpct.label IS NOT NULL
            <if test='specialPopulationDTO.communityId != null'>
               and cmpct.community_id = #{specialPopulationDTO.communityId}
               and cmpct.community_id = ${specialPopulationDTO.communityId}
            </if>
            <if test="specialPopulationDTO.keyWord!=null and specialPopulationDTO.keyWord!= &quot;&quot;">
               AND (cmp.name like concat(#{specialPopulationDTO.keyWord},'%') or cmp.card_no_str like concat(#{specialPopulationDTO.keyWord},'%'))
@@ -1043,7 +1044,7 @@
            `event` AS e1
            LEFT JOIN event_grid_data AS egd1 ON egd1.id = e1.grid_id
         WHERE
            egd1.grid_community_id = #{communityId}
            egd1.grid_community_id = ${communityId}
            AND e1.event_category = 1
            AND e1.event_process_status = 1
            AND e1.event_status = 2
@@ -1056,7 +1057,7 @@
            `event` AS e2
            LEFT JOIN event_grid_data AS egd2 ON egd2.id = e2.grid_id
         WHERE
            egd2.grid_community_id = #{communityId}
            egd2.grid_community_id = ${communityId}
            AND e2.event_category = 2
            AND e2.event_status = 2
         ) AS propagandaNum,
@@ -1069,13 +1070,13 @@
         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
            (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}
               egd.grid_community_id = ${communityId}
               AND e.event_category = 1
            AND e.event_process_status = 2
         AND e.event_deal_status = 4
@@ -1090,7 +1091,7 @@
            `event` AS e1
            LEFT JOIN event_grid_data AS egd1 ON egd1.id = e1.grid_id
         WHERE
            egd1.grid_community_id = #{communityId}
            egd1.grid_community_id = ${communityId}
            AND e1.event_process_status = 2
         ORDER BY
            e1.create_at DESC
@@ -1100,7 +1101,7 @@
         `event` AS e
         LEFT JOIN event_grid_data AS egd ON egd.id = e.grid_id
      WHERE
         egd.grid_community_id = #{communityId}
         egd.grid_community_id = ${communityId}
         AND e.event_process_status = 2
      ORDER BY
         e.create_at ASC
@@ -1130,7 +1131,7 @@
         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}
         egd.grid_community_id = ${communityId}
         AND e.event_status = 2
         AND e.event_deal_status in (1,2,3,4,6,8)
      ORDER BY
@@ -1147,10 +1148,10 @@
      `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,
      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 )
@@ -1158,7 +1159,7 @@
      `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,
      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 )
@@ -1166,7 +1167,7 @@
      `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
      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>
@@ -1183,7 +1184,7 @@
            e1.event_category = 1
            AND e1.event_process_status = 2
            AND e1.event_type = 2
            AND egd1.grid_community_id = #{communityId}
            AND egd1.grid_community_id = ${communityId}
            ) AS ggTotal,(
         SELECT
            count( e2.id )
@@ -1194,7 +1195,7 @@
            e2.event_category = 1
            AND e2.event_process_status = 2
            AND e2.event_type = 3
            AND egd2.grid_community_id = #{communityId}
            AND egd2.grid_community_id = ${communityId}
            ) AS mdTotal,(
         SELECT
            count( e3.id )
@@ -1205,7 +1206,7 @@
            e3.event_category = 1
            AND e3.event_process_status = 2
            AND e3.event_type = 4
            AND egd3.grid_community_id = #{communityId}
            AND egd3.grid_community_id = ${communityId}
            ) AS bwdTotal,(
         SELECT
            count( e4.id )
@@ -1216,7 +1217,7 @@
            e4.event_category = 1
            AND e4.event_process_status = 2
            AND e4.event_type = 5
            AND egd4.grid_community_id = #{communityId}
            AND egd4.grid_community_id = ${communityId}
            ) AS tfTotal,(
         SELECT
            count( e5.id )
@@ -1227,9 +1228,9 @@
            e5.event_category = 1
            AND e5.event_process_status = 2
            AND e5.event_type = 6
            AND egd5.grid_community_id = #{communityId}
            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
         (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
@@ -1237,7 +1238,7 @@
         e.event_category = 1
         AND e.event_process_status = 2
         AND e.event_type = 1
         AND egd.grid_community_id = #{communityId}
         AND egd.grid_community_id = ${communityId}
   </select>
   <select id="getNoComplete" resultType="com.panzhihua.common.model.vos.screen.EventTypeWorkVO">
@@ -1253,7 +1254,7 @@
            AND e1.event_process_status = 1
            AND e1.event_status = 2
            AND e1.event_type = 2
            AND egd1.grid_community_id = #{communityId}
            AND egd1.grid_community_id = ${communityId}
            ) AS ggTotal,(
         SELECT
            count( e2.id )
@@ -1265,7 +1266,7 @@
            AND e2.event_process_status = 1
            AND e2.event_status = 2
            AND e2.event_type = 3
            AND egd2.grid_community_id = #{communityId}
            AND egd2.grid_community_id = ${communityId}
            ) AS mdTotal,(
         SELECT
            count( e3.id )
@@ -1277,7 +1278,7 @@
            AND e3.event_process_status = 1
            AND e3.event_status = 2
            AND e3.event_type = 4
            AND egd3.grid_community_id = #{communityId}
            AND egd3.grid_community_id = ${communityId}
            ) AS bwdTotal,(
         SELECT
            count( e4.id )
@@ -1289,7 +1290,7 @@
            AND e4.event_process_status = 1
            AND e4.event_status = 2
            AND e4.event_type = 5
            AND egd4.grid_community_id = #{communityId}
            AND egd4.grid_community_id = ${communityId}
            ) AS tfTotal,(
         SELECT
            count( e5.id )
@@ -1301,9 +1302,9 @@
            AND e5.event_process_status = 1
            AND e5.event_status = 2
            AND e5.event_type = 6
            AND egd5.grid_community_id = #{communityId}
            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
         (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
@@ -1312,18 +1313,18 @@
         AND e.event_process_status = 1
         AND e.event_status = 2
         AND e.event_type = 1
         AND egd.grid_community_id = #{communityId}
         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
         ( 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}
         AND community_id = ${communityId}
   </select>
   <select id="getEventListByCommunityId" parameterType="Long"
@@ -1339,14 +1340,14 @@
      WHERE
         e.event_category = 1
         AND e.event_status = 2
         AND egd.grid_community_id = #{communityId}
         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 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 `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">
@@ -1418,7 +1419,7 @@
        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}
        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
@@ -1430,16 +1431,16 @@
        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 handle_status = 2 THEN 1
        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)
        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(DISTINCT CONCAT(road,door_no,floor,unit_no,house_no)) FROM com_mng_population WHERE village_id = #{villageId}) as houseTotal,
      (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,
@@ -1485,7 +1486,7 @@
         <foreach collection="villageIds" index="index" item="item" open="(" separator="," close=")">
            #{item}
         </foreach>
         ) temp GROUP BY filed
         ) temp WHERE filed is not null GROUP BY filed
         UNION ALL
         (SELECT '0-18岁' AS filed, 0 AS num)
         UNION ALL
@@ -1504,5 +1505,21 @@
         (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>