diff --git a/api/app/lib/utils/dataRange.js b/api/app/lib/utils/dataRange.js index 1b31857..570b410 100644 --- a/api/app/lib/utils/dataRange.js +++ b/api/app/lib/utils/dataRange.js @@ -21,14 +21,20 @@ module.exports = function (app, opts) { const { clickHouse } = ctx.app.fs const { correlationProject = [] } = userInfo - - // TODO 这儿也许需要判断传进来的 pepProjectId 在不在当前用户的关注范围内 - const bindRes = await models.ProjectCorrelation.findAll({ + const isSuper = judgeSuper(ctx) + let findOption = { where: { - id: { $in: pepProjectId ? [pepProjectId] : correlationProject }, del: false } - }) + } + if (pepProjectId) { + findOption.where.pepProjectId = pepProjectId + } else if (!isSuper) { + findOption.where.id = { $in: correlationProject } + } + + // TODO 这儿也许需要判断传进来的 pepProjectId 在不在当前用户的关注范围内 + const bindRes = await models.ProjectCorrelation.findAll(findOption) const anxinStrucIds = [ ...bindRes.reduce( @@ -42,6 +48,7 @@ module.exports = function (app, opts) { ) ] + // 查结构物 左联 项目 ,项目 id 在关注的项目里 const undelStrucRes = anxinStrucIds.length ? await clickHouse.anxinyun.query(` SELECT @@ -49,7 +56,7 @@ module.exports = function (app, opts) { FROM t_project WHERE - project_state = 4 + project_state != -1 AND id IN (${anxinStrucIds.join(',')}) `).toPromise() :