From 9ae513288fae6121415895cbcba939cc2e93d137 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 22 Sep 2022 09:35:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0=E8=A7=92=E8=89=B2=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8F=AF=E6=9F=A5=E8=AF=A2=E5=BE=97=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/organization/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/api/app/lib/controllers/organization/index.js b/api/app/lib/controllers/organization/index.js index 8058afc..74fee26 100644 --- a/api/app/lib/controllers/organization/index.js +++ b/api/app/lib/controllers/organization/index.js @@ -170,6 +170,8 @@ async function user (ctx) { try { const models = ctx.fs.dc.models; const { clickHouse } = ctx.app.fs + const sequelize = ctx.fs.dc.orm; + const { role, limit, page, } = ctx.query const excludeField = ['lastInTime', 'inTimes', 'onlineDuration', 'lastInAddress', 'deleted', 'updateTime'] @@ -177,12 +179,19 @@ async function user (ctx) { let findOption = { attributes: { exclude: excludeField, + // include: [[sequelize.fn('array_length', sequelize.col('role')), 'roleCount']] }, where: { deleted: false, - $not: { - role: { $contained: ['SuperAdmin', 'admin'] } - } + $or: [{ + $not: { + role: { $contained: ['SuperAdmin', 'admin'] } + } + }, + sequelize.where(sequelize.fn('cardinality', sequelize.col('role')), 0)], + // $not: { + // role: { $contained: ['SuperAdmin', 'admin'] } + // } }, order: [['updateTime', 'DESC']] }