From 02239b141ffa6cb972fffc9e16d78ebbca314c57 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Tue, 12 Mar 2024 17:48:57 +0800
Subject: [PATCH] 房屋导入修改(地址设置)

---
 src/main/java/org/springblade/modules/place/mapper/PlaceExtMapper.xml |  189 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 188 insertions(+), 1 deletions(-)

diff --git a/src/main/java/org/springblade/modules/place/mapper/PlaceExtMapper.xml b/src/main/java/org/springblade/modules/place/mapper/PlaceExtMapper.xml
index 2dd3b8c..b6e9864 100644
--- a/src/main/java/org/springblade/modules/place/mapper/PlaceExtMapper.xml
+++ b/src/main/java/org/springblade/modules/place/mapper/PlaceExtMapper.xml
@@ -2,9 +2,196 @@
 <!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 * from jczz_place_ext where is_deleted = 0
+        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 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 jda.nei_code = #{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 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>
 
 

--
Gitblit v1.9.3