|
|
@ -34,7 +34,7 @@ async function list (ctx) { |
|
|
|
const { utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs |
|
|
|
const { database: anxinyun } = clickHouse.anxinyun.opts.config |
|
|
|
|
|
|
|
const { pepProjectId, keywordTarget, keyword, groupId, groupUnitId, sustainTimeStart, sustainTimeEnd, limit, page, state } = ctx.query |
|
|
|
const { pepProjectId, keywordTarget, keyword, groupId, groupUnitId, sustainTimeStart, sustainTimeEnd, limit, page, state, onlineState } = ctx.query |
|
|
|
|
|
|
|
let anxinStruc = await anxinStrucIdRange({ |
|
|
|
ctx, pepProjectId, keywordTarget, keyword |
|
|
@ -79,10 +79,19 @@ async function list (ctx) { |
|
|
|
whereOption.push(`alarms.State >= 3`) |
|
|
|
} |
|
|
|
} |
|
|
|
if(onlineState){ |
|
|
|
if (onlineState == 'online') { |
|
|
|
whereOption.push(`DeviceStatus.Status = ${1}`) |
|
|
|
} else if (onlineState == 'offline') { |
|
|
|
whereOption.push(`DeviceStatus.Status = ${0}`) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
let alarmQueryOptionStr = ` |
|
|
|
FROM |
|
|
|
alarms |
|
|
|
LEFT JOIN DeviceStatus |
|
|
|
ON DeviceStatus.DeviceId = alarms.SourceId |
|
|
|
LEFT JOIN ${anxinyun}.t_structure |
|
|
|
ON ${anxinyun}.t_structure.id = alarms.StructureId |
|
|
|
LEFT JOIN ${anxinyun}.t_alarm_code |
|
|
@ -100,6 +109,7 @@ async function list (ctx) { |
|
|
|
SourceTypeId, |
|
|
|
AlarmAdviceProblem, AlarmGroup, AlarmGroupUnit, AlarmAdviceProblem, |
|
|
|
alarms.StructureId AS StructureId, |
|
|
|
DeviceStatus.Status AS DeviceStatus |
|
|
|
${anxinyun}.t_structure.name AS StructureName, |
|
|
|
${anxinyun}.t_structure.longitude AS StructureLongitude, |
|
|
|
${anxinyun}.t_structure.latitude AS StructureLatitude, |
|
|
|