wenlele 2 years ago
parent
commit
2e5ab9e08b
  1. 6
      api/app/lib/controllers/alarm/data.js

6
api/app/lib/controllers/alarm/data.js

@ -79,7 +79,7 @@ async function list (ctx) {
whereOption.push(`alarms.State >= 3`) whereOption.push(`alarms.State >= 3`)
} }
} }
if(onlineState){ if (onlineState) {
if (onlineState == 'online') { if (onlineState == 'online') {
whereOption.push(`DeviceStatus.Status = ${1}`) whereOption.push(`DeviceStatus.Status = ${1}`)
} else if (onlineState == 'offline') { } else if (onlineState == 'offline') {
@ -90,8 +90,8 @@ async function list (ctx) {
let alarmQueryOptionStr = ` let alarmQueryOptionStr = `
FROM FROM
alarms alarms
LEFT JOIN DeviceStatus LEFT JOIN (SELECT DeviceId, any(Status) AS Status,max(Time) FROM alarm.DeviceStatus GROUP BY DeviceId ) AS DeviceStatus
ON DeviceStatus.DeviceId = alarms.SourceId ON DeviceStatus.DeviceId = alarms.SourceId
LEFT JOIN ${anxinyun}.t_structure LEFT JOIN ${anxinyun}.t_structure
ON ${anxinyun}.t_structure.id = alarms.StructureId ON ${anxinyun}.t_structure.id = alarms.StructureId
LEFT JOIN ${anxinyun}.t_alarm_code LEFT JOIN ${anxinyun}.t_alarm_code

Loading…
Cancel
Save