Browse Source

feat:fix bugs

dev
zhaobing’ 1 year ago
parent
commit
05e8feb2f2
  1. 82
      api/app/lib/controllers/monitor/index.js

82
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) {

Loading…
Cancel
Save