From 87c81cb045fb89a74901613405e6c4ccf4bd03bd Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Fri, 12 Jan 2024 11:43:45 +0800
Subject: [PATCH] 住户+居民管理
---
src/main/java/org/springblade/modules/house/mapper/UserHouseLabelMapper.xml | 419 ++++++++++++++++++++---------------------
src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml | 24 +
src/main/java/org/springblade/modules/house/vo/HouseVO.java | 10
src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml | 90 +++++---
4 files changed, 290 insertions(+), 253 deletions(-)
diff --git a/src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml b/src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml
index 7d2e8d3..81a1a44 100644
--- a/src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml
+++ b/src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml
@@ -141,39 +141,63 @@
left join jczz_grid_range jgr on jgr.house_code = jh.house_code
left join jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0
left join blade_region br on br.code = jg.community_code
- where jh.is_deleted = 0
- <if test="house.id != null ">and jh.id = #{house.id}</if>
- <if test="house.streetCode != null and house.streetCode != ''">
- and jda.town_street_code like concat('%',#{house.streetCode},'%')
- </if>
- <if test="house.houseCode != null and house.houseCode != ''">and jh.house_code = #{house.houseCode}</if>
- <if test="house.districtCode != null and house.districtCode != ''">and jh.district_code =
- #{house.districtCode}
- </if>
- <if test="house.districtName != null and house.districtName != ''">
- and jh.district_name like concat('%',#{house.districtName},'%')
- </if>
- <if test="house.townStreetName!=null and house.townStreetName!=''">
- and br.town_name like concat('%',#{house.townStreetName},'%')
- </if>
- <if test="house.neiName!=null and house.neiName!=''">
- and br.name like concat('%',#{house.neiName},'%')
- </if>
- <if test="house.houseName != null and house.houseName != ''">and jh.house_name like
- concat('%',#{house.houseName},'%')
- </if>
- <if test="house.phone != null and house.phone != ''">and jh.phone = #{house.phone}</if>
- <if test="house.area != null ">and jh.area = #{house.area}</if>
- <if test="house.propertyPrice != null ">and jh.property_price = #{house.propertyPrice}</if>
- <if test="house.serviceDue != null ">and jh.service_due = #{house.serviceDue}</if>
- <if test="house.floor != null ">and jh.floor = #{house.floor}</if>
- <if test="house.building != null and house.building != ''">and jh.building = #{house.building}</if>
- <if test="house.unit != null and house.unit != ''">and jh.unit = #{house.unit}</if>
- <if test="house.room != null and house.room != ''">and jh.room = #{house.room}</if>
- <if test="house.buildingNo != null ">and jh.building_no = #{house.buildingNo}</if>
- <if test="house.regionCode != null and house.regionCode !='' ">
- and jg.community_code like concat('%',#{house.regionCode},'%')
- </if>
+ <where>
+ <if test="house.id != null ">and jh.id = #{house.id}</if>
+ <if test="house.streetCode != null and house.streetCode != ''">
+ and jda.town_street_code like concat('%',#{house.streetCode},'%')
+ </if>
+ <if test="house.houseCode != null and house.houseCode != ''">and jh.house_code = #{house.houseCode}</if>
+ <if test="house.districtCode != null and house.districtCode != ''">and jh.district_code =
+ #{house.districtCode}
+ </if>
+ <if test="house.districtName != null and house.districtName != ''">
+ and jh.district_name like concat('%',#{house.districtName},'%')
+ </if>
+ <if test="house.townStreetName!=null and house.townStreetName!=''">
+ and br.town_name like concat('%',#{house.townStreetName},'%')
+ </if>
+ <if test="house.neiName!=null and house.neiName!=''">
+ and br.name like concat('%',#{house.neiName},'%')
+ </if>
+ <if test="house.houseName != null and house.houseName != ''">and jh.house_name like
+ concat('%',#{house.houseName},'%')
+ </if>
+ <if test="house.phone != null and house.phone != ''">and jh.phone = #{house.phone}</if>
+ <if test="house.area != null ">and jh.area = #{house.area}</if>
+ <if test="house.propertyPrice != null ">and jh.property_price = #{house.propertyPrice}</if>
+ <if test="house.serviceDue != null ">and jh.service_due = #{house.serviceDue}</if>
+ <if test="house.floor != null ">and jh.floor = #{house.floor}</if>
+ <if test="house.building != null and house.building != ''">and jh.building = #{house.building}</if>
+ <if test="house.unit != null and house.unit != ''">and jh.unit = #{house.unit}</if>
+ <if test="house.room != null and house.room != ''">and jh.room = #{house.room}</if>
+ <if test="house.buildingNo != null ">and jh.building_no = #{house.buildingNo}</if>
+ <if test="house.regionCode != null and house.regionCode !='' ">
+ and jg.community_code like concat('%',#{house.regionCode},'%')
+ </if>
+ <if test="house.parentId != null ">
+ and jh.house_code in (
+ SELECT DISTINCT
+ juhl.house_code
+ FROM
+ jczz_user_house_label juhl
+ LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
+ WHERE
+ juhl.lable_type = 2
+ <if test="house.labelId != null ">
+ AND jl.id = #{house.labelId}
+ </if>
+ <if test="house.parentId != null ">
+ AND jl.parent_id = #{house.parentId}
+ </if>
+ AND juhl.label_id IS NOT NULL
+ )
+ </if>
+ and jh.is_deleted = 0
+ ORDER BY
+ jh.update_time DESC
+ </where>
+
+
</select>
<!--房屋自定义详情查询-->
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 00a1ac9..8174be5 100644
--- a/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
+++ b/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
@@ -828,17 +828,20 @@
<if test="household.aoiCode!=null and household.aoiCode!=''">
and jhs.district_code = #{household.aoiCode}
</if>
- AND EXISTS (
- SELECT
- *
+ and jh.id in (
+ SELECT DISTINCT
+ juhl.household_id
FROM
jczz_user_house_label juhl
LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
WHERE
juhl.lable_type = 1
- AND jl.id = #{household.labelId}
- AND jl.parent_id = #{household.parentId}
- AND juhl.household_id = jh.id
+ <if test="household.labelId != null ">
+ AND jl.id = #{household.labelId}
+ </if>
+ <if test="household.parentId != null ">
+ AND jl.parent_id = #{household.parentId}
+ </if>
AND juhl.label_id IS NOT NULL
)
and jh.is_deleted = 0
@@ -854,7 +857,8 @@
and juhl.lable_type = 1
and juhl.color = '#30D17C'
and jh.id in (
- select household_id from jczz_grid_work_log where is_deleted = 0 and source = 2 and TIMESTAMPDIFF( day, now(), create_time )=30
+ select household_id from jczz_grid_work_log where is_deleted = 0 and source = 2 and TIMESTAMPDIFF( day, now(),
+ create_time )=30
)
<choose>
<when test="list!=null and list.size()>0">
@@ -875,7 +879,8 @@
and juhl.lable_type = 1
and juhl.color = '#FFB42B'
and jh.id in (
- select household_id from jczz_grid_work_log where is_deleted = 0 and source = 2 and TIMESTAMPDIFF( day, now(), create_time )=14
+ select household_id from jczz_grid_work_log where is_deleted = 0 and source = 2 and TIMESTAMPDIFF( day, now(),
+ create_time )=14
)
<choose>
<when test="list!=null and list.size()>0">
@@ -897,7 +902,8 @@
and juhl.lable_type = 1
and juhl.color = '#EA1F1F'
and jh.id in (
- select household_id from jczz_grid_work_log where is_deleted = 0 and source = 2 and TIMESTAMPDIFF( day, now(), create_time )=7
+ select household_id from jczz_grid_work_log where is_deleted = 0 and source = 2 and TIMESTAMPDIFF( day, now(),
+ create_time )=7
)
<choose>
<when test="list!=null and list.size()>0">
diff --git a/src/main/java/org/springblade/modules/house/mapper/UserHouseLabelMapper.xml b/src/main/java/org/springblade/modules/house/mapper/UserHouseLabelMapper.xml
index d815b73..d9f3a63 100644
--- a/src/main/java/org/springblade/modules/house/mapper/UserHouseLabelMapper.xml
+++ b/src/main/java/org/springblade/modules/house/mapper/UserHouseLabelMapper.xml
@@ -86,221 +86,220 @@
<select id="statisticalLabels" resultType="org.springblade.modules.house.vo.HouseholdLabelVO"
parameterType="org.springblade.modules.house.vo.HouseholdLabelVO">
- SELECT
- br.region_level,
- br.`code` regionCode,
- br.NAME regionName,
- (
- SELECT
- count( 1 )
- FROM
- jczz_user_house_label juhl
- LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
- WHERE
- juhl.lable_type = 1
- AND jl.id = '19'
- AND juhl.household_id IS NOT NULL
- AND juhl.house_code IN (
- SELECT
- jgr.house_code
- FROM
- jczz_grid jg
- LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
- LEFT JOIN jczz_community jc on jc.`code` = jg.community_code
- WHERE
- br.`code` = jc.`street_code`
- )) number1,(
- SELECT
- count( 1 )
- FROM
- jczz_user_house_label juhl
- LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
- WHERE
- juhl.lable_type = 1
- AND jl.id = '20'
- AND juhl.household_id IS NOT NULL
- AND juhl.house_code IN (
- SELECT
- jgr.house_code
- FROM
- jczz_grid jg
- LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
- LEFT JOIN jczz_community jc on jc.`code` = jg.community_code
- WHERE
- br.`code` = jc.`street_code`
- )) number2,
- (
- SELECT
- count( 1 )
- FROM
- jczz_user_house_label juhl
- LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
- WHERE
- juhl.lable_type = 1
- AND jl.id = '22'
- AND juhl.household_id IS NOT NULL
- AND juhl.house_code IN (
- SELECT
- jgr.house_code
- FROM
- jczz_grid jg
- LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
- LEFT JOIN jczz_community jc on jc.`code` = jg.community_code
- WHERE
- br.`code` = jc.`street_code`
- )) number3,
- (
- SELECT
- count( 1 )
- FROM
- jczz_user_house_label juhl
- LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
- WHERE
- juhl.lable_type = 1
- AND jl.id = '23'
- AND juhl.household_id IS NOT NULL
- AND juhl.house_code IN (
- SELECT
- jgr.house_code
- FROM
- jczz_grid jg
- LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
- LEFT JOIN jczz_community jc on jc.`code` = jg.community_code
- WHERE
- br.`code` = jc.`street_code`
- )) number4,
- (
- SELECT
- count( 1 )
- FROM
- jczz_user_house_label juhl
- LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
- WHERE
- juhl.lable_type = 1
- AND jl.id = '1025'
- AND juhl.household_id IS NOT NULL
- AND juhl.house_code IN (
- SELECT
- jgr.house_code
- FROM
- jczz_grid jg
- LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
- LEFT JOIN jczz_community jc on jc.`code` = jg.community_code
- WHERE
- br.`code` = jc.`street_code`
- )) number5
-FROM
- `blade_region` br
-WHERE
- br.region_level = 4
- AND br.city_code = 3611
+ SELECT
+ br.region_level,
+ br.`code` regionCode,
+ br.NAME regionName,
+ (
+ SELECT
+ count( 1 )
+ FROM
+ jczz_user_house_label juhl
+ LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
+ WHERE
+ juhl.lable_type = 1
+ AND jl.id = '19'
+ AND juhl.household_id IS NOT NULL
+ AND juhl.house_code IN (
+ SELECT
+ jgr.house_code
+ FROM
+ jczz_grid jg
+ LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+ LEFT JOIN jczz_community jc on jc.`code` = jg.community_code
+ WHERE
+ br.`code` = jc.`street_code`
+ )) number1,(
+ SELECT
+ count( 1 )
+ FROM
+ jczz_user_house_label juhl
+ LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
+ WHERE
+ juhl.lable_type = 1
+ AND jl.id = '20'
+ AND juhl.household_id IS NOT NULL
+ AND juhl.house_code IN (
+ SELECT
+ jgr.house_code
+ FROM
+ jczz_grid jg
+ LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+ LEFT JOIN jczz_community jc on jc.`code` = jg.community_code
+ WHERE
+ br.`code` = jc.`street_code`
+ )) number2,
+ (
+ SELECT
+ count( 1 )
+ FROM
+ jczz_user_house_label juhl
+ LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
+ WHERE
+ juhl.lable_type = 1
+ AND jl.id = '22'
+ AND juhl.household_id IS NOT NULL
+ AND juhl.house_code IN (
+ SELECT
+ jgr.house_code
+ FROM
+ jczz_grid jg
+ LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+ LEFT JOIN jczz_community jc on jc.`code` = jg.community_code
+ WHERE
+ br.`code` = jc.`street_code`
+ )) number3,
+ (
+ SELECT
+ count( 1 )
+ FROM
+ jczz_user_house_label juhl
+ LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
+ WHERE
+ juhl.lable_type = 1
+ AND jl.id = '23'
+ AND juhl.household_id IS NOT NULL
+ AND juhl.house_code IN (
+ SELECT
+ jgr.house_code
+ FROM
+ jczz_grid jg
+ LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+ LEFT JOIN jczz_community jc on jc.`code` = jg.community_code
+ WHERE
+ br.`code` = jc.`street_code`
+ )) number4,
+ (
+ SELECT
+ count( 1 )
+ FROM
+ jczz_user_house_label juhl
+ LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
+ WHERE
+ juhl.lable_type = 1
+ AND jl.id = '1025'
+ AND juhl.household_id IS NOT NULL
+ AND juhl.house_code IN (
+ SELECT
+ jgr.house_code
+ FROM
+ jczz_grid jg
+ LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+ LEFT JOIN jczz_community jc on jc.`code` = jg.community_code
+ WHERE
+ br.`code` = jc.`street_code`
+ )) number5
+ FROM
+ `blade_region` br
+ WHERE
+ br.region_level = 4
+ AND br.city_code = 3611
</select>
<select id="getCommunityStatisticalLabels" resultType="org.springblade.modules.house.vo.HouseholdLabelVO">
-SELECT
-jc.NAME communityName,
- jc.code communityCode,
- (
- SELECT
- count( 1 )
- FROM
- jczz_user_house_label juhl
- LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
- WHERE
- juhl.lable_type = 1
- AND jl.id = '19'
- AND juhl.household_id IS NOT NULL
- AND juhl.house_code IN (
- SELECT
- jgr.house_code
- FROM
- jczz_grid jg
- LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
- WHERE
- jc.`code` = jg.community_code
- )) number1,(
- SELECT
- count( 1 )
- FROM
- jczz_user_house_label juhl
- LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
- WHERE
- juhl.lable_type = 1
- AND jl.id = '20'
- AND juhl.household_id IS NOT NULL
- AND juhl.house_code IN (
- SELECT
- jgr.house_code
- FROM
- jczz_grid jg
- LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
- WHERE
- jc.`code` = jg.community_code
- )) number2,
- (
- SELECT
- count( 1 )
- FROM
- jczz_user_house_label juhl
- LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
- WHERE
- juhl.lable_type = 1
- AND jl.id = '22'
- AND juhl.household_id IS NOT NULL
- AND juhl.house_code IN (
- SELECT
- jgr.house_code
- FROM
- jczz_grid jg
- LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
- WHERE
- jc.`code` = jg.community_code
- )) number3,
- (
- SELECT
- count( 1 )
- FROM
- jczz_user_house_label juhl
- LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
- WHERE
- juhl.lable_type = 1
- AND jl.id = '23'
- AND juhl.household_id IS NOT NULL
- AND juhl.house_code IN (
- SELECT
- jgr.house_code
- FROM
- jczz_grid jg
- LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
- WHERE
- jc.`code` = jg.community_code
- )) number4,
- (
- SELECT
- count( 1 )
- FROM
- jczz_user_house_label juhl
- LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
- WHERE
- juhl.lable_type = 1
- AND jl.id = '1025'
- AND juhl.household_id IS NOT NULL
- AND juhl.house_code IN (
- SELECT
- jgr.house_code
- FROM
- jczz_grid jg
- LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
- WHERE
- jc.`code` = jg.community_code
- )) number5
-FROM
- `jczz_community` jc
-WHERE
- jc.street_code = #{householdLabel.regionCode}
-
+ SELECT
+ jc.NAME communityName,
+ jc.code communityCode,
+ (
+ SELECT
+ count( 1 )
+ FROM
+ jczz_user_house_label juhl
+ LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
+ WHERE
+ juhl.lable_type = 1
+ AND jl.id = '19'
+ AND juhl.household_id IS NOT NULL
+ AND juhl.house_code IN (
+ SELECT
+ jgr.house_code
+ FROM
+ jczz_grid jg
+ LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+ WHERE
+ jc.`code` = jg.community_code
+ )) number1,(
+ SELECT
+ count( 1 )
+ FROM
+ jczz_user_house_label juhl
+ LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
+ WHERE
+ juhl.lable_type = 1
+ AND jl.id = '20'
+ AND juhl.household_id IS NOT NULL
+ AND juhl.house_code IN (
+ SELECT
+ jgr.house_code
+ FROM
+ jczz_grid jg
+ LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+ WHERE
+ jc.`code` = jg.community_code
+ )) number2,
+ (
+ SELECT
+ count( 1 )
+ FROM
+ jczz_user_house_label juhl
+ LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
+ WHERE
+ juhl.lable_type = 1
+ AND jl.id = '22'
+ AND juhl.household_id IS NOT NULL
+ AND juhl.house_code IN (
+ SELECT
+ jgr.house_code
+ FROM
+ jczz_grid jg
+ LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+ WHERE
+ jc.`code` = jg.community_code
+ )) number3,
+ (
+ SELECT
+ count( 1 )
+ FROM
+ jczz_user_house_label juhl
+ LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
+ WHERE
+ juhl.lable_type = 1
+ AND jl.id = '23'
+ AND juhl.household_id IS NOT NULL
+ AND juhl.house_code IN (
+ SELECT
+ jgr.house_code
+ FROM
+ jczz_grid jg
+ LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+ WHERE
+ jc.`code` = jg.community_code
+ )) number4,
+ (
+ SELECT
+ count( 1 )
+ FROM
+ jczz_user_house_label juhl
+ LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
+ WHERE
+ juhl.lable_type = 1
+ AND jl.id = '1025'
+ AND juhl.household_id IS NOT NULL
+ AND juhl.house_code IN (
+ SELECT
+ jgr.house_code
+ FROM
+ jczz_grid jg
+ LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+ WHERE
+ jc.`code` = jg.community_code
+ )) number5
+ FROM
+ `jczz_community` jc
+ WHERE
+ jc.code like concat(#{householdLabel.regionCode},'%')
</select>
diff --git a/src/main/java/org/springblade/modules/house/vo/HouseVO.java b/src/main/java/org/springblade/modules/house/vo/HouseVO.java
index 450ca0c..21c54a5 100644
--- a/src/main/java/org/springblade/modules/house/vo/HouseVO.java
+++ b/src/main/java/org/springblade/modules/house/vo/HouseVO.java
@@ -16,9 +16,9 @@
*/
package org.springblade.modules.house.vo;
-import org.springblade.modules.house.entity.HouseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
+import org.springblade.modules.house.entity.HouseEntity;
import java.util.ArrayList;
import java.util.List;
@@ -65,5 +65,13 @@
*/
private String regionCode;
+ /**
+ * 标签id
+ */
+ private Integer labelId;
+
+ // 标签父级id
+ private Integer parentId;
+
private List<UserHouseLabelVO> userHouseLabelVOList = new ArrayList<>();
}
--
Gitblit v1.9.3