From 7bcd0d2d7510cb2ba67099cd768e1b2b6d047dc2 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Thu, 22 Feb 2024 17:16:27 +0800
Subject: [PATCH] 投票人员查询优化
---
src/main/java/org/springblade/modules/taskPlaceSelfCheck/mapper/TaskPlaceSelfCheckMapper.xml | 178 ++++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 150 insertions(+), 28 deletions(-)
diff --git a/src/main/java/org/springblade/modules/taskPlaceSelfCheck/mapper/TaskPlaceSelfCheckMapper.xml b/src/main/java/org/springblade/modules/taskPlaceSelfCheck/mapper/TaskPlaceSelfCheckMapper.xml
index b310b7b..47f8555 100644
--- a/src/main/java/org/springblade/modules/taskPlaceSelfCheck/mapper/TaskPlaceSelfCheckMapper.xml
+++ b/src/main/java/org/springblade/modules/taskPlaceSelfCheck/mapper/TaskPlaceSelfCheckMapper.xml
@@ -4,40 +4,160 @@
<!-- 通用查询映射结果 -->
<resultMap id="taskPlaceSelfCheckResultMap"
- type="org.springblade.modules.taskPlaceSelfCheck.entity.TaskPlaceSelfCheckEntity">
+ type="org.springblade.modules.taskPlaceSelfCheck.vo.TaskPlaceSelfCheckVO">
+ <result property="id" column="id"/>
+ <result property="taskId" column="task_id"/>
+ <result property="taskName" column="task_name"/>
+ <result property="placeName" column="place_name"/>
+ <result property="remark" column="remark"/>
+ <result property="updateTime" column="update_time"/>
+ <result property="createTime" column="create_time"/>
+ <result property="houseCode" column="house_code"/>
+ <result property="rectificationEndTime" column="rectification_end_time"/>
+ <result property="rectificationCompleteTime" column="rectification_complete_time"/>
+ <result property="rectificationFlag" column="rectification_flag"/>
+ <result property="policeStation" column="police_station"/>
+ <result property="rectificationNoticeImgUrl" column="rectification_notice_img_url"/>
+ <result property="signaturePath" column="signature_path"/>
+ <result property="createUser" column="create_user"/>
+ <result property="imageUrls" column="image_urls"/>
+ <result property="status" column="status"/>
+ <result property="deleteFlag" column="delete_flag"/>
+
+ <collection property="placePoiLabelVOList" column="jpid" javaType="java.util.List"
+ select="selectPlacePoiLabelList"
+ ofType="org.springblade.modules.place.vo.PlacePoiLabelVO"
+ autoMapping="true">
+ </collection>
+
+ <collection property="taskPlaceRecordVOList" column="id" select="selectPatrolRecordList"
+ javaType="java.util.List" ofType="org.springblade.modules.taskPlaceRecord.vo.TaskPlaceRecordVO"
+ autoMapping="true">
+ </collection>
</resultMap>
<select id="selectTaskPlaceSelfCheckPage" resultMap="taskPlaceSelfCheckResultMap">
- select * from jczz_task_place_self_check
+ select jpc.*,
+ jp.id jpid,
+ jp.place_name,
+ jp.location,
+ jg.grid_name,
+ jp.principal,
+ jp.principal_phone,
+ jp.nine_type,
+ jp.is_nine,
+ br.town_name as streetName,
+ br.village_name as communityName,
+ bu.`name`,
+ jpe.legal_tel,
+ jpe.legal_person
+ FROM jczz_task_place_self_check jpc
+ LEFT JOIN jczz_place jp ON jpc.house_code = jp.house_code and jp.is_deleted = 0
+ LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code and jg.is_deleted = 0
+ LEFT JOIN blade_region br ON br.`code` = jg.community_code
+ LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id and jpe.is_deleted = 0
+ LEFT JOIN blade_user bu ON bu.id = jpc.create_user and bu.is_deleted = 0
+ LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
<where>
- <if test="palce.id != null ">and id = #{palce.id}</if>
- <if test="palce.taskId != null ">and task_id = #{palce.taskId}</if>
- <if test="palce.taskName != null and palce.taskName != ''">and task_name = #{palce.taskName}</if>
- <if test="palce.placeName != null and palce.placeName != ''">and place_name = #{palce.placeName}</if>
- <if test="palce.remark != null and palce.remark != ''">and remark = #{palce.remark}</if>
- <if test="palce.updateTime != null ">and update_time = #{palce.updateTime}</if>
- <if test="palce.createTime != null ">and create_time = #{palce.createTime}</if>
- <if test="palce.houseCode != null and palce.houseCode != ''">and house_code = #{palce.houseCode}</if>
- <if test="palce.rectificationEndTime != null ">and rectification_end_time = #{palce.rectificationEndTime}
+ <if test="place.id != null ">and jpc.id = #{place.id}</if>
+ <if test="place.taskId != null ">and jpc.task_id = #{place.taskId}</if>
+ <if test="place.taskName != null and place.taskName != ''">and jpc.task_name = #{place.taskName}</if>
+ <if test="place.placeName != null and place.placeName != ''">
+ and jp.place_name like concat('%', #{place.placeName},'%')
</if>
- <if test="palce.rectificationCompleteTime != null ">and rectification_complete_time =
- #{palce.rectificationCompleteTime}
+ <if test="place.principal != null and place.principal != ''">
+ and jp.principal like concat('%', #{place.principal},'%')
</if>
- <if test="palce.rectificationFlag != null ">and rectification_flag = #{palce.rectificationFlag}</if>
- <if test="palce.policeStation != null and palce.policeStation != ''">and police_station =
- #{palce.policeStation}
+ <if test="place.remark != null and place.remark != ''">and jpc.remark = #{place.remark}</if>
+ <if test="place.updateTime != null ">and jpc.update_time = #{place.updateTime}</if>
+ <if test="place.createTime != null ">and jpc.create_time = #{place.createTime}</if>
+ <if test="place.houseCode != null and place.houseCode != ''">and jpc.house_code = #{place.houseCode}</if>
+ <if test="place.rectificationEndTime != null ">and jpc.rectification_end_time =
+ #{place.rectificationEndTime}
</if>
- <if test="palce.rectificationNoticeImgUrl != null and palce.rectificationNoticeImgUrl != ''">and
- rectification_notice_img_url = #{palce.rectificationNoticeImgUrl}
+ <if test="place.rectificationCompleteTime != null ">and jpc.rectification_complete_time =
+ #{place.rectificationCompleteTime}
</if>
- <if test="palce.signaturePath != null and palce.signaturePath != ''">and signature_path =
- #{palce.signaturePath}
+ <if test="place.rectificationFlag != null ">and jpc.rectification_flag = #{place.rectificationFlag}</if>
+ <if test="place.policeStation != null and place.policeStation != ''">and jpc.police_station =
+ #{place.policeStation}
</if>
- <if test="palce.createUser != null ">and create_user = #{palce.createUser}</if>
- <if test="palce.imageUrls != null and palce.imageUrls != ''">and image_urls = #{palce.imageUrls}</if>
- <if test="palce.status != null ">and status = #{palce.status}</if>
- <if test="palce.deleteFlag != null ">and delete_flag = #{palce.deleteFlag}</if>
+ <if test="place.rectificationNoticeImgUrl != null and place.rectificationNoticeImgUrl != ''">and
+ jpc.rectification_notice_img_url = #{place.rectificationNoticeImgUrl}
+ </if>
+ <if test="place.signaturePath != null and place.signaturePath != ''">and jpc.signature_path =
+ #{place.signaturePath}
+ </if>
+
+ <if test="place.streetName!=null and place.streetName!=''">
+ and br.town_name like concat('%', #{place.streetName},'%')
+ </if>
+
+ <if test="place.communityName!=null and place.communityName!=''">
+ and br.village_name like concat('%', #{place.communityName},'%')
+ </if>
+ <if test="place.gridName!=null and place.gridName!=''">
+ and jg.grid_name like concat('%', #{place.gridName},'%')
+ </if>
+ <if test="place.createUser != null ">and jpc.create_user = #{place.createUser}</if>
+ <if test="place.imageUrls != null and place.imageUrls != ''">and jpc.image_urls = #{place.imageUrls}</if>
+ <if test="place.status != null ">and jpc.status = #{place.status}</if>
+ <if test="place.deleteFlag != null ">and jpc.delete_flag = #{place.deleteFlag}</if>
+ <if test="isAdministrator==2">
+ <choose>
+ <when test="place.roleName != null and place.roleName != ''">
+ <if test="place.roleName=='wgy'">
+ <choose>
+ <when test="gridCodeList !=null and gridCodeList.size()>0">
+ and jp.grid_code in
+ <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ </when>
+ <otherwise>
+ and jp.grid_code in ('')
+ </otherwise>
+ </choose>
+ </if>
+ <if test="place.roleName=='mj'">
+ <choose>
+ <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+ and jpag.community_code in
+ <foreach collection="regionChildCodesList" item="code" open="(" close=")"
+ separator=",">
+ #{code}
+ </foreach>
+ </when>
+ <otherwise>
+ and jpag.community_code in ('')
+ </otherwise>
+ </choose>
+ </if>
+ </when>
+ <otherwise>
+ <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
+ jpag.community_code in
+ <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+ #{code}
+ </foreach>
+ )
+ </when>
+ <otherwise>
+
+ </otherwise>
+ </choose>
+ </otherwise>
+ </choose>
+ </if>
</where>
</select>
@@ -95,7 +215,7 @@
<select id="selectPatrolRecordList" parameterType="Long"
- resultType="org.springblade.modules.patrol.vo.PatrolRecordVO">
+ resultType="org.springblade.modules.taskPlaceRecord.vo.TaskPlaceRecordVO">
select
jpr.id,
jpr.item_id,
@@ -173,7 +293,7 @@
jpe.legal_person,
jt.remark reasonFailure,
jda.address_name
- FROM
+ FROM
jczz_task_place_self_check jtpr
LEFT JOIN jczz_task jt ON jt.id = jtpr.task_id
LEFT JOIN jczz_place jp ON jtpr.house_code = jp.house_code
@@ -182,8 +302,10 @@
LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id
LEFT JOIN blade_user bu ON bu.id = jtpr.create_user
LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jtpr.house_code
- WHERE
- jtpr.id = #{id}
+ <where>
+ <if test="place.id != null ">and jtpr.id = #{place.id}</if>
+ <if test="place.taskId != null ">and jtpr.task_id = #{place.taskId}</if>
+ </where>
</select>
<select id="selectTaskPlaceSelfCheckList"
--
Gitblit v1.9.3