liujie
3 天以前 d130547c1f3b64cf8544261cdf1d9146ff319756
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?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.sangeshenbian.dao.PartyMemberMapper">
 
    <select id="pageList" resultType="com.panzhihua.sangeshenbian.model.entity.PartyMember">
        select id,
               name,
               gender,
               phone,
               districts,
               districts_code,
               id_number,
               street,
               street_id,
               community,
               community_id,
               service_target,
               party_organization,
               avatar,
               audit_status,
               freeze_status,
               refuse_reason,
               create_time,
               update_time,
               create_by,
               update_by,
               del_flag
        from sgsb_party_member
        <where>
            del_flag = 0
            <if test="query.auditStatus !=null">
                and audit_status = #{query.auditStatus}
            </if>
            <if test="loginUserInfo.accountLevel==2">
                and districts_code = #{loginUserInfo.districtsCode}
            </if>
            <if test="loginUserInfo.accountLevel==3">
                and street_id = #{loginUserInfo.streetId}
            </if>
            <if test="loginUserInfo.accountLevel==4">
                and community_id = #{loginUserInfo.communityId}
            </if>
            <if test="query.name != null and query.name != ''">
                and name like concat('%',#{query.name},'%')
            </if>
            <if test="query.communityId != null and query.communityId != ''">
                and community_id = #{query.communityId}
            </if>
            <if test="query.serviceTarget != null and query.serviceTarget != ''">
                and service_target like concat('%',#{query.serviceTarget},'%')
            </if>
            <if test="query.partyOrganization != null and query.partyOrganization != ''">
                and party_organization like concat('%',#{query.partyOrganization},'%')
            </if>
            <if test="query.freezeStatus != null and query.freezeStatus != ''">
                and freeze_status = #{query.freezeStatus}
            </if>
            <if test="query.idNumber != null and query.idNumber != ''">
                and id_number = #{query.idNumber}
            </if>
        </where>
            <if test="query.createTimeSort != null and query.createTimeSort==1 ">
                order by create_time desc
            </if>
            <if test="query.createTimeSort != null and query.createTimeSort==2 ">
                order by create_time asc
            </if>
            <if test="query.createTimeSort ==null and query.updateTimeSort != null and query.updateTimeSort == 1">
                order by update_time desc
            </if>
            <if test="query.createTimeSort ==null and query.updateTimeSort != null and query.updateTimeSort == 2">
                order by update_time asc
            </if>
            <if test="query.createTimeSort ==null and query.updateTimeSort == null ">
                order by create_time desc
            </if>
 
    </select>
    <select id="queryList" resultType="com.panzhihua.sangeshenbian.model.entity.PartyMember">
        select id,
        name,
        gender,
        phone,
        districts,
        districts_code,
        street,
        street_id,
        CONCAT(districts,"-",street,"-",community) AS community,
        community_id,
        service_target,
        party_organization,
        avatar,
        audit_status,
        freeze_status,
        refuse_reason,
        create_time,
        update_time,
        create_by,
        update_by,
        del_flag
        from sgsb_party_member
        <where>
            del_flag = 0
            <if test="loginUserInfo.accountLevel==2">
                and districts_code = #{loginUserInfo.districtsCode}
            </if>
            <if test="loginUserInfo.accountLevel==3">
                and street_id = #{loginUserInfo.streetId}
            </if>
            <if test="loginUserInfo.accountLevel==4">
                and street_id = #{loginUserInfo.streetId}
            </if>
            <if test="query.name != null and query.name != ''">
                and name like concat('%',#{query.name},'%')
            </if>
            <if test="query.communityId != null and query.communityId != ''">
                and community_id = #{query.communityId}
            </if>
            <if test="query.serviceTarget != null and query.serviceTarget != ''">
                and service_target like concat('%',#{query.serviceTarget},'%')
            </if>
            <if test="query.partyOrganization != null and query.partyOrganization != ''">
                and party_organization like concat('%',#{query.partyOrganization},'%')
            </if>
            <if test="query.freezeStatus != null and query.freezeStatus != ''">
                and freeze_status = #{query.freezeStatus}
            </if>
        </where>
        ORDER BY create_time DESC
    </select>
    <select id="queryPreAuditPage"
            resultType="com.panzhihua.sangeshenbian.warpper.PendingPartyMemberApplicationVO">
        SELECT
            id,
            audit_status,
            `name`,
            gender,
            id_number,
            phone,
            districts,
            street,
            community,
            service_target,
            party_organization,
            avatar,
            create_time
        FROM
            sgsb_party_member
        WHERE
            audit_status = 0 and del_flag = 0
        <if test="accountLevel==2">
            and districts_code = #{districtsCode}
        </if>
        <if test="accountLevel==3">
            and street_id = #{streetId}
        </if>
        <if test="accountLevel==4">
            and community_id = #{communityId}
        </if>
    </select>
</mapper>