From 32d04adbd314a47b723286be916c2aadbfb7cb5b Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 12 Oct 2022 16:07:44 +0800 Subject: [PATCH] =?UTF-8?q?fix=205824=20=E6=95=B0=E6=8D=AE=E4=B8=AD?= =?UTF-8?q?=E6=96=AD-=E5=88=97=E8=A1=A8=E5=B1=95=E7=A4=BA=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E5=A4=9A=E6=9D=A1=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/data.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/app/lib/controllers/alarm/data.js b/api/app/lib/controllers/alarm/data.js index 24407e3..92d170c 100644 --- a/api/app/lib/controllers/alarm/data.js +++ b/api/app/lib/controllers/alarm/data.js @@ -79,7 +79,7 @@ async function list (ctx) { whereOption.push(`alarms.State >= 3`) } } - if(onlineState){ + if (onlineState) { if (onlineState == 'online') { whereOption.push(`DeviceStatus.Status = ${1}`) } else if (onlineState == 'offline') { @@ -90,8 +90,8 @@ async function list (ctx) { let alarmQueryOptionStr = ` FROM alarms - LEFT JOIN DeviceStatus - ON DeviceStatus.DeviceId = alarms.SourceId + LEFT JOIN (SELECT DeviceId, any(Status) AS Status,max(Time) FROM alarm.DeviceStatus GROUP BY DeviceId ) AS DeviceStatus + ON DeviceStatus.DeviceId = alarms.SourceId LEFT JOIN ${anxinyun}.t_structure ON ${anxinyun}.t_structure.id = alarms.StructureId LEFT JOIN ${anxinyun}.t_alarm_code