From d0b0e00e40226700a0ffa1f1671a8dc273610f67 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Mon, 18 Dec 2023 14:28:10 +0800
Subject: [PATCH] 菜单分类优化

---
 src/main/java/org/springblade/modules/grid/mapper/GridMapper.xml |   56 +++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 43 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..cfed231 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,48 @@
 
     <!--网格树-->
     <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>
+
+
 </mapper>

--
Gitblit v1.9.3