lin
2024-03-22 774c8b2ee14eef5fd10bbd46d85a180e7b19ab21
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<?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="org.springblade.modules.place.mapper.PlaceExtMapper">
 
    <resultMap id="detailMap" type="org.springblade.modules.place.vo.PlaceExtVO" autoMapping="true">
        <id property="id" column="id"/>
        <collection property="placePractitioner" javaType="java.util.List"
                    ofType="org.springblade.modules.place.vo.PlacePractitionerVO" autoMapping="true">
            <id property="id" column="cid"/>
        </collection>
    </resultMap>
 
    <!--自定义分页查询-->
    <select id="selectPlaceExtPage" resultType="org.springblade.modules.place.vo.PlaceExtVO">
        SELECT
        jpe.*,
        jp.place_name AS placeName
        FROM
        jczz_place_ext jpe
        LEFT JOIN jczz_place jp ON jpe.place_id = jp.id AND jp.is_deleted = 0
        LEFT JOIN jczz_grid jg ON jp.grid_code = jg.grid_code AND jg.is_deleted = 0
        LEFT JOIN jczz_police_affairs_grid jpag ON jp.jw_grid_code = jpag.jw_grid_code AND jpag.is_deleted = 0
        WHERE jpe.is_deleted = 0
        and jp.place_name != ''
        <if test="isAdministrator==2">
            <choose>
                <when test="placeExt.roleName != null and placeExt.roleName != ''">
                    <if test="placeExt.roleName=='wgy'">
                        <choose>
                            <when test="gridCodeList !=null and gridCodeList.size()>0">
                                and jp.grid_code in
                                <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
                                    #{code}
                                </foreach>
                            </when>
                            <otherwise>
                                and jp.grid_code in ('')
                            </otherwise>
                        </choose>
                    </if>
                    <if test="placeExt.roleName=='mj'">
                        <choose>
                            <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                                and jpag.community_code in
                                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                    #{code}
                                </foreach>
                            </when>
                            <otherwise>
                                and jpag.community_code in ('')
                            </otherwise>
                        </choose>
                    </if>
                </when>
                <otherwise>
                    <choose>
                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                            and
                            (
                            jg.grid_code in
                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                #{code}
                            </foreach>
                            or
                            jpag.community_code in
                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                #{code}
                            </foreach>
                            )
                        </when>
                        <otherwise>
                            and
                            (
                            jg.grid_code in ('') or jpag.community_code in ('')
                            )
                        </otherwise>
                    </choose>
                </otherwise>
            </choose>
        </if>
        <if test="placeExt.placeName != null and placeExt.placeName != ''">
            and jp.place_name like concat('%',#{placeExt.placeName},'%')
        </if>
        <if test="placeExt.communityCode != null and placeExt.communityCode != ''">
            and jpag.community_code like concat('%',#{placeExt.communityCode},'%')
        </if>
        <if test="placeExt.placeId != null">
            and jp.id = #{placeExt.placeId}
        </if>
        <if test="placeExt.isApp != null">
            and jpe.confirm_flag != 4
        </if>
        <if test="placeExt.houseCode != null and placeExt.houseCode != ''">
            and jp.house_code like concat('%',#{placeExt.houseCode},'%')
        </if>
        <if test="placeExt.confirmFlag != null">
            and jpe.confirm_flag = #{placeExt.confirmFlag}
        </if>
        <if test="placeExt.startTime != null and placeExt.startTime != '' and placeExt.endTime != null and placeExt.endTime != '' ">
            AND jpe.create_time BETWEEN #{placeExt.startTime} and #{placeExt.endTime}
        </if>
        order by jpe.create_time desc,jpe.id desc
    </select>
 
    <!--场所审核统计-->
    <select id="selectCount" resultType="java.lang.Integer">
        SELECT
        count( 1 )
        FROM
        jczz_place_ext jpe
        LEFT JOIN jczz_place jp ON jpe.place_id = jp.id AND jp.is_deleted = 0 and jp.place_name != ''
        LEFT JOIN jczz_grid jg ON jp.grid_code = jg.grid_code AND jg.is_deleted = 0
        LEFT JOIN jczz_police_affairs_grid jpag ON jp.jw_grid_code = jpag.jw_grid_code AND jpag.is_deleted = 0
        LEFT JOIN jczz_doorplate_address jda ON jp.house_code = jda.address_code
        <where>
            <if test="placeExt.neiCode != null and placeExt.neiCode != ''">
               and jpag.community_code like concat('%',#{placeExt.neiCode},'%')
            </if>
 
            <if test="placeExt.confirmFlag != null">
                and jpe.confirm_flag = #{placeExt.confirmFlag}
            </if>
            <if test="isAdministrator==2">
                <choose>
                    <when test="placeExt.roleName != null and placeExt.roleName != ''">
                        <if test="placeExt.roleName=='wgy'">
                            <choose>
                                <when test="gridCodeList !=null and gridCodeList.size()>0">
                                    and jp.grid_code in
                                    <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
                                        #{code}
                                    </foreach>
                                </when>
                                <otherwise>
                                    and jp.grid_code in ('')
                                </otherwise>
                            </choose>
                        </if>
                        <if test="placeExt.roleName=='mj'">
                            <choose>
                                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                                    and jpag.community_code in
                                    <foreach collection="regionChildCodesList" item="code" open="(" close=")"
                                             separator=",">
                                        #{code}
                                    </foreach>
                                </when>
                                <otherwise>
                                    and jpag.community_code in ('')
                                </otherwise>
                            </choose>
                        </if>
                    </when>
                    <otherwise>
                        <choose>
                            <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                                and
                                (
                                jg.grid_code in
                                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                    #{code}
                                </foreach>
                                or
                                jpag.community_code in
                                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                    #{code}
                                </foreach>
                                )
                            </when>
                            <otherwise>
                                and
                                (
                                jg.grid_code in ('') or jpag.community_code in ('')
                                )
                            </otherwise>
                        </choose>
                    </otherwise>
                </choose>
            </if>
            and jpe.is_deleted = 0
        </where>
 
 
    </select>
 
    <select id="getDetail" resultType="org.springblade.modules.place.vo.PlaceExtVO">
        select jpe.*,
               jp.place_name as placeName,
               jp.lng,
               jp.lat,
               jp.location
        from jczz_place_ext jpe
                 left join jczz_place jp on jpe.place_id = jp.id and jp.is_deleted = 0
        where jpe.is_deleted = 0
          and jpe.place_id = #{placeExt.placeId}
    </select>
 
    <resultMap type="org.springblade.modules.place.dto.PlaceExtDTO" id="JczzPlaceExtDTOResult">
        <result property="id"    column="id"    />
        <result property="placeId"    column="place_id"    />
        <result property="imageUrls"    column="image_urls"    />
        <result property="legalPerson"    column="legal_person"    />
        <result property="legalTel"    column="legal_tel"    />
        <result property="planImageUrls"    column="plan_image_urls"    />
        <result property="confirmUserId"    column="confirm_user_id"    />
        <result property="confirmFlag"    column="confirm_flag"    />
        <result property="confirmTime"    column="confirm_time"    />
        <result property="confirmNotion"    column="confirm_notion"    />
        <result property="createUser"    column="create_user"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateUser"    column="update_user"    />
        <result property="updateTime"    column="update_time"    />
        <result property="isDeleted"    column="is_deleted"    />
<!--        <result property="legalTempAddress"    column="legal_temp_address"    />-->
<!--        <result property="legalAge"    column="legal_age"    />-->
<!--        <result property="legalGender"    column="legal_gender"    />-->
<!--        <result property="legalIdCard"    column="legal_id_card"    />-->
<!--        <result property="legalCardType"    column="legal_card_type"    />-->
<!--        <result property="legalRegisteredAddress"    column="legal_registered_address"    />-->
<!--        <result property="legalJobNature"    column="legal_job_nature"    />-->
<!--        <result property="legalWxAccount"    column="legal_wx_account"    />-->
<!--        <result property="birthday"    column="birthday"    />-->
<!--        <result property="ethnicity"    column="ethnicity"    />-->
<!--        <result property="employer"    column="employer"    />-->
    </resultMap>
 
    <sql id="selectJczzPlaceExt">
        select
            id,
            place_id,
            image_urls,
            legal_person,
            legal_tel,
            plan_image_urls,
            confirm_user_id,
            confirm_flag,
            confirm_time,
            confirm_notion,
            create_user,
            create_time,
            update_user,
            update_time,
            is_deleted
        from
            jczz_place_ext
    </sql>
 
<!--    <select id="selectJczzPlaceExtById" parameterType="long" resultMap="JczzPlaceExtDTOResult">-->
<!--        <include refid="selectJczzPlaceExt"/>-->
<!--        where-->
<!--        id = #{id}-->
<!--    </select>-->
 
<!--    <select id="selectJczzPlaceExtList" parameterType="jczzplaceext.dto.JczzPlaceExtDTO" resultMap="JczzPlaceExtDTOResult">-->
<!--        <include refid="selectJczzPlaceExt"/>-->
<!--        <where>-->
<!--            <if test="id != null "> and id = #{id}</if>-->
<!--            <if test="placeId != null "> and place_id = #{placeId}</if>-->
<!--            <if test="imageUrls != null  and imageUrls != ''"> and image_urls = #{imageUrls}</if>-->
<!--            <if test="legalPerson != null  and legalPerson != ''"> and legal_person = #{legalPerson}</if>-->
<!--            <if test="legalTel != null  and legalTel != ''"> and legal_tel = #{legalTel}</if>-->
<!--            <if test="planImageUrls != null  and planImageUrls != ''"> and plan_image_urls = #{planImageUrls}</if>-->
<!--            <if test="confirmUserId != null "> and confirm_user_id = #{confirmUserId}</if>-->
<!--            <if test="confirmFlag != null "> and confirm_flag = #{confirmFlag}</if>-->
<!--            <if test="confirmTime != null "> and confirm_time = #{confirmTime}</if>-->
<!--            <if test="confirmNotion != null  and confirmNotion != ''"> and confirm_notion = #{confirmNotion}</if>-->
<!--            <if test="createUser != null "> and create_user = #{createUser}</if>-->
<!--            <if test="createTime != null "> and create_time = #{createTime}</if>-->
<!--            <if test="updateUser != null "> and update_user = #{updateUser}</if>-->
<!--            <if test="updateTime != null "> and update_time = #{updateTime}</if>-->
<!--            <if test="isDeleted != null "> and is_deleted = #{isDeleted}</if>-->
<!--            <if test="legalTempAddress != null  and legalTempAddress != ''"> and legal_temp_address = #{legalTempAddress}</if>-->
<!--            <if test="legalAge != null "> and legal_age = #{legalAge}</if>-->
<!--            <if test="legalGender != null "> and legal_gender = #{legalGender}</if>-->
<!--            <if test="legalIdCard != null  and legalIdCard != ''"> and legal_id_card = #{legalIdCard}</if>-->
<!--            <if test="legalCardType != null  and legalCardType != ''"> and legal_card_type = #{legalCardType}</if>-->
<!--            <if test="legalRegisteredAddress != null  and legalRegisteredAddress != ''"> and legal_registered_address = #{legalRegisteredAddress}</if>-->
<!--            <if test="legalJobNature != null  and legalJobNature != ''"> and legal_job_nature = #{legalJobNature}</if>-->
<!--            <if test="legalWxAccount != null  and legalWxAccount != ''"> and legal_wx_account = #{legalWxAccount}</if>-->
<!--        </where>-->
<!--    </select>-->
 
 
</mapper>