From 51396d6ed0747b1e909056ed72108b6b0c811667 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期三, 13 十一月 2024 11:00:58 +0800
Subject: [PATCH] 离线检测优化
---
ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
index 9f45051..fb72b26 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
@@ -105,7 +105,7 @@
camera_dept, hybm, lxbm,d.dept_id, d.dept_name from t_monitor m
left join t_yw_point p on m.serial_number = p.serial_number
left join sys_dept d on p.dept_id = d.dept_id
- where m.serial_number in
+ where p.examine_status = 1 and m.serial_number in
<foreach collection="list" separator="," item="id" open="(" close=")">
#{id}
</foreach>
@@ -121,14 +121,14 @@
<select id="selectTMonitorList" resultType="com.ycl.platform.domain.vo.TMonitorVO">
select m.id, m.serial_number, name, site_type, mac_addr, ip, camera_fun_type, longitude, latitude,
camera_capture_area, p.online as onState, civil_code, d.dept_id, d.dept_name, d.area, p.province_tag,p.dept_tag,
- IF(COUNT(w.id) OVER() > 0, '鏄�', '鍚�') AS error, u.unit_name,p.recovery_time,p.reason,p.start_time,p.end_time,w.work_order_no
+ IF(COUNT(w.id) OVER() > 0, '鏄�', '鍚�') AS error, u.unit_name,p.recovery_time,p.reason,p.start_time,p.end_time, w.work_order_no
from t_monitor m
left join t_yw_point p on m.serial_number = p.serial_number and p.deleted = 0
left join sys_dept d on p.dept_id = d.dept_id and d.del_flag = 0
left join (
WITH cte AS (
SELECT *,row_number() OVER(PARTITION BY serial_number ORDER BY create_time DESC) rn FROM t_work_order
- WHERE deleted = 0 AND status != 'AUDITING_SUCCESS'
+ WHERE deleted = 0 AND status = 'AUDITING_SUCCESS'
) SELECT * FROM cte WHERE rn=1
) w on m.serial_number = w.serial_number and w.deleted = 0
left join t_yw_unit u on p.unit_id = u.id and u.deleted = 0
@@ -369,7 +369,8 @@
IFNULL(SUM(IF(p.online = 1, 1, 0)), 0) AS totalMembers,
IFNULL(SUM(IF(p.online = -1, 1, 0)), 0) AS postsPercentage,
IFNULL(SUM(IF(p.online = 0, 1, 0)), 0) AS unknownNumbers,
- IFNULL(ROUND(SUM(IF(p.online = 1 , 1, 0)) / count(*) * 100, 2), 0) as viewsPercentage FROM t_monitor m
+ IFNULL(ROUND(SUM(IF(p.online = 1 , 1, 0)) / count(*) * 100, 2), 0) as viewsPercentage
+ FROM t_monitor m
left join t_yw_point p on m.serial_number = p.serial_number
left join sys_dept d on p.dept_id = d.dept_id and d.del_flag = 0
<where>
@@ -389,7 +390,10 @@
IFNULL(SUM(IF(p.online = 1, 1, 0)), 0) AS totalMembers,
IFNULL(SUM(IF(p.online = -1, 1, 0)), 0) AS postsPercentage,
IFNULL(SUM(IF(p.online = 0, 1, 0)), 0) AS unknownNumbers,
- IFNULL(ROUND(SUM(IF(p.online = 1 , 1, 0)) / count(*) * 100, 2), 0) as viewsPercentage FROM t_monitor m
+ IFNULL(ROUND(SUM(IF(p.online = 1 , 1, 0)) / count(*) * 100, 2), 0) as viewsPercentage
+ FROM t_monitor m
+ left join t_yw_point p on m.serial_number = p.serial_number
+ left join sys_dept d on p.dept_id = d.dept_id and d.del_flag = 0
<where>
p.examine_status = 1
<!-- (p.recovery = 1 OR TIMESTAMPDIFF(DAY, p.recovery_time, NOW()) <![CDATA[<=]]> #{time}) -->
@@ -679,7 +683,7 @@
from t_monitor m
left join t_yw_point p on m.serial_number = p.serial_number
left join sys_dept d on p.dept_id = d.dept_id
- where p.online != 0 and p.examine_status = 1
+ where p.online != 0 and p.examine_status = 1
</select>
<update id="updateOnline">
--
Gitblit v1.8.0