From b6f3fc5aec6af3ea4c8a46038f226239181d76aa Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Tue, 30 Jan 2024 15:30:40 +0800
Subject: [PATCH] 九小场所优化

---
 src/main/java/org/springblade/modules/place/mapper/PlaceCheckMapper.xml |   85 +++++++++++++++++++++++++++---------------
 1 files changed, 54 insertions(+), 31 deletions(-)

diff --git a/src/main/java/org/springblade/modules/place/mapper/PlaceCheckMapper.xml b/src/main/java/org/springblade/modules/place/mapper/PlaceCheckMapper.xml
index 6e7b128..eb34a83 100644
--- a/src/main/java/org/springblade/modules/place/mapper/PlaceCheckMapper.xml
+++ b/src/main/java/org/springblade/modules/place/mapper/PlaceCheckMapper.xml
@@ -20,12 +20,47 @@
         <result column="town_name" property="streetName"/>
         <result column="village_name" property="communityName"/>
 
-        <collection property="patrolRecordVOList" column="id"
+        <collection property="placePoiLabelVOList" column="id" javaType="java.util.List" select="selectPlacePoiLabelList"
+                    ofType="org.springblade.modules.place.entity.PlacePoiLabel"
+                    autoMapping="true">
+        </collection>
+
+        <collection property="patrolRecordVOList" column="id" select="selectPatrolRecordList"
                     javaType="java.util.List" ofType="org.springblade.modules.patrol.entity.PatrolRecord"
                     autoMapping="true">
-            <id property="placeCheckId" column="id"/>
         </collection>
     </resultMap>
+
+    <select id="selectPlacePoiLabelList" parameterType="Long"
+            resultType="org.springblade.modules.place.entity.PlacePoiLabel">
+            select
+	        id,
+	        place_id,
+	        poi_code,
+	        type,
+	        color,
+	        remark
+		    from
+        	jczz_place_poi_label where place_id = #{id}
+        </select>
+
+
+    <select id="selectPatrolRecordList" parameterType="Long"
+            resultType="org.springblade.modules.patrol.entity.PatrolRecord">
+            select
+            id,
+            item_id,
+            place_check_id,
+            state,
+            remark,
+            image_urls,
+            create_user,
+            create_time,
+            is_deleted
+            from
+            jczz_patrol_record where place_check_id = #{id}
+        </select>
+
 
     <!--自定义分页查询-->
     <select id="selectPlaceCheckPage" resultMap="placeCheckResultMap">
@@ -36,13 +71,18 @@
         jg.grid_name,
         jp.principal,
         jp.principal_phone,
-        br.town_name ,
-        br.village_name
+        br.town_name,
+        br.village_name,
+        bu.`name`,
+        jpe.legal_tel,
+        jpe.legal_person
         FROM
         jczz_place_check jpc
         LEFT JOIN jczz_place jp ON jpc.house_code = jp.house_code
         LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code
         LEFT JOIN blade_region br ON br.`code` = jg.community_code
+        LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id
+        LEFT JOIN blade_user bu ON bu.id = jpc.create_user
         where jpc.is_deleted = 0
         <if test="placeCheck.houseCode!=null and placeCheck.houseCode!=''">
             and jpc.house_code = #{placeCheck.houseCode}
@@ -78,31 +118,9 @@
         <if test="placeCheck.endTime!=null and placeCheck.endTime!=''">
             and date_format(jpc.create_time,'%Y-%m-%d') &lt;= #{placeCheck.endTime}
         </if>
+        order by jpc.create_time desc
     </select>
 
-
-    <resultMap type="org.springblade.modules.place.dto.PlaceCheckDTO" id="PlaceCheckDTOResult">
-        <result property="id" column="id"/>
-        <result property="houseCode" column="house_code"/>
-        <result property="remark" column="remark"/>
-        <result property="signaturePath" column="signature_path"/>
-        <result property="createUser" column="create_user"/>
-        <result property="createTime" column="create_time"/>
-        <result property="isDeleted" column="is_deleted"/>
-        <result column="place_name" property="placeName"/>
-        <result column="location" property="location"/>
-        <result column="grid_name" property="gridName"/>
-        <result column="principal" property="principal"/>
-        <result column="principal_phone" property="principalPhone"/>
-        <result column="town_name" property="streetName"/>
-        <result column="village_name" property="communityName"/>
-
-        <collection property="patrolRecordVOList" column="id"
-                    javaType="java.util.List" ofType="org.springblade.modules.patrol.entity.PatrolRecord"
-                    autoMapping="true">
-            <id property="placeCheckId" column="id"/>
-        </collection>
-    </resultMap>
 
     <sql id="selectPlaceCheck">
     	select
@@ -117,7 +135,7 @@
         	jczz_place_check
     </sql>
 
-    <select id="selectPlaceCheckById" parameterType="long" resultMap="PlaceCheckDTOResult">
+    <select id="selectPlaceCheckById" parameterType="long" resultMap="placeCheckResultMap">
         SELECT
         jpc.*,
         jp.place_name,
@@ -125,20 +143,25 @@
         jg.grid_name,
         jp.principal,
         jp.principal_phone,
-        br.town_name ,
-        br.village_name
+        br.town_name,
+        br.village_name,
+        bu.`name`,
+        jpe.legal_tel,
+        jpe.legal_person
         FROM
         jczz_place_check jpc
         LEFT JOIN jczz_place jp ON jpc.house_code = jp.house_code
         LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code
         LEFT JOIN blade_region br ON br.`code` = jg.community_code
+        LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id
+        LEFT JOIN blade_user bu ON bu.id = jpc.create_user
         where
             jpc.is_deleted = 0
             and  jpc.id = #{id}
         </select>
 
     <select id="selectPlaceCheckList" parameterType="org.springblade.modules.place.dto.PlaceCheckDTO"
-            resultMap="PlaceCheckDTOResult">
+            resultMap="placeCheckResultMap">
         <include refid="selectPlaceCheck"/>
         <where>
             <if test="id != null ">and id = #{id}</if>

--
Gitblit v1.9.3