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']] }