From a221c564aa5f3e6b22bed25d789b79c5d6c4e643 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Thu, 21 Dec 2023 18:17:53 +0800
Subject: [PATCH] 物业查询报错问题

---
 src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml b/src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml
index b97c3b2..028ca06 100644
--- a/src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml
+++ b/src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml
@@ -33,6 +33,66 @@
         <if test="gridman.gridId!=null">
             and jg.id = #{gridman.gridId}
         </if>
+        <if test="gridman.communityCode!=null and gridman.communityCode!=''">
+            and jg.community_code like concat('%',#{gridman.communityCode},'%')
+        </if>
+    </select>
+
+    <!--自定义分页查询-->
+    <select id="getGridmanList" resultType="org.springblade.modules.grid.vo.GridmanVO">
+        select
+        jgm.*
+        from jczz_gridman jgm
+        where jgm.is_deleted = 0
+        <if test="gridman.gridmanName!=null and gridman.gridmanName!=''">
+            and jgm.gridman_name like concat('%',#{gridman.gridmanName},'%')
+        </if>
+        <if test="gridman.mobile!=null and gridman.mobile!=''">
+            and jgm.mobile like concat('%',#{gridman.mobile},'%')
+        </if>
+    </select>
+
+    <select id="getGridStatistics" resultType="java.lang.Integer">
+        SELECT count(1) number
+        FROM jczz_grid jg
+                 LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
+        WHERE jg.community_code = #{code}
+          AND jg.is_deleted = 0
+        <if test="userId!=null">
+          and jgm.user_id= #{userId}
+        </if>
+    </select>
+
+    <select id="getCompanyStatistics" resultType="java.lang.Integer">
+
+        SELECT
+        count(1)
+        FROM
+        jczz_property_company_district jpcd
+        LEFT JOIN jczz_district jd ON jd.id = jpcd.district_id
+        WHERE
+        jd.community_code = #{code}
+        and jpcd.is_deleted= 0
+        <if test="userId!=null">
+            AND EXISTS (
+            SELECT
+            jda.aoi_code
+            FROM
+            jczz_grid jg
+            LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
+            LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+            LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jgr.house_code
+            WHERE
+            jgm.user_id = #{userId}
+            AND jg.is_deleted = 0
+            AND jd.aoi_code = jda.aoi_code
+            AND jda.aoi_code IS NOT NULL
+            GROUP BY
+            jda.aoi_code
+            )
+        </if>
+
+
     </select>
 
 

--
Gitblit v1.9.3