mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.panzhihua.service_community.dao.ComScreenDao">
    <select id="autonomyDynamic" resultType="com.panzhihua.common.model.vos.puda.DynamicVO">
        select community_id,
        (select count(id) from com_act_micro_wish where community_id=#{communityId}) as microWish,
        (select count(id) from com_act_easy_photo where del_tag=0 and status=5 and  community_id=#{communityId}) as easyPhoto,
        (select count(id) from com_act_announcement where community_id=#{communityId}) as announcement,
        (select count(id) from com_act_activity where community_id=#{communityId}) as communityInfo,
        (select count(id) from com_act_neighbor_circle  where is_del=2 and belong_type=2 and solve_status in (3,4) and community_id=#{communityId}) as questions,
        (select count(id) from com_act_neighbor_circle  where is_del=2 and belong_type=3 and solve_status in (3,4) and community_id=#{communityId}) as demands
        from
        com_act
        where community_id=#{communityId}
    </select>
    <select id="propertyData" resultType="com.panzhihua.common.model.vos.puda.PropertyVO">
        select cp.name as propertyName,(select count(id) from com_pb_service_team cpst where cp.id=cpst.property_id)  as partyMembers
        from com_property cp
        where cp.community_id=#{communityId}
    </select>
    <select id="partyData" resultType="com.panzhihua.common.model.vos.puda.PartyDataVO">
        select id,
        (select count(id) from com_sanshuo_expert where community_id=#{communityId}) as commitee,
        (select count(id) from com_pb_check_unit where community_id=#{communityId}) as unit,
        (select count(id) from com_pb_member where community_id=#{communityId}) as partyMembers,
        (select count(id) from com_pb_dyn where community_id=#{communityId}) as partyActivity
        from com_pb_member where community_id=#{communityId}
        limit 1
    </select>
    <select id="yard" resultType="com.panzhihua.common.model.vos.puda.YardVO">
        select
        (select count(community_id) from com_mng_village where community_id=#{communityId}) as count,
        (select count(community_id) from com_mng_village where community_id=#{communityId} and type=1) as cityYard,
        (select count(community_id) from com_mng_village where community_id=#{communityId} and type=2) as countryYard
        from com_mng_village limit 1
    </select>
    <select id="basicData" resultType="com.panzhihua.common.model.vos.puda.BasicDataVO">
        SELECT count( id ) AS buildings,
        ( SELECT count( id ) FROM com_mng_population_community_tags WHERE community_id = cmb.act_id ) AS people,
        ( SELECT count( id ) FROM com_pb_check_unit WHERE community_id = cmb.act_id ) AS people
        FROM
            com_mng_building AS cmb
        WHERE
            cmb.act_id = #{communityId}
    </select>
 
    <select id="specialPeople" resultType="com.panzhihua.common.model.vos.puda.SpecialPeopleVO">
        select count(id) as count,label from com_mng_population_community_tags
        where community_id=#{communityId}
        GROUP BY label
        having label &lt;> ''
    </select>
    <select id="peopleInfoAdmin"
            resultType="com.panzhihua.common.model.vos.community.building.admin.PageBuildingListAdminVo">
        SELECT
        cmb.id,
        cmv.village_id,
        cmv.alley,
        cmb.`name`,
        cmv.`name` AS villageName,
        cmv.house_num as doorNum,
        (select count(distinct unit_no) from com_mng_population_house where village_id = cmb.village_id AND floor = cmb.`name`) as unit_total,
        (select max(CAST(house_no as SIGNED)) from com_mng_population_house where village_id = cmb.village_id AND floor = cmb.`name` AND `unit_no` is not null and house_no is not null) as buildFloorSum,
        (select count(id) from com_mng_population_house where village_id = cmb.village_id and floor = cmb.`name` ) as houseNum,
        (select count(id) from com_mng_population where village_id = cmb.village_id and floor = cmb.`name`) as populationNum
        FROM
        com_mng_building AS cmb
        inner JOIN com_mng_village AS cmv ON cmv.village_id = cmb.village_id
        <where>
            <if test="communityId != null">
                and cmb.act_id = #{pageBuildingListDto.communityId}
            </if>
        </where>
        order by cmb.id desc
    </select>
    <select id="ageRange" resultType="com.panzhihua.common.model.vos.puda.CitizenInfoVO">
        SELECT count(act_id) as total,
        (SELECT count(act_id) FROM com_mng_population WHERE  act_id=#{vo.communityId} and sex='1') AS maleNum,
        (SELECT count(act_id) FROM com_mng_population WHERE  act_id=#{vo.communityId} and sex='2') AS femaleNum,
        (SELECT count(act_id) FROM com_mng_population WHERE  act_id=#{vo.communityId} and birthday BETWEEN #{vo.offset16} and #{vo.now} ) AS count1,
        (SELECT count(act_id) FROM com_mng_population WHERE  act_id=#{vo.communityId} and birthday BETWEEN #{vo.offset27} and #{vo.offset16}) AS count2,
        (SELECT count(act_id) FROM com_mng_population WHERE  act_id=#{vo.communityId} and birthday BETWEEN #{vo.offset35} and #{vo.offset27}) AS count3,
        (SELECT count(act_id) FROM com_mng_population WHERE  act_id=#{vo.communityId} and birthday BETWEEN #{vo.offset45} and #{vo.offset35}) AS count4,
        (SELECT count(act_id) FROM com_mng_population WHERE  act_id=#{vo.communityId} and birthday BETWEEN #{vo.offset55} and #{vo.offset45}) AS count5,
        (SELECT count(act_id) FROM com_mng_population WHERE  act_id=#{vo.communityId} and birthday &lt; #{vo.offset55}) AS count6
        FROM com_mng_population
        WHERE act_id=#{vo.communityId}
    </select>
    <select id="buildingListHeaderStatisticsAdmin" resultType="com.panzhihua.common.model.vos.community.building.admin.BuildingListHeaderStatisticsAdminVo">
        SELECT count( id ) AS buildNum,( SELECT count( id ) FROM com_mng_population_house WHERE community_id = cmb.act_id ) AS houseNum,
        ( SELECT count( id ) FROM com_mng_population_community_tags WHERE community_id = cmb.act_id ) AS populationNum
        FROM
            com_mng_building AS cmb
        WHERE
            cmb.act_id = #{communityId}
    </select>
    <select id="assetAnalysis" resultType="java.lang.Integer">
        select count(id)
        from com_mng_real_assets
        where community_id=#{communityId}
    </select>
</mapper>