From 7c533d448acabda7ec92d75757d760b447e41f00 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Wed, 20 Dec 2023 14:53:46 +0800
Subject: [PATCH] 单元展示排序

---
 src/main/java/org/springblade/modules/grid/mapper/GridMapper.xml |   65 ++++++++++++++++++++++++++------
 1 files changed, 52 insertions(+), 13 deletions(-)

diff --git a/src/main/java/org/springblade/modules/grid/mapper/GridMapper.xml b/src/main/java/org/springblade/modules/grid/mapper/GridMapper.xml
index e125ce7..aaa8961 100644
--- a/src/main/java/org/springblade/modules/grid/mapper/GridMapper.xml
+++ b/src/main/java/org/springblade/modules/grid/mapper/GridMapper.xml
@@ -32,6 +32,7 @@
         left join blade_user bu on bu.id = jgm.user_id and bu.is_deleted = 0
         where jg.is_deleted = 0
         and jgr.house_code = #{houseCode}
+        limit 1
     </select>
 
     <!--根据用户id(网格员)查询对应的房屋地址code-->
@@ -86,19 +87,57 @@
 
     <!--网格树-->
     <select id="getGridTree" resultType="org.springblade.common.node.TreeStringNode">
-        SELECT
-        code as id,
-        parent_code as parentId,
-        name
-        FROM blade_region where district_code = '361102'
+        SELECT code        as id,
+               parent_code as parentId,
+               name
+        FROM blade_region
+        where district_code = '361102'
         union all
-        (
-        select
-        id,
-        community_code as parentId,
-        grid_name as name
-        from jczz_grid
-        where is_deleted = 0
-        )
+        (select id,
+                community_code as parentId,
+                grid_name      as name
+         from jczz_grid
+         where is_deleted = 0)
     </select>
+    <select id="gridInfo" resultType="org.springblade.modules.grid.entity.GridmanEntity">
+        SELECT jg.id,
+               jg.grid_name,
+               jgm.pic_url,
+               jgm.mobile,
+               jgm.gridman_name
+        FROM jczz_grid jg
+                 LEFT JOIN jczz_gridman jgm ON jgm.grid_id = jg.id
+                 LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+        WHERE jgr.house_code = #{houseCode}
+          AND jg.is_deleted = '0'
+          AND jgm.is_deleted = '0'
+    </select>
+
+
+    <select id="gridAoiName"
+            resultType="org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity">
+        SELECT aoi_name,
+               GROUP_CONCAT(building_name) building_name
+        FROM (SELECT DISTINCT aoi_name,
+                              building_name
+              FROM jczz_doorplate_address
+              WHERE address_code IN (SELECT jgr.house_code
+                                     FROM jczz_grid jg
+                                              LEFT JOIN jczz_gridman jgm ON jgm.grid_id = jg.id
+                                              LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+                                     WHERE jg.id = #{id})) a
+        GROUP BY aoi_name
+
+    </select>
+
+    <!--网格集合查询-->
+    <select id="getGridList" resultType="org.springblade.modules.grid.entity.GridEntity">
+        SELECT * from jczz_grid
+        where is_deleted = 0
+        <if test="grid.communityCode!=null and grid.communityCode!=''">
+            and community_code = #{grid.communityCode}
+        </if>
+        order by sort asc
+    </select>
+
 </mapper>

--
Gitblit v1.9.3