liujie
2025-06-09 70d2a5d0f9c6951b2d4cac954041ed73582ff7eb
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
@@ -81,6 +81,9 @@
        + "</script>")
    List<ComMngPopulationVO> listPopulation(ComMngPopulationDTO populationVO);
    List<ComMngPopulationDO> selectListIds();
    @Select("select id,user_id,relationship,`name`,id_card,phone,age,health,job,create_at,update_at,card_photo_front,card_photo_back,family_book from com_mng_family_info where user_id=#{userId} order by create_at desc ")
    List<ComMngFamilyInfoVO> listFamilyByUserId(Long userId);
@@ -93,63 +96,70 @@
        + " LEFT JOIN com_mng_population cmp ON cmphu.popul_id = cmp.id " + " WHERE cmphu.popul_id = #{populId}")
    List<ComHouseMemberVo> listHouseMermberByPopuId(@Param("populId") Long populId);
    @Select("<script> " + "SELECT " + "cmp.`name`, " + "cmp.id, " + "cmp.street_id, " + "cmp.act_id, "
        + "cmp.village_id, " + "cmp.sex, " + "cmp.card_no, " + "cmp.road, " + "cmp.door_no, " + "cmp.floor, "
        + "cmp.unit_no, " + "cmp.house_no, " + "cmp.political_outlook, " + "cmp.work_company, "
        + "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,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> "
        + "<if test='comMngPopulationVO.label != null and comMngPopulationVO.label != &quot;&quot;'>"
        + "AND cmpct.label LIKE concat('%',#{comMngPopulationVO.label},'%') " + " </if> "
        + "<if test='comMngPopulationVO.actId != null'>" + " and cmpct.community_id = ${comMngPopulationVO.actId} "
        + " </if> " + "<if test='comMngPopulationVO.outOrLocal != null'>"
        + " and cmp.out_or_local = #{comMngPopulationVO.outOrLocal} " + " </if> "
        + "<if test='comMngPopulationVO.villageId != null and comMngPopulationVO.villageId != &quot;&quot;'>"
        + " and cmp.village_id = #{comMngPopulationVO.villageId} " + " </if> "
        + "<if test='comMngPopulationVO.road != null and comMngPopulationVO.road != &quot;&quot;'>"
        + "AND cmp.road = #{comMngPopulationVO.road} " + " </if> "
        + "<if test='comMngPopulationVO.doorNo != null and comMngPopulationVO.doorNo != &quot;&quot;'>"
        + "AND cmp.door_no = #{comMngPopulationVO.doorNo} " + " </if> "
        + "<if test='comMngPopulationVO.floor != null and comMngPopulationVO.floor != &quot;&quot;'>"
        + "AND cmp.floor = #{comMngPopulationVO.floor} " + " </if> "
        + "<if test='comMngPopulationVO.unitNo != null and comMngPopulationVO.unitNo != &quot;&quot;'>"
        + "AND cmp.unit_no = #{comMngPopulationVO.unitNo} " + " </if> "
        + "<if test='comMngPopulationVO.houseNo != null and comMngPopulationVO.houseNo != &quot;&quot;'>"
        + "AND cmp.house_no = #{comMngPopulationVO.houseNo} " + " </if> "
        + "<if test='comMngPopulationVO.isDeath != null'>"
        + "AND cmp.death = #{comMngPopulationVO.isDeath} " + " </if> "
        + "<if test='comMngPopulationVO.sex != null and comMngPopulationVO.sex != &quot;&quot;'>"
        + "AND cmp.sex = #{comMngPopulationVO.sex} " + " </if> "
        + "<if test='comMngPopulationVO.ageStartTime != null and comMngPopulationVO.ageStartTime != &quot;&quot; and comMngPopulationVO.ageEndTime == null'>"
        + "AND date_format(cmp.birthday,'%Y-%m-%d') <![CDATA[ <= ]]> #{comMngPopulationVO.ageStartTime} " + " </if> "
        + "<if test='comMngPopulationVO.ageEndTime != null and comMngPopulationVO.ageEndTime != &quot;&quot; and comMngPopulationVO.ageStartTime == null'>"
        + "AND date_format(cmp.birthday,'%Y-%m-%d') <![CDATA[ >= ]]> #{comMngPopulationVO.ageEndTime} " + " </if> "
        + "<if test='comMngPopulationVO.ageStartTime != null and comMngPopulationVO.ageEndTime != null and comMngPopulationVO.ageStartTime == comMngPopulationVO.ageEndTime'>"
        + "AND cmp.birthday BETWEEN #{comMngPopulationVO.ageStartTimeEnd} and #{comMngPopulationVO.ageEndTime}"
        + " </if> "
        + "<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.keyWord != null and comMngPopulationVO.keyWord != '' '>"
        + "AND (cmp.name like concat('%',#{comMngPopulationVO.keyWord},'%') or cmp.card_no_str like concat('%',#{comMngPopulationVO.keyWord},'%') or cmp.phone like concat('%',#{comMngPopulationVO.keyWord},'%') "
        + " </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;'>"
        + "AND cmp.nation = #{comMngPopulationVO.nation} " + " </if> "
        + "<if test='comMngPopulationVO.politicalOutlook != null and comMngPopulationVO.politicalOutlook != &quot;&quot;'>"
        + "AND cmp.political_outlook = #{comMngPopulationVO.politicalOutlook} " + " </if> "
        + "<if test='comMngPopulationVO.cardNo != null and comMngPopulationVO.cardNo != &quot;&quot;'>"
        + "AND cmp.card_no = #{comMngPopulationVO.cardNo} " + " </if> "
        + "<if test='comMngPopulationVO.remark != null and comMngPopulationVO.remark != &quot;&quot;'>"
        + "AND cmp.remark = #{comMngPopulationVO.remark} " + " </if> " + " </where>" + " order by cmp.create_at desc"
        + "</script>")
//    @Select("<script> " + "SELECT " + "cmp.`name`, " + "cmp.id, " + "cmp.street_id, " + "cmp.act_id, "
//        + "cmp.village_id, " + "cmp.sex, " + "cmp.card_no, " + "cmp.road, " + "cmp.door_no, " + "cmp.floor, "
//        + "cmp.unit_no, " + "cmp.house_no, " + "cmp.political_outlook, " + "cmp.work_company, "
//        + "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,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> "
//        + "<if test='comMngPopulationVO.label != null and comMngPopulationVO.label != &quot;&quot;'>"
//        + "AND cmpct.label LIKE concat('%',#{comMngPopulationVO.label},'%') " + " </if> "
//        + "<if test='comMngPopulationVO.actId != null'>" + " and cmpct.community_id = ${comMngPopulationVO.actId} "
//        + " </if> " + "<if test='comMngPopulationVO.outOrLocal != null'>"
//        + " and cmp.out_or_local = #{comMngPopulationVO.outOrLocal} " + " </if> "
//        + "<if test='comMngPopulationVO.villageId != null and comMngPopulationVO.villageId != &quot;&quot;'>"
//        + " and cmp.village_id = #{comMngPopulationVO.villageId} " + " </if> "
//        + "<if test='comMngPopulationVO.road != null and comMngPopulationVO.road != &quot;&quot;'>"
//        + "AND cmp.road = #{comMngPopulationVO.road} " + " </if> "
//        + "<if test='comMngPopulationVO.doorNo != null and comMngPopulationVO.doorNo != &quot;&quot;'>"
//        + "AND cmp.door_no = #{comMngPopulationVO.doorNo} " + " </if> "
//        + "<if test='comMngPopulationVO.floor != null and comMngPopulationVO.floor != &quot;&quot;'>"
//        + "AND cmp.floor = #{comMngPopulationVO.floor} " + " </if> "
//        + "<if test='comMngPopulationVO.unitNo != null and comMngPopulationVO.unitNo != &quot;&quot;'>"
//        + "AND cmp.unit_no = #{comMngPopulationVO.unitNo} " + " </if> "
//        + "<if test='comMngPopulationVO.houseNo != null and comMngPopulationVO.houseNo != &quot;&quot;'>"
//        + "AND cmp.house_no = #{comMngPopulationVO.houseNo} " + " </if> "
//        + "<if test='comMngPopulationVO.isDeath != null'>"
//        + "AND cmp.death = #{comMngPopulationVO.isDeath} " + " </if> "
//        + "<if test='comMngPopulationVO.sex != null and comMngPopulationVO.sex != &quot;&quot;'>"
//        + "AND cmp.sex = #{comMngPopulationVO.sex} " + " </if> "
//        + "<if test='comMngPopulationVO.ageStartTime != null and comMngPopulationVO.ageStartTime != &quot;&quot; and comMngPopulationVO.ageEndTime == null'>"
//        + "AND date_format(cmp.birthday,'%Y-%m-%d') <![CDATA[ <= ]]> #{comMngPopulationVO.ageStartTime} " + " </if> "
//        + "<if test='comMngPopulationVO.ageEndTime != null and comMngPopulationVO.ageEndTime != &quot;&quot; and comMngPopulationVO.ageStartTime == null'>"
//        + "AND date_format(cmp.birthday,'%Y-%m-%d') <![CDATA[ >= ]]> #{comMngPopulationVO.ageEndTime} " + " </if> "
//        + "<if test='comMngPopulationVO.ageStartTime != null and comMngPopulationVO.ageEndTime != null and comMngPopulationVO.ageStartTime == comMngPopulationVO.ageEndTime'>"
//        + "AND cmp.birthday BETWEEN #{comMngPopulationVO.ageStartTimeEnd} and #{comMngPopulationVO.ageEndTime}"
//        + " </if> "
//        + "<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;'>"
//        + "AND cmp.nation = #{comMngPopulationVO.nation} " + " </if> "
//        + "<if test='comMngPopulationVO.politicalOutlook != null and comMngPopulationVO.politicalOutlook != &quot;&quot;'>"
//        + "AND cmp.political_outlook = #{comMngPopulationVO.politicalOutlook} " + " </if> "
//        + "<if test='comMngPopulationVO.cardNo != null and comMngPopulationVO.cardNo != &quot;&quot;'>"
//        + "AND cmp.card_no = #{comMngPopulationVO.cardNo} " + " </if> "
//        + "<if test='comMngPopulationVO.remark != null and comMngPopulationVO.remark != &quot;&quot;'>"
//        + "AND cmp.remark = #{comMngPopulationVO.remark} " + " </if> " + " </where>" + " order by cmp.create_at desc"
//        + "</script>")
    IPage<ComMngPopulationVO> pagePopulation(Page page,
        @Param("comMngPopulationVO") ComMngPopulationDTO comMngPopulationVO);
    /**
     * 导出老人列表
     * @param comMngPopulationVO
     * @return
     */
    List<ComMngPopulationVO> exportOld(@Param("comMngPopulationVO") ComMngPopulationDTO comMngPopulationVO);
    /**
     * 分页查询特殊群体列表
@@ -229,10 +239,10 @@
            "          left join com_mng_population  as cmp on cmpct.population_id = cmp.id   WHERE cmp.sex is not null  and  cmpct.community_id = ${communityId} GROUP BY cmp.sex")
    List<IndexPopulationSexStatisticsVO> getScreenIndexByPopulationSex(@Param("communityId") Long communityId);
    @Select("SELECT " + " e.happen_time as createAt, " + " e.event_des, " + " e.event_deal_status  " + "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_deal_status IN ( 1, 4 )  " + "ORDER BY "
        + " e.happen_time DESC  " + " LIMIT 8")
//    @Select("SELECT " + " e.happen_time as createAt, " + " e.event_des, " + " e.event_deal_status  " + "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_deal_status IN ( 1, 4 )  " + "ORDER BY "
//        + " e.happen_time DESC  " + " LIMIT 8")
    List<IndexEventListStatisticsVO> getScreenIndexByEventList(@Param("communityId") Long communityId);
    @Select("SELECT " + " count( id ) AS microWishTotal, "
@@ -427,7 +437,7 @@
    @Select("SELECT " + "(SELECT COUNT(aa.age) FROM "
        + "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, cmp.birthday, CURDATE()) ) AS age FROM com_mng_population as cmp left join com_mng_population_community_tags as cmpct on cmp.id = cmpct.population_id WHERE cmpct.community_id = ${communityId}) as aa where aa.age<= 18) as age16,"
        + "(SELECT COUNT(aa.age) FROM "
        + "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, cmp.birthday, CURDATE()) ) AS age FROM com_mng_population_community_tags as capct left join com_mng_population as cmp on cmp.id = capct.population_id and capct.community_id =  #{communityId}) AS aa WHERE aa.age > 19 and aa.age<= 30) AS age27,"
        + "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, cmp.birthday, CURDATE()) ) AS age FROM com_mng_population_community_tags as capct left join com_mng_population as cmp on cmp.id = capct.population_id and capct.community_id =  ${communityId}) AS aa WHERE aa.age > 19 and aa.age<= 30) AS age27,"
        + "(SELECT COUNT(aa.age) FROM "
        + "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, cmp.birthday, CURDATE()) ) AS age FROM com_mng_population_community_tags as capct left join com_mng_population as cmp on cmp.id = capct.population_id and capct.community_id = ${communityId}) AS aa WHERE aa.age > 31 and aa.age<= 40) AS age35,"
        + "(SELECT COUNT(aa.age) FROM "