罗元桥
2021-06-17 7febb461fdabc11456586d4ea754e169720ab14c
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComMngPopulationDAO.java
@@ -284,7 +284,7 @@
            " egd.grid_community_id = #{communityId}  " +
            " AND e.event_deal_status IN ( 1, 4 )  " +
            "ORDER BY " +
            " e.create_at DESC  " +
            " e.happen_time DESC  " +
            " LIMIT 8")
    List<IndexEventListStatisticsVO> getScreenIndexByEventList(@Param("communityId") Long communityId);
@@ -708,4 +708,20 @@
    @Select("select count(user_id) from sys_user where community_id = #{communityId} and type = 1")
    Long countUsedCommunityPopulation(@Param("communityId")Long communityId);
    @Select(
            "SELECT " +
                    "(SELECT COUNT(aa.age) FROM " +
                    "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, birthday, CURDATE()) ) AS age FROM com_mng_population WHERE act_id = #{communityId}) as aa where aa.age<= 16) as age16," +
                    "(SELECT COUNT(aa.age) FROM " +
                    "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, birthday, CURDATE()) ) AS age FROM com_mng_population WHERE act_id = #{communityId}) AS aa WHERE aa.age > 16 and aa.age<= 27) AS age27," +
                    "(SELECT COUNT(aa.age) FROM " +
                    "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, birthday, CURDATE()) ) AS age FROM com_mng_population WHERE act_id = #{communityId}) AS aa WHERE aa.age > 27 and aa.age<= 35) AS age35," +
                    "(SELECT COUNT(aa.age) FROM " +
                    "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, birthday, CURDATE()) ) AS age FROM com_mng_population WHERE act_id = #{communityId}) AS aa WHERE aa.age > 35 and aa.age<= 45) AS age45," +
                    "(SELECT COUNT(aa.age) FROM " +
                    "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, birthday, CURDATE()) ) AS age FROM com_mng_population WHERE act_id = #{communityId}) AS aa WHERE aa.age > 45 and aa.age<= 55) AS age55," +
                    "(SELECT COUNT(aa.age) FROM " +
                    "(SELECT (SELECT  TIMESTAMPDIFF(YEAR, birthday, CURDATE()) ) AS age FROM com_mng_population WHERE act_id = #{communityId}) AS aa WHERE aa.age > 55) AS age55over")
    Map<String, Long> indexCountByAge(@Param("communityId")Long communityId);
}