From 6122455ad6f1d382d80672186d30695410a0ee21 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Mon, 26 Sep 2022 10:24:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6->=E9=A1=B9=E7=9B=AE=E9=98=B6?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/data.js | 4 +++- api/app/lib/utils/dataRange.js | 18 +++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/api/app/lib/controllers/alarm/data.js b/api/app/lib/controllers/alarm/data.js index 384bd5f..9d4a0c5 100644 --- a/api/app/lib/controllers/alarm/data.js +++ b/api/app/lib/controllers/alarm/data.js @@ -125,8 +125,10 @@ async function list (ctx) { // TODO: 开发临时添加 { id: 999, - name: '这是假的开发の数据,看到请拨打110', + projectName: '这是假的开发の数据,看到请拨打110', isdelete: 0, + constructionStatusId: 1, + constructionStatus: '建设中', } ] }).pepProject diff --git a/api/app/lib/utils/dataRange.js b/api/app/lib/utils/dataRange.js index 7a207b0..84f332c 100644 --- a/api/app/lib/utils/dataRange.js +++ b/api/app/lib/utils/dataRange.js @@ -38,8 +38,8 @@ module.exports = function (app, opts) { // 根据 poms 的项目绑定关系查相关联的项企项目、安心云项目id信息 const bindRes = await models.ProjectCorrelation.findAll(findOption) - // 获取不重复的 安心云项目id - let pepProjectIds = bindRes.map(b => b.pepProjectId) + // 获取不重复的 安心云项目id + let pepProjectIds = bindRes.map(b => b.pepProjectId) // 查询项企项目的信息 let pepProjectWhereOptions = [] @@ -49,10 +49,18 @@ module.exports = function (app, opts) { const pepProjectRes = pepProjectIds.length ? await clickHouse.projectManage.query( ` - SELECT - id, project_name AS name, isdelete + SELECT + t_pim_project.id AS id, + t_pim_project.project_name AS projectName, + t_pim_project.isdelete AS isdelete, + t_pim_project_construction.construction_status_id AS constructionStatusId, + t_pim_project_state.construction_status AS constructionStatus FROM t_pim_project + LEFT JOIN t_pim_project_construction + ON t_pim_project.id = t_pim_project_construction.project_id + LEFT JOIN t_pim_project_state + ON t_pim_project_construction.construction_status_id = t_pim_project_state.id WHERE id IN (${pepProjectIds.join(',')}) ${pepProjectWhereOptions.length ? `AND ${pepProjectWhereOptions.join(' AND ')}` @@ -61,7 +69,7 @@ module.exports = function (app, opts) { ).toPromise() : [] - + const anxinProjectIds = [ ...( bindRes.filter(b => pepProjectRes.some(pp => pp.id == b.pepProjectId))