罗元桥
2022-02-18 90de589a0964981f05b1571e441110130f35f4b8
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
@@ -99,7 +99,7 @@
        + "cmp.special_situation, " + "cmp.phone, " + "cmp.remark, " + "cmp.native_place, " + "cmp.nation,  "
        + "cmpct.label,  " + "cmp.marriage,  " + "cmp.culture_level,  " + "cmp.profession,  " + "cmp.out_or_local,  "
        + "cmp.census_register,  " + "cmp.healthy,  " + "cmp.birthday,  " + "cmp.update_at,  " + "cmp.address,  "
        + "cmp.is_rent  " + "FROM  " + "com_mng_population AS cmp "
        + "cmp.is_rent,cmp.death  " + "FROM  " + "com_mng_population AS cmp "
        + " LEFT JOIN com_mng_population_community_tags AS cmpct ON cmp.id = cmpct.population_id  " + "<where>"
        + "<if test='comMngPopulationVO.name != null and comMngPopulationVO.name != &quot;&quot;'>"
        + "AND cmp.`name` LIKE concat(#{comMngPopulationVO.name},'%') " + " </if> "
@@ -134,6 +134,9 @@
        + "<if test='comMngPopulationVO.ageStartTime != null and comMngPopulationVO.ageEndTime != null and comMngPopulationVO.ageStartTime != comMngPopulationVO.ageEndTime'>"
        + "AND cmp.birthday BETWEEN #{comMngPopulationVO.ageEndTimeEnd} and #{comMngPopulationVO.ageStartTime}"
        + " </if> "
        + "<if test='comMngPopulationVO.searchKey != null and comMngPopulationVO.searchKey != &quot;&quot; '>"
        + "AND (cmp.name like concat('%',#{comMngPopulationVO.searchKey},'%') or cmp.card_no_str like concat('%',#{comMngPopulationVO.searchKey},'%') or cmp.phone like concat('%',#{comMngPopulationVO.searchKey},'%') "
        + " </if> "
        + "<if test='comMngPopulationVO.nativePlace != null and comMngPopulationVO.nativePlace != &quot;&quot;'>"
        + "AND cmp.native_place LIKE concat(#{comMngPopulationVO.nativePlace},'%') " + " </if> "
        + "<if test='comMngPopulationVO.nation != null and comMngPopulationVO.nation != &quot;&quot;'>"
@@ -147,6 +150,13 @@
        + "</script>")
    IPage<ComMngPopulationVO> pagePopulation(Page page,
        @Param("comMngPopulationVO") ComMngPopulationDTO comMngPopulationVO);
    /**
     * 导出老人列表
     * @param comMngPopulationVO
     * @return
     */
    List<ComMngPopulationVO> exportOld(@Param("comMngPopulationVO") ComMngPopulationDTO comMngPopulationVO);
    /**
     * 分页查询特殊群体列表
@@ -187,24 +197,29 @@
    AreaAddressVO getAreaAddress(@Param("provinceCode") String provinceCode, @Param("cityCode") String cityCode,
        @Param("districtCode") String districtCode);
    @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 "
        + ",(select count(DISTINCT `name`) from com_mng_village where community_id = ${communityId}) as villageTotal "
        + ",(select count(id) from com_mng_building where act_id = #{communityId}) as buildNum "
        + ",(select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','吸毒人员','%')) as drugTotal "
        + ",(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 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 "
        + ",(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}")
//    @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 "
//        + ",(select count(DISTINCT `name`) from com_mng_village where community_id = ${communityId}) as villageTotal "
//        + ",(select count(id) from com_mng_building where act_id = #{communityId}) as buildNum "
//        + ",(select count(id) from com_mng_population_community_tags where community_id = ${communityId} and label LIKE CONCAT('%','吸毒人员','%')) as drugTotal "
//        + ",(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 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 "
//        + ",(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}")
    /**
     * 实有人口统计
     * @param communityId
     * @return
     */
    ComMngPopulationTotalVO getPopulationTotalByAdmin(@Param("communityId") Long communityId);
    @Select("select count(id) as populationTotal," +