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
<?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.ComPbMemberDAO">
 
    <select id="selectById" resultType="com.panzhihua.common.model.vos.partybuilding.ComPbMemberVO">
        select t.*,t2.name as orgName from com_pb_member t left join com_mng_population t1 on t.id_card = t1.card_no_str
        left join com_pb_org t2 on t.org_id = t2.id where t1.card_no_str =#{idCard}
    </select>
 
    <select id="selectActivityCountMonth"
            resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenActivityLine">
        select ( select count(id) from com_pb_activity where status!=6 and community_id = ${communityId} and
        release_time >= DATE_FORMAT( CONCAT(#{year},'-',#{date},'-00'), '%Y-%m-00 00:00:00') and DATE_FORMAT(
        LAST_DAY(CONCAT(#{year},'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=release_time) y,
        (select count(id) from com_pb_activity where status!=6 and community_id = ${communityId} and DATE_FORMAT(
        LAST_DAY(CONCAT(#{year},'-',#{date},'-00')), '%Y-%m-%d 23:59:59') >=release_time) countY
    </select>
 
    <select id="selectActivityTop" resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenActivityTop">
        select t.name,t.photo_path as url,t1.name as orgName,t2.integral_available_party as score from com_pb_member t
        LEFT JOIN com_pb_org t1 on t.org_id= t1.id LEFT JOIN com_act_integral_user t2 on t.user_id = t2.user_id where
        t.community_id = ${communityId} and t2.status = 1 order by integral_available_party desc
    </select>
 
    <select id="bigScreenServiceData"
            resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenServiceData">
        select (select count(*) from com_act_work_guide ) guide,
        (select count(*) from com_act_announcement where community_id = ${communityId}) announcement,
        (select count(*) from com_elder_auth_elderlies where community_id = ${communityId}) eldersAuth,
        (select count(*) from com_convenient_merchants where (community_id = ${communityId} OR community_id = 0) and
        is_del =0) convenient,
        (select count(*) from renting_hourse_register where community_id = ${communityId}) rentingHouse,
        (select count(*) from com_property_alarm where community_id = ${communityId}) oneButton,
        (select count(*) from com_pension_auth_pensioners where community_id = ${communityId} ) pensionAuth,
        (select count(*) from com_pb_dyn where community_id = ${communityId} and type = 2) partyDyn,
        (select count(*) from com_property where community_id = ${communityId} ) property
    </select>
 
    <select id="bigScreenServiceUser"
            resultType="com.panzhihua.common.model.vos.community.bigscreen.BigScreenServiceUser">
        select t.name AS villageName, IF(t1.num IS NULL,0,t1.num) as num
        from com_mng_village t left join (
        select count(*) num,village_id
        from com_mng_population
        where act_id = #{communityId} GROUP BY village_id
        ) t1 on t.village_id = t1.village_id where t.community_id = ${communityId}
    </select>
    <select id="checkIsPbMember" resultType="java.lang.Integer">
        SELECT
        (SELECT COUNT(id) FROM com_pb_member WHERE phone = (SELECT phone FROM sys_user WHERE user_id = #{userId}) AND
        audit_result = 1)
        +
        (SELECT COUNT(id) FROM com_pb_member_west WHERE phone = (SELECT phone FROM sys_user WHERE user_id = #{userId})
        AND audit_result = 1)
    </select>
    <select id="checkIsVolunteer" resultType="java.lang.Integer">
        SELECT COUNT(id) FROM com_mng_volunteer_mng WHERE state = 2 AND phone = (SELECT phone FROM sys_user WHERE
        user_id = #{userId})
    </select>
    <select id="statisticsPbMemberType"
            resultType="com.panzhihua.common.model.vos.partybuilding.ComPbMemberTypeVO">
        SELECT count(1) count_num, '统计调查' as count_name FROM com_pb_member WHERE  find_in_set('统计调查',specialty_name)
        UNION ALL
        SELECT count(1) count_num, '法律援助' as count_name FROM com_pb_member WHERE  find_in_set('法律援助',specialty_name)
        UNION ALL
        SELECT count(1) count_num, '志愿活动' as count_name FROM com_pb_member WHERE  find_in_set('志愿活动',specialty_name)
        UNION ALL
        SELECT count(1) count_num, '尊老爱幼' as count_name FROM com_pb_member WHERE  find_in_set('尊老爱幼',specialty_name)
        UNION ALL
        SELECT count(1) count_num, '宣讲宣教' as count_name FROM com_pb_member WHERE  find_in_set('宣讲宣教',specialty_name)
        UNION ALL
        SELECT count(1) count_num, '心理关爱' as count_name FROM com_pb_member WHERE  find_in_set('心理关爱',specialty_name)
        UNION ALL
        SELECT count(1) count_num, '设施维修' as count_name FROM com_pb_member WHERE  find_in_set('设施维修',specialty_name)
        UNION ALL
        SELECT count(1) count_num, '其他' as count_name FROM com_pb_member WHERE  find_in_set('其他',specialty_name)
    </select>
    <select id="selectUnitByNatureName" resultType="com.panzhihua.common.model.vos.partybuilding.ComPbMemberTypeVO">
        SELECT count(1) count_num,'企事业单位' as count_name FROM com_pb_check_unit WHERE nature_name = '企事业单位'
         UNION ALL
         SELECT count(1) count_num,'机关单位' as count_name FROM com_pb_check_unit WHERE nature_name = '机关单位'
    </select>
</mapper>