|
@@ -66,8 +66,11 @@ class CrudService extends NafService {
|
|
|
let condition = cloneDeep(filter);
|
|
|
// 分站模式确认
|
|
|
condition = this.dealFilter(condition);
|
|
|
- const _tenant = this.isMultiTenancy();
|
|
|
- if (_tenant) condition._tenant = _tenant;
|
|
|
+ const isOpenMultiTenancy = get(this.app, 'plugins.multiTenancy');
|
|
|
+ if (isOpenMultiTenancy) {
|
|
|
+ const _tenant = this.isMultiTenancy();
|
|
|
+ if (_tenant) condition._tenant = _tenant;
|
|
|
+ }
|
|
|
const pipeline = [{ $match: condition }];
|
|
|
// 先排序
|
|
|
if (sort) pipeline.push({ $sort: sort });
|
|
@@ -87,8 +90,11 @@ class CrudService extends NafService {
|
|
|
let condition = cloneDeep(filter);
|
|
|
condition = this.dealFilter(condition);
|
|
|
// 分站模式确认
|
|
|
- const _tenant = this.isMultiTenancy();
|
|
|
- if (_tenant) condition._tenant = _tenant;
|
|
|
+ const isOpenMultiTenancy = get(this.app, 'plugins.multiTenancy');
|
|
|
+ if (isOpenMultiTenancy) {
|
|
|
+ const _tenant = this.isMultiTenancy();
|
|
|
+ if (_tenant) condition._tenant = _tenant;
|
|
|
+ }
|
|
|
let count = 0;
|
|
|
const res = await this.model.aggregate([{ $match: condition }, { $count: 'id' }]);
|
|
|
if (res && isArray(res)) {
|