Browse Source

无角色用户可查询得到

dev
巴林闲侠 2 years ago
parent
commit
9ae513288f
  1. 9
      api/app/lib/controllers/organization/index.js

9
api/app/lib/controllers/organization/index.js

@ -170,6 +170,8 @@ async function user (ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { clickHouse } = ctx.app.fs const { clickHouse } = ctx.app.fs
const sequelize = ctx.fs.dc.orm;
const { role, limit, page, } = ctx.query const { role, limit, page, } = ctx.query
const excludeField = ['lastInTime', 'inTimes', 'onlineDuration', 'lastInAddress', 'deleted', 'updateTime'] const excludeField = ['lastInTime', 'inTimes', 'onlineDuration', 'lastInAddress', 'deleted', 'updateTime']
@ -177,13 +179,20 @@ async function user (ctx) {
let findOption = { let findOption = {
attributes: { attributes: {
exclude: excludeField, exclude: excludeField,
// include: [[sequelize.fn('array_length', sequelize.col('role')), 'roleCount']]
}, },
where: { where: {
deleted: false, deleted: false,
$or: [{
$not: { $not: {
role: { $contained: ['SuperAdmin', 'admin'] } role: { $contained: ['SuperAdmin', 'admin'] }
} }
}, },
sequelize.where(sequelize.fn('cardinality', sequelize.col('role')), 0)],
// $not: {
// role: { $contained: ['SuperAdmin', 'admin'] }
// }
},
order: [['updateTime', 'DESC']] order: [['updateTime', 'DESC']]
} }
if (role) { if (role) {

Loading…
Cancel
Save