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/grid/mapper/GridmanMapper.xml |   67 +++++++++++++++++++++++++++++++++
 1 files changed, 67 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..85fed75 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,73 @@
         <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_gridman jgm
+        LEFT JOIN jczz_grid jg  ON jg.id = jgm.grid_id
+        WHERE jg.community_code = #{code}
+        AND jg.is_deleted = 0
+        <if test="userId!=null and roleType == '1'">
+          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 roleType == '1'">
+            AND jd.aoi_code in (
+            SELECT distinct
+            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 jda.aoi_code IS NOT NULL
+            )
+        </if>
+
+        <if test="userId != null and roleType == '3'">
+            AND jd.aoi_code IN (SELECT
+            jda.aoi_code
+            FROM
+            jczz_doorplate_address jda
+            LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code
+            WHERE
+            jc.res_police_user_id = #{userId})
+            )
+        </if>
+
+
     </select>
 
 

--
Gitblit v1.9.3