springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationCommunityTagsDAO.java
@@ -16,7 +16,6 @@ @Mapper public interface ComMngPopulationCommunityTagsDAO extends BaseMapper<ComMngPopulationCommunityTagsDO> { void updateAll( @Param("populationCommunityTagsList") List<ComMngPopulationCommunityTagsDO> populationCommunityTagsList); void updateAll(@Param("populationList") List<ComMngPopulationCommunityTagsDO> comMngPopulationCommunityTagsDOS); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
@@ -196,18 +196,19 @@ + " from com_mng_population_community_tags as cmpct where community_id = #{communityId}") ComMngPopulationTotalVO getPopulationTotalByAdmin(@Param("communityId") Long communityId); @Select("select count(id) as populationTotal," + "IFNULL((select count(id) from com_mng_population_house where community_id = cmp.act_id),0) as houseTotal, " + "IFNULL((select count(id) from com_mng_real_company where community_id = cmp.act_id),0) as companyTotal, " + "IFNULL((select count(village_id) from com_mng_village where community_id = cmp.act_id),0) as villageTotal " + " com_mng_population_community_tags as cmpct " + " where community_id = = #{communityId}") @Select("select count(id) as populationTotal," + "IFNULL((select count(id) from com_mng_population_house where community_id = cmpct.community_id),0) as houseTotal, " + "IFNULL((select count(id) from com_mng_real_company where community_id = cmpct.community_id),0) as companyTotal, " + "IFNULL((select count(village_id) from com_mng_village where community_id = cmpct.community_id),0) as villageTotal " + " from com_mng_population_community_tags AS cmpct " + " where cmpct.community_id = #{communityId}") IndexBasicsStatisticsVO getScreenIndexByBasics(@Param("communityId") Long communityId); @Select("SELECT " + " IFNULL( NULL, 1 ) AS type, " + " count( cmpct.id ) AS sum " + "FROM " + " com_mng_population_community_tags as cmpct " + " left join com_mng_population as cmp on cmpct.population_id = cmp.id " + "WHERE " + " cmp.sex = 1 " + " AND cmpct.community_id = #{communityId} UNION ALL " + "SELECT " + " IFNULL( NULL, 2 ) AS type, " + " count( id ) AS sum " + "FROM " + " com_mng_population_community_tags as cmpct " + " count( cmpct.id ) AS sum " + "FROM " + " com_mng_population_community_tags as cmpct " + " left join com_mng_population as cmp on cmpct.population_id = cmp.id " + "WHERE " + " cmp.sex = 2 " + " AND cmpct.community_id = #{communityId}") List<IndexPopulationSexStatisticsVO> getScreenIndexByPopulationSex(@Param("communityId") Long communityId); @@ -270,8 +271,8 @@ List<ComMngUserTagVO> getUserTagListByCommunityId(@Param("communityId") Long communityId); @Select("SELECT " + " count( id ) " + "FROM " + " com_mng_population_community_tags " + "WHERE " + " label like concat('%',#{label},'%')") Integer getSpecialStatisticsByLabel(@Param("label") String label); + " community_id = #{communityId} and label like concat('%',#{label},'%')") Integer getSpecialStatisticsByLabel(@Param("label") String label,@Param("communityId") Long communityId); @Select("<script> " + "SELECT " + " count( egd.id ) AS gridTotal, " + " ( SELECT count( user_id ) FROM sys_user WHERE community_id = egd.grid_community_id AND type = 6 ) AS gridMemberTotal, " @@ -403,7 +404,7 @@ + " AND create_at <![CDATA[>=]]> #{screenEventDTO.startTime} " + " </if> " + "<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>" + " AND create_at <![CDATA[<=]]> #{screenEventDTO.endTime} " + " </if> " + "), 0 ) AS eventSSPTotal, " + " IFNULL(( SELECT count( id ) FROM com_act_easy_photo WHERE del_tag = 0 AND handle_status = 2 AND community_id = #{screenEventDTO.communityId} " + " IFNULL(( SELECT count( id ) FROM com_act_easy_photo WHERE del_tag = 0 AND status = 4 AND community_id = #{screenEventDTO.communityId} " + "<if test='screenEventDTO.startTime != null and screenEventDTO.startTime != ""'>" + " AND create_at <![CDATA[>=]]> #{screenEventDTO.startTime} " + " </if> " + "<if test='screenEventDTO.endTime != null and screenEventDTO.endTime != ""'>" @@ -506,15 +507,15 @@ @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<= 16) as age16," + "(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 > 16 and aa.age<= 27) 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 > 16 and aa.age<= 27) AS age27," + "(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 > 27 and aa.age<= 35) AS age35," + "(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 > 27 and aa.age<= 35) AS age35," + "(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 > 35 and aa.age<= 45) AS age45," + "(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 > 35 and aa.age<= 45) AS age45," + "(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 > 45 and aa.age<= 55) AS age55," + "(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 > 45 and aa.age<= 55) AS age55," + "(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 > 55) AS age55over") + "(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 > 55) AS age55over") Map<String, Long> indexCountByAge(@Param("communityId") Long communityId); @Select("SELECT " + " id, " + " su.nick_name AS userName, " + " su.image_url, " + " caep.create_at, " springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -811,7 +811,7 @@ } if (!updatePopulationCommunityList.isEmpty()) { log.info("执行数据库更新人口社区关系"); comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); comMngPopulationCommunityTagsDAO.updateAll(updatePopulationCommunityList); log.info("数据库更新人口社区关系完成"); } log.info("执行数据库导入完成"); @@ -1106,7 +1106,7 @@ } if (!updatePopulationCommunityList.isEmpty()) { log.info("执行数据库更新人口社区关系"); comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); comMngPopulationCommunityTagsDAO.updateAll(updatePopulationCommunityList); log.info("数据库更新人口社区关系完成"); } log.info("执行数据库导入完成"); @@ -1401,7 +1401,7 @@ } if (!updatePopulationCommunityList.isEmpty()) { log.info("执行数据库更新人口社区关系"); comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); comMngPopulationCommunityTagsDAO.updateAll(updatePopulationCommunityList); log.info("数据库更新人口社区关系完成"); } log.info("执行数据库导入完成"); @@ -1696,7 +1696,7 @@ } if (!updatePopulationCommunityList.isEmpty()) { log.info("执行数据库更新人口社区关系"); comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); comMngPopulationCommunityTagsDAO.updateAll(updatePopulationCommunityList); log.info("数据库更新人口社区关系完成"); } log.info("执行数据库导入完成"); @@ -1991,7 +1991,7 @@ } if (!updatePopulationCommunityList.isEmpty()) { log.info("执行数据库更新人口社区关系"); comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); comMngPopulationCommunityTagsDAO.updateAll(updatePopulationCommunityList); log.info("数据库更新人口社区关系完成"); } log.info("执行数据库导入完成"); @@ -2289,7 +2289,7 @@ } if (!updatePopulationCommunityList.isEmpty()) { log.info("执行数据库更新人口社区关系"); comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); comMngPopulationCommunityTagsDAO.updateAll(updatePopulationCommunityList); log.info("数据库更新人口社区关系完成"); } log.info("执行数据库导入完成"); @@ -2584,7 +2584,7 @@ } if (!updatePopulationCommunityList.isEmpty()) { log.info("执行数据库更新人口社区关系"); comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); comMngPopulationCommunityTagsDAO.updateAll(updatePopulationCommunityList); log.info("数据库更新人口社区关系完成"); } log.info("执行数据库导入完成"); @@ -2879,7 +2879,7 @@ } if (!updatePopulationCommunityList.isEmpty()) { log.info("执行数据库更新人口社区关系"); comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); comMngPopulationCommunityTagsDAO.updateAll(updatePopulationCommunityList); log.info("数据库更新人口社区关系完成"); } log.info("执行数据库导入完成"); @@ -3174,7 +3174,7 @@ } if (!updatePopulationCommunityList.isEmpty()) { log.info("执行数据库更新人口社区关系"); comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); comMngPopulationCommunityTagsDAO.updateAll(updatePopulationCommunityList); log.info("数据库更新人口社区关系完成"); } log.info("执行数据库导入完成"); @@ -3469,7 +3469,7 @@ } if (!updatePopulationCommunityList.isEmpty()) { log.info("执行数据库更新人口社区关系"); comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); comMngPopulationCommunityTagsDAO.updateAll(updatePopulationCommunityList); log.info("数据库更新人口社区关系完成"); } log.info("执行数据库导入完成"); @@ -3769,7 +3769,7 @@ } if (!updatePopulationCommunityList.isEmpty()) { log.info("执行数据库更新人口社区关系"); comMngPopulationCommunityTagsService.updateBatchById(updatePopulationCommunityList); comMngPopulationCommunityTagsDAO.updateAll(updatePopulationCommunityList); log.info("数据库更新人口社区关系完成"); } log.info("执行数据库导入完成"); @@ -5786,7 +5786,7 @@ userTagList.forEach(userTag -> { if (userTag != null) { if (userTag.getSysFlag().equals(0)) { Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName()); Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName(),communityId); otherSpecialVO.setSum(otherSpecialVO.getSum() + count); } else { if (StringUtils.isNotEmpty(userTag.getTagName())) { @@ -5818,7 +5818,7 @@ } else { IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName()); Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName(),communityId); specialStatisticsVO.setSum(count); specialStatisticsVOList.add(specialStatisticsVO); } @@ -5999,7 +5999,7 @@ userTagList.forEach(userTag -> { if (userTag != null) { if (userTag.getSysFlag().equals(0)) { Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName()); Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName(),communityId); otherSpecialVO.setSum(otherSpecialVO.getSum() + count); } else { if (StringUtils.isNotEmpty(userTag.getTagName())) { @@ -6031,7 +6031,7 @@ } else { IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName()); Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName(),communityId); specialStatisticsVO.setSum(count); specialStatisticsVOList.add(specialStatisticsVO); } @@ -6099,7 +6099,7 @@ userTagList.forEach(userTag -> { if (userTag != null) { if (userTag.getSysFlag().equals(0)) { Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName()); Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName(),communityId); otherSpecialVO.setSum(otherSpecialVO.getSum() + count); } else { if (StringUtils.isNotEmpty(userTag.getTagName())) { @@ -6131,7 +6131,7 @@ } else { IndexSpecialStatisticsVO specialStatisticsVO = new IndexSpecialStatisticsVO(); specialStatisticsVO.setTitle(userTag.getTagName()); Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName()); Integer count = comMngPopulationDAO.getSpecialStatisticsByLabel(userTag.getTagName(),communityId); specialStatisticsVO.setSum(count); specialStatisticsVOList.add(specialStatisticsVO); } springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComMngPopulationCommunityTagsMapper.xml
@@ -19,4 +19,21 @@ id, population_id, community_id, label, create_at, create_by, update_at, update_by </sql> <update id="updateAll" parameterType="java.util.List"> <foreach collection="comMngPopulationCommunityTagsDOS" item="item" index="index" separator=";"> update com_mng_population_community_tags <set> <if test="item.label != null"> `label` = #{item.label}, </if> <if test="item.updateBy != null"> `updateBy` = #{item.updateBy}, </if> `update_at` = NOW() </set> WHERE `id` = #{item.id} </foreach> ; </update> </mapper>