|
|
@ -201,12 +201,18 @@ async function apiErrorList (ctx) { |
|
|
|
model: models.ProjectApp, |
|
|
|
where: { |
|
|
|
|
|
|
|
}, |
|
|
|
attributes: { |
|
|
|
exclude: ['projectId'] |
|
|
|
}, |
|
|
|
include: [{ |
|
|
|
model: models.ProjectCorrelation, |
|
|
|
where: { |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
attributes: { |
|
|
|
exclude: ['createTime', 'createUser', 'anxinProjectId',] |
|
|
|
}, |
|
|
|
}] |
|
|
|
}] |
|
|
|
} |
|
|
@ -262,12 +268,32 @@ async function apiErrorList (ctx) { |
|
|
|
if (page && limit) { |
|
|
|
findOption.offset = page * limit |
|
|
|
} |
|
|
|
if (!findOption.where.$or.length) { |
|
|
|
delete findOption.where.$or |
|
|
|
} |
|
|
|
const listRes = await models.AppAlarm.findAndCountAll(findOption) |
|
|
|
if (!keyword) { |
|
|
|
// 没有关键字筛选 查询关联的项目信息
|
|
|
|
let pepProjectIds = new Set() |
|
|
|
for(let lr of listRes){ |
|
|
|
|
|
|
|
for (let lr of listRes.rows) { |
|
|
|
if (lr.projectApp && lr.projectApp.projectCorrelation) { |
|
|
|
pepProjectIds.add(lr.projectApp.projectCorrelation.pepProjectId) |
|
|
|
} |
|
|
|
} |
|
|
|
if (pepProjectIds.size) { |
|
|
|
projectRes = await clickHouse.projectManage.query(` |
|
|
|
${pepProjectSql} |
|
|
|
WHERE id IN (${[...pepProjectIds].join(',')})` |
|
|
|
).toPromise() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (let lr of listRes.rows) { |
|
|
|
if (lr.projectApp && lr.projectApp.projectCorrelation) { |
|
|
|
let corPepProject = projectRes.find(p => p.id == lr.projectApp.projectCorrelation.pepProjectId) |
|
|
|
if (corPepProject) { |
|
|
|
lr.projectApp.projectCorrelation.dataValues.pepProject = corPepProject |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|