From 047ced202f052d70c50f4365b2d86810de076489 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Wed, 15 May 2024 17:57:49 +0800
Subject: [PATCH] E呼即办2
---
src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml | 101 +++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 86 insertions(+), 15 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 ac7de1b..873fc47 100644
--- a/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
+++ b/src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
@@ -192,6 +192,10 @@
jhs.building,
jhs.district_code aoiCode,
jh.volunteer_org,
+ case
+ when TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) < 18 then 2
+ when TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) >= 18 then 1
+ end as minors,
jhs.unit
FROM
jczz_household jh
@@ -235,9 +239,20 @@
<if test="household.houseCode!=null and household.houseCode !=''">
and jh.house_code = #{household.houseCode}
</if>
+
+ <if test="household.communityCode!=null and household.communityCode !=''">
+ and jg.community_code = #{household.communityCode}
+ </if>
<!-- 等于18 就是租户 -->
<if test="household.relationship!=null and household.relationship == 18">
and jh.relationship = #{household.relationship}
+
+ <if test="household.minors!=null and household.minors ==2">
+ and TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) < 18
+ </if>
+ <if test="household.minors!=null and household.minors ==1">
+ and TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) >= 18
+ </if>
</if>
<!-- 不等于18 就是非租户 -->
<if test="household.relationship!=null and household.relationship != 18">
@@ -436,6 +451,7 @@
jda.doorplate_type doorplateType,
jda.address_level addressLevel,
jda.nei_name neiName,
+ jda.nei_code neiCode,
jda.aoi_code aoiCode,
jh.relationship relationship
from jczz_household jh
@@ -541,7 +557,7 @@
</select>
<!--导出数据-->
- <select id="export" resultType="org.springblade.modules.house.excel.HouseHoldExcel">
+ <select id="export" resultType="org.springblade.modules.house.excel.ImportHouseholdExcel">
select
jh.house_code houseCode,
jh.name,jh.phone_number phoneNumber,jh.role_type roleType,jh.relationship relationship,
@@ -580,10 +596,10 @@
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.neiCode != null and household.neiCode != ''">
- and jda.nei_code = #{household.neiCode}
+ <if test="household.communityCode != null and household.communityCode != ''">
+ and jg.community_code = #{household.communityCode}
</if>
- <if test="household.confirmFlag != null and household.confirmFlag != ''">
+ <if test="household.confirmFlag != null">
and jh.confirm_flag = #{household.confirmFlag}
</if>
<if test="isAdministrator==2">
@@ -760,17 +776,6 @@
WHERE
jgm.user_id = #{userId}
AND jg.is_deleted = 0
- )
- </if>
-
- <if test="userId != null and roleType == '3'">
- AND jda.address_code IN (SELECT
- jda.address_code
- FROM
- jczz_doorplate_address jda
- LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code
- WHERE
- jc.res_police_user_id like concat('%',#{userId},'%'))
)
</if>
GROUP BY age
@@ -1201,4 +1206,70 @@
and jl.parent_id != '1001'
</select>
+ <select id="getUserInfoByDistrictIds" resultType="org.springblade.modules.house.vo.HouseholdVO">
+ SELECT
+ jh.*,
+ jhe.house_name address,
+ jhe.building,
+ jhe.unit
+ FROM
+ jczz_household jh
+ LEFT JOIN jczz_house jhe ON jhe.house_code = jh.house_code
+ AND jh.is_deleted = 0
+ LEFT JOIN jczz_district jd ON jd.aoi_code = jhe.district_code
+ <where>
+ and jd.id in
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ and jh.relationship !=18
+ <if test="vo.building != null and vo.building !=''">
+ and jhe.building like concat('%',#{vo.building},'%')
+ </if>
+ <if test="vo.unit != null and vo.unit !=''">
+ and jhe.unit like concat('%',#{vo.unit},'%')
+ </if>
+ <if test="vo.name != null and vo.name !=''">
+ and jh.name like concat('%',#{vo.name},'%')
+ </if>
+ <if test="vo.phoneNumber != null and vo.phoneNumber !=''">
+ and jh.phone_number like concat('%',#{vo.phoneNumber},'%')
+ </if>
+ </where>
+ </select>
+
+ <!--查询住户对应的社区编号-->
+ <select id="getCommunityCode" resultType="java.lang.String">
+ SELECT
+ jpag.community_code
+ FROM
+ jczz_household jh
+ LEFT JOIN jczz_house jhs ON jh.house_code = jhs.house_code and jhs.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 jh.is_deleted = 0
+ and jh.id = #{id}
+ </select>
+
+ <!--查询所有住户总数-->
+ <select id="getAllListTotal" resultType="java.lang.Integer">
+ SELECT
+ count(*)
+ FROM
+ jczz_household jh
+ where jh.is_deleted = 0
+ </select>
+
+ <!--查询对应的住户集合-->
+ <select id="getAllList" resultType="org.springblade.modules.house.vo.HouseholdVO">
+ SELECT
+ jh.*,
+ jpag.community_code
+ FROM
+ jczz_household jh
+ LEFT JOIN jczz_house jhs ON jh.house_code = jhs.house_code and jhs.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 jh.is_deleted = 0
+ limit #{i},#{size}
+ </select>
+
</mapper>
--
Gitblit v1.9.3