From 36e5600e3497d97b42376c5f096d85891f1ad94b Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期二, 30 四月 2024 16:50:12 +0800
Subject: [PATCH] 改为连表查询

---
 ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml
index 8e237d6..17b7c91 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/ReportMapper.xml
@@ -16,4 +16,29 @@
         <result column="error_type" property="errorType" />
     </resultMap>
 
+    <select id="page" resultType="com.ycl.platform.domain.vo.ReportVO">
+        SELECT
+        r.*, u.unit_name, p.yw_person_name as peopleName, pt.point_name
+        FROM
+        t_report r
+        LEFT JOIN t_yw_unit u ON r.unit_id = u.id and u.deleted = '0'
+        LEFT JOIN t_yw_people p ON r.people_id = p.id and p.deleted = '0'
+        LEFT JOIN t_yw_point pt ON r.point_id = pt.id and pt.deleted = '0'
+        where
+        r.deleted = '0'
+        <if test="reportType != null and reportType != ''">
+            AND r.report_type = #{reportType}
+        </if>
+        <if test="beginCreateTime != null">
+            AND r.create_time between #{beginCreateTime} and #{endCreateTime}
+        </if>
+        <if test="pointId != null and pointId != ''">
+            AND pt.point_name like concat('%', #{pointId}, '%')
+        </if>
+        <if test="peopleId != null and peopleId != ''">
+            AND p.yw_person_name like concat('%', #{peopleId}, '%')
+        </if>
+        ORDER BY r.create_time DESC
+    </select>
+
 </mapper>

--
Gitblit v1.8.0