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/WorkOrderMapper.xml | 2 +-
ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml | 2 +-
ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
index 6096ce2..479d03f 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
@@ -155,7 +155,7 @@
<select id="calculate" resultType="java.util.Map">
SELECT
- dept_name AS deptName,
+ area AS deptName,
ROUND(AVG(score)) AS score
FROM
t_check_score tcs
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
diff --git a/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml
index 5445a93..a77527e 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml
@@ -166,7 +166,7 @@
LEFT JOIN t_work_order w ON w.serial_number = p.serial_number AND w.deleted = 0
WHERE d.del_flag = 0 AND d.area IS NOT NULL
<if test="dataScope == 1"> AND p.province_tag = 'province' </if>
- <if test="deptId != null"> AND p.dept_id = #{deptId} </if>
+ <if test="deptId != null"> /*AND p.dept_id = #{deptId}*/ </if>
GROUP BY d.area, d.dept_id
ORDER BY d.dept_id
</select>
--
Gitblit v1.8.0