From c10d6358b9f014375a13821465bc978d0c0da22e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Wed, 29 May 2024 17:17:08 +0800
Subject: [PATCH] 通过E呼即办数据统计
---
src/main/java/org/springblade/modules/task/mapper/TaskResidencePermitApplyMapper.xml | 72 +++++++++++++++++++++++++++--------
1 files changed, 55 insertions(+), 17 deletions(-)
diff --git a/src/main/java/org/springblade/modules/task/mapper/TaskResidencePermitApplyMapper.xml b/src/main/java/org/springblade/modules/task/mapper/TaskResidencePermitApplyMapper.xml
index 4ea3df1..cc0580e 100644
--- a/src/main/java/org/springblade/modules/task/mapper/TaskResidencePermitApplyMapper.xml
+++ b/src/main/java/org/springblade/modules/task/mapper/TaskResidencePermitApplyMapper.xml
@@ -12,6 +12,10 @@
select
jtrpa.*,
br.town_name streetName,
+ case
+ when TIMESTAMPDIFF(year, substring(jtrpa.id_card, 7, 8), now()) < 18 then 2
+ when TIMESTAMPDIFF(year, substring(jtrpa.id_card, 7, 8), now()) >= 18 then 1
+ end as minors,
jg.grid_name,
jda.aoi_name,
br.village_name communityName,
@@ -26,6 +30,11 @@
<if test="residen.minors!=null and residen.minors ==2">
and TIMESTAMPDIFF(year, substring(jtrpa.id_card, 7, 8), now()) < 18
</if>
+ <if test="residen.minors!=null and residen.minors ==1">
+ and TIMESTAMPDIFF(year, substring(jtrpa.id_card, 7, 8), now()) >= 18
+ </if>
+ <if test="residen.communityCode != null and residen.communityCode != ''"> and jg.community_code = #{residen.communityCode}</if>
+
<if test="residen.id != null ">and jtrpa.id = #{residen.id}</if>
<if test="residen.name != null and residen.name != ''">and jtrpa.name like CONCAT('%',#{residen.name},'%')</if>
<if test="residen.phone != null and residen.phone != ''">and jtrpa.phone like CONCAT('%',#{residen.phone},'%')</if>
@@ -49,7 +58,7 @@
<if test="isAdministrator==2">
<!-- 网格员及其他 -->
- <if test="vo.roleType ==null">
+ <if test="residen.roleType ==null and residen.roleName !='inhabitant'">
<choose>
<when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
and (
@@ -58,7 +67,7 @@
#{code}
</foreach>
or
- jp.grid_code in
+ jtrpa.jw_grid_code in
<foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
#{code}
</foreach>
@@ -73,35 +82,64 @@
<foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
#{code}
</foreach>
- or
- jp.grid_code in
- <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
- #{code}
- </foreach>
)
</when>
- <otherwise>
- and jg.grid_code in ('')
- </otherwise>
</choose>
- <if test="vo.confirmUserId != null ">
- or jtrfr.confirm_user_id = #{vo.confirmUserId}
+ <if test="residen.confirmUserId != null ">
+ or jtrfr.confirm_user_id = #{residen.confirmUserId}
</if>
</if>
</if>
- order by jtrpa.create_time desc
</where>
+ order by jtrpa.create_time desc
</select>
<select id="getCount" resultType="java.lang.Integer">
SELECT count(1)
- FROM jczz_task_residence_permit_apply jtrpa
- WHERE jtrpa.jw_grid_code IN
- (SELECT jpag.jw_grid_code FROM jczz_police_affairs_grid jpag WHERE jpag.police_user_id like concat('%',${userId},'%') )
- AND jtrpa.`confirm_flag` = 1
+ from jczz_task_residence_permit_apply jtrpa
+ left join jczz_doorplate_address jda on jda.address_code = jtrpa.house_code
+ LEFT JOIN jczz_house jh on jh.house_code=jtrpa.house_code
+ left join jczz_grid jg on jg.grid_code = jh.grid_code and jg.is_deleted = 0
+ left join blade_region br on br.code = jg.community_code
+ <where>
+ and jtrpa.is_deleted = 0
+ <if test="neiCode != null and neiCode != ''"> and jg.community_code = #{neiCode}</if>
+ <if test="status != null and status != ''"> and jtrpa.confirm_flag = #{status}</if>
+
+ <if test="isAdministrator==2">
+<!-- <if test="residen.roleType ==null ">-->
+ <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
+ jtrpa.jw_grid_code in
+ <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ )
+ </when>
+ </choose>
+
+ <choose>
+ <when test="gridCodeList !=null and gridCodeList.size()>0">
+ and (
+ jg.grid_code in
+ <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ )
+ </when>
+ </choose>
+<!-- </if>-->
+ </if>
+ </where>
</select>
--
Gitblit v1.9.3