From 2bd69d1dca40d2fdf07f72e0117d2f0febde5359 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Sat, 23 Dec 2023 15:27:02 +0800
Subject: [PATCH] 新增民警楼盘,功能数据过滤

---
 src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml |   26 +++++++++++++++++++++++---
 1 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml b/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml
index 5eb0894..89d0bec 100644
--- a/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml
+++ b/src/main/java/org/springblade/modules/place/mapper/PlaceMapper.xml
@@ -17,11 +17,15 @@
         jp.*,
         bu.real_name as username,bu.phone as phone,
         bx.real_name as createUserName,
+        br.town_name as townStreetName,br.name as neiName,
         jpe.confirm_flag confirmFlag
         from jczz_place jp
         left join blade_user bu on bu.id = jp.principal_user_id and bu.is_deleted = 0
         left join blade_user bx on bx.id = jp.create_user and bx.is_deleted = 0
         LEFT JOIN jczz_place_ext jpe on jpe.place_id=jp.id
+        left join jczz_grid_range jgr on jgr.house_code = jp.house_code
+        left join jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0
+        left join blade_region br on br.code = jg.community_code
         left join (
         select a.* from jczz_place_poi_label a inner join
         (
@@ -29,7 +33,7 @@
         ) b on a.id = b.id
         ) jppl on jppl.place_id = jp.id
         where jp.is_deleted = 0
-        <if test="place.roleName!=null and place.roleName!=''">
+        <if test="place.roleName!=null and place.roleName!='' and place.createUser!=null">
             <choose>
                 <when test="place.roleName=='网格员'">
                     and
@@ -56,6 +60,18 @@
         </if>
         <if test="place.principalPhone!=null and place.principalPhone!=''">
             and jp.principal_phone like concat('%',#{place.principalPhone},'%')
+        </if>
+        <if test="place.houseCode!=null and place.houseCode!=''">
+            and jp.house_code = #{place.houseCode}
+        </if>
+        <if test="place.townStreetName!=null and place.townStreetName!=''">
+            and br.town_name like concat('%',#{place.townStreetName},'%')
+        </if>
+        <if test="place.neiName!=null and place.neiName!=''">
+            and br.name like concat('%',#{place.neiName},'%')
+        </if>
+        <if test="place.id!=null">
+            and jp.id = #{place.id}
         </if>
         <if test="place.isPerfect==1">
             and
@@ -122,11 +138,15 @@
         select
         jp.*,
         bu.real_name as username,bu.phone as phone,
-        jppl.id as plid,jppl.*,jcl.category_name as labelName
+        jppl.id as plid,jppl.*,jc.category_name as labelName,
+        br.code as neiCode,jg.id as gridId
         from jczz_place jp
         left join blade_user bu on bu.id = jp.principal_user_id and bu.is_deleted = 0
         left join jczz_place_poi_label jppl on jppl.place_id = jp.id
-        left join jczz_category_label jcl on jcl.category_no = jppl.poi_code
+        left join jczz_category jc on jc.category_no = jppl.poi_code
+        left join jczz_grid_range jgr on jgr.house_code = jp.house_code
+        left join jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0
+        left join blade_region br on br.code = jg.community_code
         where jp.is_deleted = 0
         <if test="place.houseCode!=null and place.houseCode!=''">
             and jp.house_code = #{place.houseCode}

--
Gitblit v1.9.3