From 05e8feb2f21fb9dc4e9417c89cdab872b8964e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zhaobing=E2=80=99?= Date: Tue, 14 Nov 2023 16:40:09 +0800 Subject: [PATCH] feat:fix bugs --- api/app/lib/controllers/monitor/index.js | 82 ++++++++++++------------ 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/api/app/lib/controllers/monitor/index.js b/api/app/lib/controllers/monitor/index.js index 667c82a..07be032 100644 --- a/api/app/lib/controllers/monitor/index.js +++ b/api/app/lib/controllers/monitor/index.js @@ -22,48 +22,48 @@ async function getStructures (ctx) { } } let undelStrucRes=[] - // if (bindRes) { - // undelStrucRes = anxinProjectIds.size ? - // await clickHouse.anxinyun.query( - // ` - // SELECT - // t_structure.id AS strucId, - // t_structure.name AS strucName - // FROM - // t_project - // LEFT JOIN - // t_project_structure - // ON t_project_structure.project = t_project.id - // LEFT JOIN - // t_project_structuregroup - // ON t_project_structuregroup.project = t_project.id - // LEFT JOIN - // t_structuregroup_structure - // ON t_structuregroup_structure.structuregroup = t_project_structuregroup.structuregroup - // LEFT JOIN - // t_project_construction - // ON t_project_construction.project = t_project.id - // LEFT JOIN - // t_structure_site - // ON t_structure_site.siteid = t_project_construction.construction - // RIGHT JOIN - // t_structure - // ON t_structure.id = t_project_structure.structure - // OR t_structure.id = t_structuregroup_structure.structure - // OR t_structure.id = t_structure_site.structid + if (bindRes) { + undelStrucRes = anxinProjectIds.size ? + await clickHouse.anxinyun.query( + ` + SELECT + t_structure.id AS strucId, + t_structure.name AS strucName + FROM + t_project + LEFT JOIN + t_project_structure + ON t_project_structure.project = t_project.id + LEFT JOIN + t_project_structuregroup + ON t_project_structuregroup.project = t_project.id + LEFT JOIN + t_structuregroup_structure + ON t_structuregroup_structure.structuregroup = t_project_structuregroup.structuregroup + LEFT JOIN + t_project_construction + ON t_project_construction.project = t_project.id + LEFT JOIN + t_structure_site + ON t_structure_site.siteid = t_project_construction.construction + RIGHT JOIN + t_structure + ON t_structure.id = t_project_structure.structure + OR t_structure.id = t_structuregroup_structure.structure + OR t_structure.id = t_structure_site.structid - // WHERE - // project_state != -1 - // AND - // t_project.id IN (${[...anxinProjectIds].join(',')}, -1) - // AND t_structure.external_platform is not null - // ORDER BY strucId - // ` - // ).toPromise() : - // [] - // } - undelStrucRes.push({strucId:4036,strucName:'象山港大桥'}) - undelStrucRes.push({strucId:1,strucName:'象山港大'}) + WHERE + project_state != -1 + AND + t_project.id IN (${[...anxinProjectIds].join(',')}, -1) + AND t_structure.external_platform is not null + ORDER BY strucId + ` + ).toPromise() : + [] + } + // undelStrucRes.push({strucId:4036,strucName:'象山港大桥'}) + // undelStrucRes.push({strucId:1,strucName:'象山港大'}) ctx.status = 200; ctx.body = undelStrucRes } catch (error) {