diff --git a/api/app/lib/controllers/alarm/app.js b/api/app/lib/controllers/alarm/app.js index 4d2a5a2..f66e740 100644 --- a/api/app/lib/controllers/alarm/app.js +++ b/api/app/lib/controllers/alarm/app.js @@ -35,8 +35,17 @@ async function inspectionList (ctx) { try { const models = ctx.fs.dc.models; const { clickHouse } = ctx.app.fs + const { utils: { anxinStrucIdRange, pomsProjectRange } } = ctx.app.fs const { timeStart, timeEnd, projectId, appId, noted } = ctx.query + let pomsProjectIds = null + if (!projectId && !appId) { + let pomsProject = await pomsProjectRange({ + ctx, + }) + pomsProjectIds = pomsProject.map(p => p.id) + } + let findOption = { where: { @@ -58,8 +67,10 @@ async function inspectionList (ctx) { projectId ? { id: projectId - } : - {} + } : {}, + pomsProjectIds ? { + id: { $in: pomsProjectIds } + } : {} ), attributes: { exclude: ['anxinProjectId', 'createTime', 'createUser']