From 8b7258c9427882bb1798f1502eaa35184c6e374e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 09 Aug 2024 14:29:18 +0800
Subject: [PATCH] 短信指定楼栋发送
---
src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml | 152 +++++++++++++++++++++++++++++++++++---------------
1 files changed, 107 insertions(+), 45 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 c36fb17..7559647 100644
--- a/src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml
+++ b/src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml
@@ -20,9 +20,13 @@
<!--自定义分页查询-->
<select id="selectGridmanPage" resultType="org.springblade.modules.grid.vo.GridmanVO">
select
- jgm.*,jg.community_code communityCode
+ jgm.*,
+ jg.grid_name gridName,jg.community_code communityCode,
+ br.name as communityName,
+ br.town_name as townName
from jczz_gridman jgm
- left join jczz_grid jg on jg.id = jgm.grid_id and jg.is_deleted = 0
+ left join jczz_grid jg on jg.grid_code = jgm.grid_code and jg.is_deleted = 0
+ left join blade_region br on br.code = jg.community_code
where jgm.is_deleted = 0
<if test="gridman.gridmanName!=null and gridman.gridmanName!=''">
and jgm.gridman_name like concat('%',#{gridman.gridmanName},'%')
@@ -35,6 +39,25 @@
</if>
<if test="gridman.communityCode!=null and gridman.communityCode!=''">
and jg.community_code like concat('%',#{gridman.communityCode},'%')
+ </if>
+ <if test="gridman.communityName!=null and gridman.communityName!=''">
+ and br.name like concat('%',#{gridman.communityName},'%')
+ </if>
+ <if test="gridman.townName!=null and gridman.townName!=''">
+ and br.town_name like concat('%',#{gridman.townName},'%')
+ </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>
</select>
@@ -55,12 +78,19 @@
<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>
+ LEFT JOIN jczz_grid jg ON jg.grid_code = jgm.grid_code
+ <where>
+ <if test="communityCodeList !=null and communityCodeList.size() >0">
+ jg.community_code in
+ <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ </if>
+ AND jg.is_deleted = 0
+ <if test="userId!=null and roleType == '1'">
+ and jgm.user_id= #{userId}
+ </if>
+ </where>
</select>
<select id="getCompanyStatistics" resultType="java.lang.Integer">
@@ -69,24 +99,27 @@
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>
+ <where>
+ jd.community_code in
+ <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ 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.grid_code = jgm.grid_code
+ LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jg.house_code
+ WHERE
+ jgm.user_id = #{userId}
+ AND jg.is_deleted = 0
+ AND jda.aoi_code IS NOT NULL
+ )
+ </if>
+ </where>
</select>
<select id="getOwnersCommitteeStatistics" resultType="java.lang.Integer">
@@ -94,24 +127,27 @@
count(1)
FROM jczz_owners_committee joc LEFT JOIN
jczz_district jd ON jd.id = joc.area_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>
+ <where>
+ jd.community_code in
+ <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ and joc.delete_flag= 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.grid_code = jgm.grid_code
+ LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jg.house_code
+ WHERE
+ jgm.user_id = #{userId}
+ AND jg.is_deleted = 0
+ AND jda.aoi_code IS NOT NULL
+ )
+ </if>
+ </where>
</select>
@@ -120,8 +156,34 @@
select
jgm.*,jg.community_code communityCode
from jczz_gridman jgm
- left join jczz_grid jg on jg.id = jgm.grid_id and jg.is_deleted = 0
+ left join jczz_grid jg on jg.grid_code = jgm.grid_code and jg.is_deleted = 0
where jgm.is_deleted = 0
and jgm.id = #{gridman.id}
</select>
+
+ <!--查询网格id-->
+ <select id="getGridIdByUserId" resultType="java.lang.Integer">
+ select
+ jgm.grid_id
+ from jczz_gridman jgm
+ where jgm.is_deleted = 0
+ and jgm.user_id = #{userId}
+ limit 1
+ </select>
+
+ <select id="getGridManByCode" resultType="org.springblade.modules.system.entity.User">
+ SELECT
+ bu.*
+ FROM
+ blade_user bu
+ LEFT JOIN jczz_gridman jgm ON bu.id = jgm.user_id
+ LEFT JOIN jczz_grid jg ON jgm.grid_code = jg.grid_code
+ WHERE
+ jg.community_code IN
+ (
+ SELECT jg.community_code FROM jczz_grid jg LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
+ WHERE jgr.house_code = #{houseCode}
+ )
+ AND bu.is_deleted = 0
+ </select>
</mapper>
--
Gitblit v1.9.3