Browse Source

搜索修改

dev
wenlele 2 years ago
parent
commit
a02c8b7c2d
  1. 4
      api/.vscode/launch.json
  2. 5
      api/app/lib/controllers/project/index.js

4
api/.vscode/launch.json

@ -56,9 +56,9 @@
// "--clickHouseDataAlarm default", // "--clickHouseDataAlarm default",
// "--clickHouseIot iot", // "--clickHouseIot iot",
// //
"--clickHouseAnxincloud anxinyun", "--clickHouseAnxincloud anxinyun1",
"--clickHousePepEmis pepca8", "--clickHousePepEmis pepca8",
"--clickHouseProjectManage peppm", "--clickHouseProjectManage peppm8",
"--clickHouseVcmp video_access_dev", "--clickHouseVcmp video_access_dev",
"--clickHouseDataAlarm default", "--clickHouseDataAlarm default",
"--clickHouseIot iota", "--clickHouseIot iota",

5
api/app/lib/controllers/project/index.js

@ -65,6 +65,7 @@ async function pomsProject (ctx) {
WHERE project_name LIKE '%${keyword}%' WHERE project_name LIKE '%${keyword}%'
` `
).toPromise() || [] ).toPromise() || []
const anxinProjectRes = await clickHouse.anxinyun.query( const anxinProjectRes = await clickHouse.anxinyun.query(
`SELECT id,"name", `SELECT id,"name",
project_state AS projectState project_state AS projectState
@ -75,12 +76,12 @@ async function pomsProject (ctx) {
let anxinProjectId = anxinProjectRes.map(v => v.id) let anxinProjectId = anxinProjectRes.map(v => v.id)
findOption.where.$or = [ findOption.where.$or = [
{ name: { $like: `%${keyword}%` } },] { name: { $like: `%${keyword}%` } } ]
if (projectId.length > 0) { if (projectId.length > 0) {
findOption.where.$or.push({ pepProjectId: { $in: projectId } }) findOption.where.$or.push({ pepProjectId: { $in: projectId } })
} }
if (anxinProjectId.length > 0) { if (anxinProjectId.length > 0) {
findOption.where.$or.push({ anxinProjectId: { $contains: anxinProjectId } }) findOption.where.$or.push({ anxinProjectId: { $overlap: anxinProjectId } })
} }
} }

Loading…
Cancel
Save