From 774c8b2ee14eef5fd10bbd46d85a180e7b19ab21 Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Fri, 22 Mar 2024 14:34:12 +0800
Subject: [PATCH] 查询过滤优化
---
src/main/java/org/springblade/modules/task/mapper/TaskResidencePermitApplyMapper.xml | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 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..61f54d3 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,
@@ -25,6 +29,9 @@
and jtrpa.is_deleted = 0
<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.id != null ">and jtrpa.id = #{residen.id}</if>
<if test="residen.name != null and residen.name != ''">and jtrpa.name like CONCAT('%',#{residen.name},'%')</if>
@@ -49,7 +56,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 +65,7 @@
#{code}
</foreach>
or
- jp.grid_code in
+ jtrpa.jw_grid_code in
<foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
#{code}
</foreach>
@@ -73,20 +80,12 @@
<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>
--
Gitblit v1.9.3