From 6424521a768125e66b64a23d2094e05eb95b105f Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期五, 08 十月 2021 11:30:14 +0800
Subject: [PATCH] bug修复

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java |   82 +++++++++++++++++++++++++---------------
 1 files changed, 51 insertions(+), 31 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
index 22b0360..d72079a 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
@@ -4,6 +4,9 @@
 import java.util.List;
 import java.util.Map;
 
+import com.panzhihua.common.model.dtos.community.CascadeHouseDTO;
+import com.panzhihua.common.model.dtos.property.CommonPage;
+import com.panzhihua.common.model.vos.community.*;
 import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -21,8 +24,6 @@
 import com.panzhihua.common.model.dtos.grid.admin.PageComMngVillagePopulationDTO;
 import com.panzhihua.common.model.dtos.user.PageInputUserDTO;
 import com.panzhihua.common.model.vos.area.AreaAddressVO;
-import com.panzhihua.common.model.vos.community.ComMngPopulationTotalVO;
-import com.panzhihua.common.model.vos.community.ComMngPopulationVO;
 import com.panzhihua.common.model.vos.community.screen.civil.CivilPopulationStatisticsVO;
 import com.panzhihua.common.model.vos.community.screen.civil.CivilVillageStatisticsVO;
 import com.panzhihua.common.model.vos.community.screen.event.*;
@@ -141,24 +142,18 @@
     IPage<ComMngPopulationVO> pagePopulation(Page page,
         @Param("comMngPopulationVO") ComMngPopulationDTO comMngPopulationVO);
 
-    @Select("<script> "
-        + "select cmp.id,cmv.`alley` as areaName,cmp.`name`,cmp.phone,cmp.label as tags,cmp.create_at from com_mng_population as cmp "
-        + "left join com_mng_village as cmv on cmv.village_id = cmp.village_id "
-        + "left join com_mng_population_community_tags as cmpct on cmp.id = cmpct.population_id "
-        + "where cmpct.community_id = #{pageInputUserDTO.communityId} and cmpct.label is not null "
-        + "<if test='pageInputUserDTO.name != null and pageInputUserDTO.name != &quot;&quot;'>"
-        + " AND cmp.`name` LIKE concat(#{pageInputUserDTO.name},'%') " + " </if> "
-        + "<if test='pageInputUserDTO.areaName != null and pageInputUserDTO.areaName != &quot;&quot;'>"
-        + " AND cmv.`alley` LIKE concat(#{pageInputUserDTO.areaName},'%') " + " </if> "
-        + "<if test='pageInputUserDTO.tags != null and pageInputUserDTO.tags != &quot;&quot;'>"
-        + " AND cmpct.label like concat('%',#{pageInputUserDTO.tags},'%') " + " </if> "
-        + " order by cmp.create_at desc " + "</script>")
+    /**
+     * 分页查询特殊群体列表
+     * @param page  分页参数
+     * @param pageInputUserDTO  请求参数
+     * @return  特殊群体列表
+     */
     IPage<InputUserInfoVO> specialInputUser(Page page, @Param("pageInputUserDTO") PageInputUserDTO pageInputUserDTO);
 
     @Select("<script> "
-        + "select id,tag_name,community_id,create_at,sys_flag from com_mng_user_tag where community_id = #{comMngUserTagDTO.communityId}"
+        + "select id,tag_name,community_id,create_at,sys_flag from com_mng_user_tag <where> "
         + "<if test='comMngUserTagDTO.tagName != null and comMngUserTagDTO.tagName != &quot;&quot;'>"
-        + " AND tag_name LIKE concat(#{comMngUserTagDTO.tagName},'%') " + " </if> " + " order by create_at desc "
+        + " AND tag_name LIKE concat(#{comMngUserTagDTO.tagName},'%') " + " </if> " + "</where>" + " order by create_at desc "
         + "</script>")
     IPage<ComMngTagVO> specialInputUserTags(Page page, @Param("comMngUserTagDTO") PageInputUserDTO comMngUserTagDTO);
 
@@ -179,7 +174,7 @@
     AreaAddressVO getAreaAddress(@Param("provinceCode") String provinceCode, @Param("cityCode") String cityCode,
         @Param("districtCode") String districtCode);
 
-    @Select("select count(id) as populationTotal "
+    @Select("select count(cmpct.id) as populationTotal "
         + ",(select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = #{communityId} and cmp.out_or_local = 1) as localTotal "
         + ",(select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = #{communityId} and cmp.out_or_local = 2) as outTotal "
         + ",(select count(cmpct.id) from com_mng_population_community_tags cmpct left join com_mng_population cmp on cmpct.population_id = cmp.id where cmpct.community_id = #{communityId} and cmpct.label is not null) as specialTotal "
@@ -188,12 +183,14 @@
         + ",(select count(id) from com_mng_population_community_tags where community_id = #{communityId} and label LIKE CONCAT('%','社区矫正','%')) as correctTotal "
         + ",(select count(id) from com_mng_population_community_tags where community_id = #{communityId} and label LIKE CONCAT('%','精神障碍患者','%')) as majorTotal "
         + ",(select count(id) from com_mng_population_community_tags where community_id = #{communityId} and label LIKE CONCAT('%','邪教人员','%')) as cultTotal "
-        + ",(select count(id) from com_mng_population_community_tags where community_id = #{communityId} and label LIKE CONCAT('%','刑满释放','%')) as rehabilitationTotal "
+        + ",(select count(id) from com_mng_population_community_tags where community_id = #{communityId} and label LIKE CONCAT('%','刑释人员','%')) as rehabilitationTotal "
         + ",(select count(id) from com_mng_population_community_tags where community_id = #{communityId} and label LIKE CONCAT('%','重点人员','%')) as keyTotal "
         + ",(select count(id) from com_mng_population_community_tags where community_id = #{communityId} and label LIKE CONCAT('%','退役军人','%')) as veteransTotal "
         + ",(select count(id) from com_mng_population_community_tags where community_id = #{communityId} and label LIKE CONCAT('%','残疾人','%')) as disabilityTotal "
         + ",(select count(id) from com_mng_population_community_tags where community_id = #{communityId} and label LIKE CONCAT('%','低保户','%')) as lowSecurityTotal "
-        + " from com_mng_population_community_tags as cmpct where community_id = #{communityId}")
+        + ",(select count(id) from com_mng_population_community_tags where community_id = #{communityId} and label LIKE CONCAT('%','高龄老人','%')) as elderTotal "
+        + ",(select count(id) from com_mng_population_community_tags where community_id = #{communityId} and label LIKE CONCAT('%','养老金人员','%')) as pensionTotal "
+        + " from com_mng_population_community_tags as cmpct inner join com_mng_population as cmp on cmp.id = cmpct.population_id where community_id = #{communityId}")
     ComMngPopulationTotalVO getPopulationTotalByAdmin(@Param("communityId") Long communityId);
 
     @Select("select count(id) as populationTotal," +
@@ -548,15 +545,6 @@
     @Select("select count(id) from com_elders_auth_elderly WHERE community_id = #{communityId}")
     Integer getStatisticsCount(@Param("communityId") Long communityId);
 
-    @Select("<script> "
-        + "select cmp.id,cmp.`name`,cmp.phone,cmp.card_no,cmpct.label,cmp.address,cmp.nation,cmp.political_outlook,cmv.lng,cmv.lat"
-        + ",cmp.sex from com_mng_population as cmp left join com_mng_village as cmv on cmv.village_id = cmp.village_id "
-        + " left join com_mng_population_community_tags as cmpct on cmp.id = cmpct.population_id  "
-        + " where cmpct.community_id = #{populationListDTO.communityId}"
-        + "<if test='populationListDTO.keyWord != null and populationListDTO.keyWord != &quot;&quot;'>"
-        + "AND (cmp.`name` like concat (#{populationListDTO.keyWord},'%') or cmp.card_no_str like concat (#{populationListDTO.keyWord},'%'))  "
-        + " </if> " + "<if test='populationListDTO.label != null and populationListDTO.label != &quot;&quot;'>"
-        + "AND cmpct.label like concat ('%',#{populationListDTO.label},'%') " + " </if> " + " </script>")
     IPage<PopulationListVO> pagePopulationListApp(Page page,
         @Param("populationListDTO") PagePopulationListDTO populationListDTO);
 
@@ -567,7 +555,7 @@
         + " cmp.census_register, " + " cmp.out_or_local, " + " cmp.remark, " + " cmp.marriage " + "FROM "
         + " com_mng_population AS cmp " + " LEFT JOIN com_mng_village AS cmv ON cmv.village_id = cmp.village_id  "
         + " left join com_mng_population_community_tags as cmpct on cmp.id = cmpct.population_id  " + "WHERE "
-        + " id = #{populationId}")
+        + " cmp.id = #{populationId}")
     PopulationDetailVO getPopulationDetailApp(@Param("populationId") Long populationId);
 
     @Select("<script> " + " SELECT " + " cmp.id, " + "  cmp.`name` AS userName, "
@@ -601,6 +589,12 @@
         + "</foreach>" + " </script>")
     Integer getPopulationVisitingCount(@Param("ids") List<Long> ids);
 
+    /**
+     * 综治后台删除居民,并清理人口与社区绑定关系
+     * @param ids   需要删除的人口id集合
+     */
+    void deletePopulaitonRelation(@Param("ids") List<Long> ids);
+
     @Select("<script> " + "SELECT " + "   cmp.id, " + "   cmp.`name`, " + "   cmp.card_no as idCard, "
         + "   cmpct.label, " + "   cmp.sex, " + "   IFNULL( cmp.phone, '暂无' ) as phone, " + "   cmp.address, "
         + "   cmp.political_outlook " + "  FROM "
@@ -615,7 +609,7 @@
         @Param("populationDTO") PageComMngPopulationDTO populationDTO);
 
     @Select("<script> " + "SELECT " + " count( id ) AS localNum, "
-        + " ( SELECT count( cmpct.id ) FROM com_mng_population as cmp WHERE cmp.out_or_local = 2 "
+        + " ( SELECT count( cmp.id ) FROM com_mng_population as cmp WHERE cmp.out_or_local = 2 "
         +  " ) AS flowNum, "
         + " ( SELECT count( cmpct.id ) FROM com_mng_population as cmp left join com_mng_population_community_tags AS cmpct on cmp.id = cmpct.population_id WHERE cmpct.label IS NOT NULL "
         + " ) AS specialNum  " + "FROM "
@@ -651,7 +645,7 @@
         getGridPopulationAdminLists(@Param("populationExportDTO") ComMngPopulationExportDTO populationExportDTO);
 
     @Select("<script> "
-        + " select cmp.id,cmp.`name`,cmp.card_no,cmtct.label from com_mng_population as cmp left join com_mng_population_community_tags AS cmpct on cmp.id = cmpct.population_id where 1=1 "
+        + " select cmp.id,cmp.`name`,cmp.card_no,cmpct.label from com_mng_population as cmp left join com_mng_population_community_tags AS cmpct on cmp.id = cmpct.population_id where 1=1 "
         + "<if test='villagePopulationDTO.villageId != null'>"
         + " and cmp.village_id = #{villagePopulationDTO.villageId} " + " </if> "
         + "<if test='villagePopulationDTO.keyWord != null'>"
@@ -686,4 +680,30 @@
 
     void updateAll(@Param("populationList") List<ComMngPopulationDO> populationList);
 
+    /**
+     * 房屋二级联动
+     * @param communityId
+     * @return
+     */
+    List<VillageVO> getSecondHouseAddress(Long communityId);
+
+    /**
+     * 房屋二级联动后台
+     * @param communityId
+     * @return
+     */
+    List<VillageVO> getSecondHouse(Long communityId);
+
+    /**
+     * 四长四员分页查询
+     * @param page
+     * @param commonPage
+     * @return
+     */
+    IPage<ComMngPopulationNoSecretVO> query(Page page, @Param("commonPage") CommonPage commonPage);
+
+    /**
+     * 居民详情
+     */
+    ComMngPopulationDetailVO getById(Long id);
 }

--
Gitblit v1.7.1