wenlele 2 years ago
parent
commit
55d0791fa8
  1. 7
      api/app/lib/controllers/alarm/data.js
  2. 3
      api/app/lib/utils/dataRange.js

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

@ -41,7 +41,7 @@ async function list (ctx) {
ctx, pepProjectId, projectOrStructKeyword, ctx, pepProjectId, projectOrStructKeyword,
}) })
let whereOption = [] let whereOption = []
if (anxinStrucIds.length) { if (anxinStrucIds.length ||1) {
whereOption.push(`alarms.StructureId IN (${anxinStrucIds.join(",")})`) whereOption.push(`alarms.StructureId IN (${anxinStrucIds.join(",")})`)
if (groupId) { if (groupId) {
@ -87,10 +87,7 @@ async function list (ctx) {
LEFT JOIN ${anxinyun}.t_alarm_code LEFT JOIN ${anxinyun}.t_alarm_code
ON ${anxinyun}.t_alarm_code.code = alarms.AlarmTypeCode ON ${anxinyun}.t_alarm_code.code = alarms.AlarmTypeCode
${whereOption.length ? 'WHERE ' + whereOption.join(' AND ') : ''}
ORDER BY alarms.StartTime DESC
${limit ? 'LIMIT ' + limit : ''}
${limit && page ? 'OFFSET ' + parseInt(limit) * parseInt(page) : ''}
`).toPromise(); `).toPromise();
// alarm_details.Time, alarm_details.Content // alarm_details.Time, alarm_details.Content

3
api/app/lib/utils/dataRange.js

@ -85,7 +85,8 @@ module.exports = function (app, opts) {
).toPromise() : ).toPromise() :
[] []
return [...new Set(...undelStrucRes.map(s => s.strucId))] const undelStrucIds = [...new Set(...undelStrucRes.map(s => s.strucId))]
return {}
} catch (error) { } catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
} }

Loading…
Cancel
Save