From 861e9b1eb145094dff6d1caf3dba30d7ce0e11d7 Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Sat, 02 Mar 2024 17:40:38 +0800
Subject: [PATCH] 房屋查询过滤
---
src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml | 146 +++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 124 insertions(+), 22 deletions(-)
diff --git a/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml b/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
index dc366bc..784962a 100644
--- a/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
+++ b/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
@@ -164,6 +164,7 @@
LEFT JOIN jczz_house jhs ON jh.house_code = jhs.house_code and jhs.is_deleted = 0
LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code
LEFT JOIN jczz_grid jg on jg.grid_code = jhs.grid_code and jg.is_deleted = 0
+ LEFT JOIN jczz_police_affairs_grid jpag on jhs.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
<where>
<if test="household.userId!=null">
AND jg.grid_code IN ( SELECT DISTINCT jgm.grid_code FROM jczz_gridman jgm WHERE jgm.user_id =
@@ -202,17 +203,71 @@
</if>
<if test="isAdministrator==2">
<choose>
- <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
- and jg.community_code in
- <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
- #{code}
- </foreach>
+ <when test="household.roleName != null and household.roleName != ''">
+ <if test="household.roleName=='wgy'">
+ <choose>
+ <when test="gridCodeList !=null and gridCodeList.size()>0">
+ and jhs.grid_code in
+ <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ </when>
+ <otherwise>
+ and jhs.grid_code in ('')
+ </otherwise>
+ </choose>
+ </if>
+ <if test="household.roleName=='mj'">
+ <choose>
+ <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+ and jpag.community_code in
+ <foreach collection="regionChildCodesList" item="code" open="(" close=")"
+ separator=",">
+ #{code}
+ </foreach>
+ </when>
+ <otherwise>
+ and jpag.community_code in ('')
+ </otherwise>
+ </choose>
+ </if>
</when>
<otherwise>
- and jg.community_code in ('')
+ <choose>
+ <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+ and
+ (
+ jg.grid_code in
+ <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ or
+ jpag.community_code in
+ <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ )
+ </when>
+ <otherwise>
+
+ </otherwise>
+ </choose>
</otherwise>
</choose>
</if>
+<!-- <if test="isAdministrator==2">-->
+<!-- <choose>-->
+<!-- <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">-->
+<!-- and jg.community_code in-->
+<!-- <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">-->
+<!-- #{code}-->
+<!-- </foreach>-->
+<!-- </when>-->
+<!-- <otherwise>-->
+<!-- and jg.community_code in ('')-->
+<!-- </otherwise>-->
+<!-- </choose>-->
+<!-- </if>-->
<if test="household.building!=null and household.building!=''">
and jhs.building like concat(#{household.building},'%')
</if>
@@ -461,28 +516,75 @@
<select id="statistics" resultType="java.lang.Integer">
SELECT
- count( 1 )
+ count(1)
FROM
jczz_household jh
- LEFT JOIN jczz_doorplate_address jda ON jh.house_code = jda.address_code
+ LEFT JOIN jczz_house jhs ON jh.house_code = jhs.house_code and jhs.is_deleted = 0
+ LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code
+ LEFT JOIN jczz_grid jg on jg.grid_code = jhs.grid_code and jg.is_deleted = 0
+ LEFT JOIN jczz_police_affairs_grid jpag on jhs.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
<where>
- <if test="neiCode != null and neiCode != ''">
- and jda.nei_code = #{neiCode}
+ <if test="household.neiCode != null and household.neiCode != ''">
+ and jda.nei_code = #{household.neiCode}
</if>
- <if test="userId != null">
- AND jh.house_code IN (
- SELECT
- jgr.house_code
- FROM
- jczz_grid_range jgr
- LEFT JOIN jczz_grid jg ON jg.id = jgr.grid_id
- LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
- WHERE
- jg.is_deleted = 0
- AND jgm.user_id = #{userId} )
+ <if test="household.confirmFlag != null and household.confirmFlag != ''">
+ and jh.confirm_flag = #{household.confirmFlag}
+ </if>
+ <if test="isAdministrator==2">
+ <choose>
+ <when test="household.roleName != null and household.roleName != ''">
+ <if test="household.roleName=='wgy'">
+ <choose>
+ <when test="gridCodeList !=null and gridCodeList.size()>0">
+ and jhs.grid_code in
+ <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ </when>
+ <otherwise>
+ and jhs.grid_code in ('')
+ </otherwise>
+ </choose>
+ </if>
+ <if test="household.roleName=='mj'">
+ <choose>
+ <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+ and jpag.community_code in
+ <foreach collection="regionChildCodesList" item="code" open="(" close=")"
+ separator=",">
+ #{code}
+ </foreach>
+ </when>
+ <otherwise>
+ and jpag.community_code in ('')
+ </otherwise>
+ </choose>
+ </if>
+ </when>
+ <otherwise>
+ <choose>
+ <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+ and
+ (
+ jg.grid_code in
+ <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ or
+ jpag.community_code in
+ <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ )
+ </when>
+ <otherwise>
+
+ </otherwise>
+ </choose>
+ </otherwise>
+ </choose>
</if>
and jh.is_deleted = 0
- and jh.confirm_flag = 0
</where>
</select>
--
Gitblit v1.9.3