From cb7d99d810f2356096b67fbccd3fac556e638d83 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期四, 22 八月 2024 11:22:56 +0800
Subject: [PATCH] feat:查询条件优化

---
 ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
index 62aac3b..78b6c63 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
@@ -113,7 +113,7 @@
             <if test="civilCode != null  and civilCode != ''">and civil_code = #{civilCode}</if>
             <if test="integratedDevice != null ">and integrated_device = #{integratedDevice}</if>
             <if test="cameraBrand != null ">and camera_brand = #{cameraBrand}</if>
-            <if test="address != null  and address != ''">and address like concat('%',#{address},'%')</if>
+            <if test="address != null  and address != ''">and d.dept_id = #{address}</if>
             <if test="netWorking != null ">and net_working = #{netWorking}</if>
             <if test="publicSecurity != null  and publicSecurity != ''">and public_security = #{publicSecurity}</if>
             <if test="installedTime != null ">and installed_time = #{installedTime}</if>
@@ -354,7 +354,7 @@
         LEFT JOIN t_work_order w ON w.serial_number = p.serial_number
         WHERE u.id = #{unitId} AND MONTH(w.create_time) IS NOT NULL
         <if test="dateRange != null and dateRange.size > 0">
-            AND DATE_FORMAT(w.create_time, '%Y-%m') BETWEEN #{dateRange[0]} AND #{dateRange[1]}
+            AND DATE_FORMAT(w.create_time, '%Y-%m') BETWEEN DATE_FORMAT(#{dateRange[0]}, '%Y-%m') AND DATE_FORMAT(#{dateRange[1]}, '%Y-%m')
         </if>
         GROUP BY months
         ORDER BY months

--
Gitblit v1.8.0