From 8b7258c9427882bb1798f1502eaa35184c6e374e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 09 Aug 2024 14:29:18 +0800
Subject: [PATCH] 短信指定楼栋发送

---
 src/main/java/org/springblade/modules/district/mapper/DistrictMapper.xml |   92 +++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 83 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/springblade/modules/district/mapper/DistrictMapper.xml b/src/main/java/org/springblade/modules/district/mapper/DistrictMapper.xml
index 985fc29..48790f9 100644
--- a/src/main/java/org/springblade/modules/district/mapper/DistrictMapper.xml
+++ b/src/main/java/org/springblade/modules/district/mapper/DistrictMapper.xml
@@ -5,7 +5,7 @@
     <!-- 通用查询映射结果 -->
     <resultMap id="districtResultMap" type="org.springblade.modules.district.entity.DistrictEntity">
         <result column="id" property="id"/>
-        <result column="aoi_cdoe" property="aoiCdoe"/>
+        <result column="aoi_code" property="aoiCode"/>
         <result column="community_code" property="communityCode"/>
         <result column="name" property="name"/>
         <result column="address" property="address"/>
@@ -21,13 +21,36 @@
 
     <!--自定义分页-->
     <select id="selectDistrictPage" resultType="org.springblade.modules.district.vo.DistrictVO">
-        select * from jczz_district
-        where is_deleted = 0
+        select
+        jd.*,
+        br.village_name as communityName,br.town_name as townStreetName
+        from jczz_district jd
+        left join blade_region br on br.code = jd.community_code
+        where jd.is_deleted = 0
         <if test="district.name !=null and district.name !=''">
-            and name like concat('%',#{district.name},'%')
+            and jd.name like concat('%',#{district.name},'%')
+        </if>
+        <if test="district.communityName !=null and district.communityName !=''">
+            and br.village_name like concat('%', #{district.communityName},'%')
         </if>
         <if test="district.communityCode !=null and district.communityCode !=''">
-            and community_code = #{district.communityCode}
+            and jd.community_code = #{district.communityCode}
+        </if>
+        <if test="district.townStreetName !=null and district.townStreetName !=''">
+            and br.town_name like concat('%',#{district.townStreetName},'%')
+        </if>
+        <if test="isAdministrator==2">
+            <choose>
+                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                    and jd.community_code in
+                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                        #{code}
+                    </foreach>
+                </when>
+                <otherwise>
+                    and jd.community_code in ('')
+                </otherwise>
+            </choose>
         </if>
     </select>
 
@@ -36,18 +59,69 @@
         SELECT
         code as id,
         parent_code as parentId,
-        name
-        FROM blade_region where district_code = '361102'
+        name,
+        remark aoiCode
+        FROM blade_region where district_code like concat('361102','%')
+        <if test="isAdministrator==2">
+            <choose>
+                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                    and code in
+                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                        #{code}
+                    </foreach>
+                </when>
+                <otherwise>
+                    and code in ('')
+                </otherwise>
+            </choose>
+        </if>
         union all
         (
         select
         id,
         community_code as parentId,
-        name
+        name,
+        aoi_code aoiCode
         from jczz_district
-        where is_deleted = 0
+        where is_deleted = 0 and community_code like concat('361102','%')
+        <if test="district.districtIdList!=null and district.districtIdList.size() > 0">
+            and id in
+            <foreach collection="district.districtIdList" item="item" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="isAdministrator==2">
+            <choose>
+                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                    and community_code in
+                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                        #{code}
+                    </foreach>
+                </when>
+                <otherwise>
+                    and community_code in ('')
+                </otherwise>
+            </choose>
+        </if>
         )
     </select>
 
+    <!--小区自定义获取详情查询-->
+    <select id="getDetail" resultType="org.springblade.modules.district.vo.DistrictVO">
+        SELECT jd.*,
+               jda.nei_code as communityCode,
+               jda.nei_name as communityName,
+               jpo.organization_name,
+               jpo.organization_type,
+               jpo.branch_type,
+               jpo.charge_person,
+               jpo.phone
+        FROM jczz_district jd
+                 left join jczz_doorplate_address jda on jda.aoi_code = jd.aoi_code
+                 LEFT JOIN jczz_party_organization jpo on jpo.area_id = jda.nei_code and jpo.is_deleted=0
+        where jd.is_deleted = 0
+          and jda.address_code = #{district.houseCode}
+    </select>
+
 
 </mapper>

--
Gitblit v1.9.3