This commit is contained in:
parent
952f65132b
commit
ccce584a17
|
|
@ -458,168 +458,165 @@ var CascadeStore = /** @class */ (function (_super) {
|
|||
var _g = projection2[attr], subProjection_1 = _g.data, subFilter_1 = _g.filter, indexFrom_1 = _g.indexFrom, count_1 = _g.count, subSorter_1 = _g.sorter;
|
||||
var _h = tslib_1.__read(relation, 2), entity2_1 = _h[0], foreignKey_1 = _h[1];
|
||||
var isAggr = attr.endsWith('$$aggr');
|
||||
if (context instanceof AsyncRowStore_1.AsyncContext) {
|
||||
// cascade的聚合运算只有后台需要执行
|
||||
if (foreignKey_1) {
|
||||
// 基于属性的一对多
|
||||
if (isAggr) {
|
||||
// 是聚合运算
|
||||
cascadeSelectionFns.push(function (result) {
|
||||
var aggrResults = result.map(function (row) {
|
||||
var _a, _b;
|
||||
var aggrResult = aggregateFn.call(_this, entity2_1, {
|
||||
data: subProjection_1,
|
||||
filter: (0, filter_1.combineFilters)([(_a = {},
|
||||
_a[foreignKey_1] = row.id,
|
||||
_a), subFilter_1]),
|
||||
sorter: subSorter_1,
|
||||
indexFrom: indexFrom_1,
|
||||
count: count_1
|
||||
}, context, option);
|
||||
if (aggrResult instanceof Promise) {
|
||||
return aggrResult.then(function (aggrResultResult) {
|
||||
var _a;
|
||||
return Object.assign(row, (_a = {},
|
||||
_a[attr] = aggrResultResult,
|
||||
_a));
|
||||
});
|
||||
}
|
||||
else {
|
||||
Object.assign(row, (_b = {},
|
||||
_b[attr] = aggrResult,
|
||||
_b));
|
||||
}
|
||||
});
|
||||
if (aggrResults.length > 0 && aggrResults[0] instanceof Promise) {
|
||||
return Promise.all(aggrResults).then(function () { return undefined; });
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
// 是一对多查询
|
||||
cascadeSelectionFns.push(function (result) {
|
||||
var _a;
|
||||
var ids = result.map(function (ele) { return ele.id; });
|
||||
var dealWithSubRows = function (subRows) {
|
||||
var _a;
|
||||
// 这里如果result只有一行,则把返回结果直接置上,不对比外键值
|
||||
// 这样做的原因是有的对象的filter会被改写掉(userId),只能临时这样处理
|
||||
if (result.length == 1) {
|
||||
Object.assign(result[0], (_a = {},
|
||||
_a[attr] = subRows,
|
||||
if (foreignKey_1) {
|
||||
// 基于属性的一对多
|
||||
if (isAggr) {
|
||||
// 是聚合运算,只有后台才需要执行
|
||||
(context instanceof AsyncRowStore_1.AsyncContext) && cascadeSelectionFns.push(function (result) {
|
||||
var aggrResults = result.map(function (row) {
|
||||
var _a, _b;
|
||||
var aggrResult = aggregateFn.call(_this, entity2_1, {
|
||||
data: subProjection_1,
|
||||
filter: (0, filter_1.combineFilters)([(_a = {},
|
||||
_a[foreignKey_1] = row.id,
|
||||
_a), subFilter_1]),
|
||||
sorter: subSorter_1,
|
||||
indexFrom: indexFrom_1,
|
||||
count: count_1
|
||||
}, context, option);
|
||||
if (aggrResult instanceof Promise) {
|
||||
return aggrResult.then(function (aggrResultResult) {
|
||||
var _a;
|
||||
return Object.assign(row, (_a = {},
|
||||
_a[attr] = aggrResultResult,
|
||||
_a));
|
||||
}
|
||||
else {
|
||||
result.forEach(function (ele) {
|
||||
var _a;
|
||||
var subRowss = subRows.filter(function (ele2) { return ele2[foreignKey_1] === ele.id; });
|
||||
(0, assert_1.default)(subRowss);
|
||||
Object.assign(ele, (_a = {},
|
||||
_a[attr] = subRowss,
|
||||
_a));
|
||||
});
|
||||
}
|
||||
};
|
||||
if (ids.length > 0) {
|
||||
var subRows = cascadeSelectFn.call(_this, entity2_1, {
|
||||
data: subProjection_1,
|
||||
filter: (0, filter_1.combineFilters)([(_a = {},
|
||||
_a[foreignKey_1] = {
|
||||
$in: ids,
|
||||
},
|
||||
_a), subFilter_1]),
|
||||
sorter: subSorter_1,
|
||||
indexFrom: indexFrom_1,
|
||||
count: count_1
|
||||
}, context, option);
|
||||
if (subRows instanceof Promise) {
|
||||
return subRows.then(function (subRowss) { return dealWithSubRows(subRowss); });
|
||||
}
|
||||
dealWithSubRows(subRows);
|
||||
});
|
||||
}
|
||||
else {
|
||||
Object.assign(row, (_b = {},
|
||||
_b[attr] = aggrResult,
|
||||
_b));
|
||||
}
|
||||
});
|
||||
}
|
||||
if (aggrResults.length > 0 && aggrResults[0] instanceof Promise) {
|
||||
return Promise.all(aggrResults).then(function () { return undefined; });
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
// 基于entity的多对一
|
||||
if (isAggr) {
|
||||
// 是聚合运算
|
||||
cascadeSelectionFns.push(function (result) {
|
||||
var aggrResults = result.map(function (row) {
|
||||
var _a;
|
||||
var aggrResult = aggregateFn.call(_this, entity2_1, {
|
||||
data: subProjection_1,
|
||||
filter: (0, filter_1.combineFilters)([{
|
||||
entity: entity,
|
||||
entityId: row.id,
|
||||
}, subFilter_1]),
|
||||
sorter: subSorter_1,
|
||||
indexFrom: indexFrom_1,
|
||||
count: count_1
|
||||
}, context, option);
|
||||
if (aggrResult instanceof Promise) {
|
||||
return aggrResult.then(function (aggrResultResult) {
|
||||
var _a;
|
||||
return Object.assign(row, (_a = {},
|
||||
_a[attr] = aggrResultResult,
|
||||
_a));
|
||||
});
|
||||
}
|
||||
else {
|
||||
Object.assign(row, (_a = {},
|
||||
_a[attr] = aggrResult,
|
||||
// 是一对多查询
|
||||
cascadeSelectionFns.push(function (result) {
|
||||
var _a;
|
||||
var ids = result.map(function (ele) { return ele.id; });
|
||||
var dealWithSubRows = function (subRows) {
|
||||
var _a;
|
||||
// 这里如果result只有一行,则把返回结果直接置上,不对比外键值
|
||||
// 这样做的原因是有的对象的filter会被改写掉(userId),只能临时这样处理
|
||||
if (result.length == 1) {
|
||||
Object.assign(result[0], (_a = {},
|
||||
_a[attr] = subRows,
|
||||
_a));
|
||||
}
|
||||
else {
|
||||
result.forEach(function (ele) {
|
||||
var _a;
|
||||
var subRowss = subRows.filter(function (ele2) { return ele2[foreignKey_1] === ele.id; });
|
||||
(0, assert_1.default)(subRowss);
|
||||
Object.assign(ele, (_a = {},
|
||||
_a[attr] = subRowss,
|
||||
_a));
|
||||
}
|
||||
});
|
||||
if (aggrResults.length > 0 && aggrResults[0] instanceof Promise) {
|
||||
return Promise.all(aggrResults).then(function () { return undefined; });
|
||||
});
|
||||
}
|
||||
};
|
||||
if (ids.length > 0) {
|
||||
var subRows = cascadeSelectFn.call(_this, entity2_1, {
|
||||
data: subProjection_1,
|
||||
filter: (0, filter_1.combineFilters)([(_a = {},
|
||||
_a[foreignKey_1] = {
|
||||
$in: ids,
|
||||
},
|
||||
_a), subFilter_1]),
|
||||
sorter: subSorter_1,
|
||||
indexFrom: indexFrom_1,
|
||||
count: count_1
|
||||
}, context, option);
|
||||
if (subRows instanceof Promise) {
|
||||
return subRows.then(function (subRowss) { return dealWithSubRows(subRowss); });
|
||||
}
|
||||
dealWithSubRows(subRows);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 基于entity的多对一
|
||||
if (isAggr) {
|
||||
// 是聚合运算,只有后台才需要执行
|
||||
(context instanceof AsyncRowStore_1.AsyncContext) && cascadeSelectionFns.push(function (result) {
|
||||
var aggrResults = result.map(function (row) {
|
||||
var _a;
|
||||
var aggrResult = aggregateFn.call(_this, entity2_1, {
|
||||
data: subProjection_1,
|
||||
filter: (0, filter_1.combineFilters)([{
|
||||
entity: entity,
|
||||
entityId: row.id,
|
||||
}, subFilter_1]),
|
||||
sorter: subSorter_1,
|
||||
indexFrom: indexFrom_1,
|
||||
count: count_1
|
||||
}, context, option);
|
||||
if (aggrResult instanceof Promise) {
|
||||
return aggrResult.then(function (aggrResultResult) {
|
||||
var _a;
|
||||
return Object.assign(row, (_a = {},
|
||||
_a[attr] = aggrResultResult,
|
||||
_a));
|
||||
});
|
||||
}
|
||||
else {
|
||||
Object.assign(row, (_a = {},
|
||||
_a[attr] = aggrResult,
|
||||
_a));
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
// 是一对多查询
|
||||
cascadeSelectionFns.push(function (result) {
|
||||
var ids = result.map(function (ele) { return ele.id; });
|
||||
var dealWithSubRows = function (subRows) {
|
||||
var _a;
|
||||
// 这里如果result只有一行,则把返回结果直接置上,不对比外键值
|
||||
// 这样做的原因是有的对象的filter会被改写掉(userId),只能临时这样处理
|
||||
if (result.length === 1) {
|
||||
Object.assign(result[0], (_a = {},
|
||||
_a[attr] = subRows,
|
||||
_a));
|
||||
}
|
||||
else {
|
||||
result.forEach(function (ele) {
|
||||
var _a;
|
||||
var subRowss = subRows.filter(function (ele2) { return ele2.entityId === ele.id; });
|
||||
(0, assert_1.default)(subRowss);
|
||||
Object.assign(ele, (_a = {},
|
||||
_a[attr] = subRowss,
|
||||
_a));
|
||||
});
|
||||
}
|
||||
};
|
||||
if (ids.length > 0) {
|
||||
var subRows = cascadeSelectFn.call(_this, entity2_1, {
|
||||
data: subProjection_1,
|
||||
filter: (0, filter_1.combineFilters)([{
|
||||
entity: entity,
|
||||
entityId: {
|
||||
$in: ids,
|
||||
}
|
||||
}, subFilter_1]),
|
||||
sorter: subSorter_1,
|
||||
indexFrom: indexFrom_1,
|
||||
count: count_1
|
||||
}, context, option);
|
||||
if (subRows instanceof Promise) {
|
||||
return subRows.then(function (subRowss) { return dealWithSubRows(subRowss); });
|
||||
}
|
||||
dealWithSubRows(subRows);
|
||||
if (aggrResults.length > 0 && aggrResults[0] instanceof Promise) {
|
||||
return Promise.all(aggrResults).then(function () { return undefined; });
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
// 是一对多查询
|
||||
cascadeSelectionFns.push(function (result) {
|
||||
var ids = result.map(function (ele) { return ele.id; });
|
||||
var dealWithSubRows = function (subRows) {
|
||||
var _a;
|
||||
// 这里如果result只有一行,则把返回结果直接置上,不对比外键值
|
||||
// 这样做的原因是有的对象的filter会被改写掉(userId),只能临时这样处理
|
||||
if (result.length === 1) {
|
||||
Object.assign(result[0], (_a = {},
|
||||
_a[attr] = subRows,
|
||||
_a));
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
result.forEach(function (ele) {
|
||||
var _a;
|
||||
var subRowss = subRows.filter(function (ele2) { return ele2.entityId === ele.id; });
|
||||
(0, assert_1.default)(subRowss);
|
||||
Object.assign(ele, (_a = {},
|
||||
_a[attr] = subRowss,
|
||||
_a));
|
||||
});
|
||||
}
|
||||
};
|
||||
if (ids.length > 0) {
|
||||
var subRows = cascadeSelectFn.call(_this, entity2_1, {
|
||||
data: subProjection_1,
|
||||
filter: (0, filter_1.combineFilters)([{
|
||||
entity: entity,
|
||||
entityId: {
|
||||
$in: ids,
|
||||
}
|
||||
}, subFilter_1]),
|
||||
sorter: subSorter_1,
|
||||
indexFrom: indexFrom_1,
|
||||
count: count_1
|
||||
}, context, option);
|
||||
if (subRows instanceof Promise) {
|
||||
return subRows.then(function (subRowss) { return dealWithSubRows(subRowss); });
|
||||
}
|
||||
dealWithSubRows(subRows);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -564,194 +564,191 @@ export abstract class CascadeStore<ED extends EntityDict & BaseEntityDict> exten
|
|||
const { data: subProjection, filter: subFilter, indexFrom, count, sorter: subSorter } = projection2[attr];
|
||||
const [entity2, foreignKey] = relation;
|
||||
const isAggr = attr.endsWith('$$aggr');
|
||||
if (context instanceof AsyncContext) {
|
||||
// cascade的聚合运算只有后台需要执行
|
||||
if (foreignKey) {
|
||||
// 基于属性的一对多
|
||||
if (isAggr) {
|
||||
// 是聚合运算
|
||||
cascadeSelectionFns.push(
|
||||
(result) => {
|
||||
const aggrResults = result.map(
|
||||
(row) => {
|
||||
const aggrResult = aggregateFn.call(this, entity2, {
|
||||
data: subProjection,
|
||||
filter: combineFilters([{
|
||||
[foreignKey]: row.id,
|
||||
}, subFilter]),
|
||||
sorter: subSorter,
|
||||
indexFrom,
|
||||
count
|
||||
}, context, option);
|
||||
if (aggrResult instanceof Promise) {
|
||||
return aggrResult.then(
|
||||
(aggrResultResult) => Object.assign(row, {
|
||||
[attr]: aggrResultResult,
|
||||
})
|
||||
);
|
||||
}
|
||||
else {
|
||||
Object.assign(row, {
|
||||
[attr]: aggrResult,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
if (aggrResults.length > 0 && aggrResults[0] instanceof Promise) {
|
||||
return Promise.all(aggrResults).then(
|
||||
() => undefined
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
// 是一对多查询
|
||||
cascadeSelectionFns.push(
|
||||
(result) => {
|
||||
const ids = result.map(
|
||||
ele => ele.id
|
||||
) as string[];
|
||||
|
||||
const dealWithSubRows = (subRows: Partial<ED[keyof ED]['Schema']>[]) => {
|
||||
// 这里如果result只有一行,则把返回结果直接置上,不对比外键值
|
||||
// 这样做的原因是有的对象的filter会被改写掉(userId),只能临时这样处理
|
||||
if (result.length == 1) {
|
||||
Object.assign(result[0], {
|
||||
[attr]: subRows,
|
||||
});
|
||||
}
|
||||
else {
|
||||
result.forEach(
|
||||
(ele) => {
|
||||
const subRowss = subRows.filter(
|
||||
ele2 => ele2[foreignKey] === ele.id
|
||||
);
|
||||
assert(subRowss);
|
||||
Object.assign(ele, {
|
||||
[attr]: subRowss,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
if (ids.length > 0) {
|
||||
const subRows = cascadeSelectFn.call(this, entity2, {
|
||||
if (foreignKey) {
|
||||
// 基于属性的一对多
|
||||
if (isAggr) {
|
||||
// 是聚合运算,只有后台才需要执行
|
||||
(context instanceof AsyncContext) && cascadeSelectionFns.push(
|
||||
(result) => {
|
||||
const aggrResults = result.map(
|
||||
(row) => {
|
||||
const aggrResult = aggregateFn.call(this, entity2, {
|
||||
data: subProjection,
|
||||
filter: combineFilters([{
|
||||
[foreignKey]: {
|
||||
$in: ids,
|
||||
}
|
||||
[foreignKey]: row.id,
|
||||
}, subFilter]),
|
||||
sorter: subSorter,
|
||||
indexFrom,
|
||||
count
|
||||
}, context, option);
|
||||
if (subRows instanceof Promise) {
|
||||
return subRows.then(
|
||||
(subRowss) => dealWithSubRows(subRowss)
|
||||
if (aggrResult instanceof Promise) {
|
||||
return aggrResult.then(
|
||||
(aggrResultResult) => Object.assign(row, {
|
||||
[attr]: aggrResultResult,
|
||||
})
|
||||
);
|
||||
}
|
||||
dealWithSubRows(subRows as any);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 基于entity的多对一
|
||||
if (isAggr) {
|
||||
// 是聚合运算
|
||||
cascadeSelectionFns.push(
|
||||
(result) => {
|
||||
const aggrResults = result.map(
|
||||
(row) => {
|
||||
const aggrResult = aggregateFn.call(this, entity2, {
|
||||
data: subProjection,
|
||||
filter: combineFilters([{
|
||||
entity,
|
||||
entityId: row.id,
|
||||
}, subFilter]),
|
||||
sorter: subSorter,
|
||||
indexFrom,
|
||||
count
|
||||
}, context, option);
|
||||
if (aggrResult instanceof Promise) {
|
||||
return aggrResult.then(
|
||||
(aggrResultResult) => Object.assign(row, {
|
||||
[attr]: aggrResultResult,
|
||||
})
|
||||
);
|
||||
}
|
||||
else {
|
||||
Object.assign(row, {
|
||||
[attr]: aggrResult,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
if (aggrResults.length > 0 && aggrResults[0] instanceof Promise) {
|
||||
return Promise.all(aggrResults).then(
|
||||
() => undefined
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
// 是一对多查询
|
||||
cascadeSelectionFns.push(
|
||||
(result) => {
|
||||
const ids = result.map(
|
||||
ele => ele.id
|
||||
) as string[];
|
||||
const dealWithSubRows = (subRows: Partial<ED[T]['Schema']>[]) => {
|
||||
// 这里如果result只有一行,则把返回结果直接置上,不对比外键值
|
||||
// 这样做的原因是有的对象的filter会被改写掉(userId),只能临时这样处理
|
||||
if (result.length === 1) {
|
||||
Object.assign(result[0], {
|
||||
[attr]: subRows,
|
||||
});
|
||||
}
|
||||
else {
|
||||
result.forEach(
|
||||
(ele) => {
|
||||
const subRowss = subRows.filter(
|
||||
ele2 => ele2.entityId === ele.id
|
||||
);
|
||||
assert(subRowss);
|
||||
Object.assign(ele, {
|
||||
[attr]: subRowss,
|
||||
});
|
||||
}
|
||||
);
|
||||
Object.assign(row, {
|
||||
[attr]: aggrResult,
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
if (aggrResults.length > 0 && aggrResults[0] instanceof Promise) {
|
||||
return Promise.all(aggrResults).then(
|
||||
() => undefined
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
// 是一对多查询
|
||||
cascadeSelectionFns.push(
|
||||
(result) => {
|
||||
const ids = result.map(
|
||||
ele => ele.id
|
||||
) as string[];
|
||||
|
||||
if (ids.length > 0) {
|
||||
const subRows = cascadeSelectFn.call(this, entity2, {
|
||||
const dealWithSubRows = (subRows: Partial<ED[keyof ED]['Schema']>[]) => {
|
||||
// 这里如果result只有一行,则把返回结果直接置上,不对比外键值
|
||||
// 这样做的原因是有的对象的filter会被改写掉(userId),只能临时这样处理
|
||||
if (result.length == 1) {
|
||||
Object.assign(result[0], {
|
||||
[attr]: subRows,
|
||||
});
|
||||
}
|
||||
else {
|
||||
result.forEach(
|
||||
(ele) => {
|
||||
const subRowss = subRows.filter(
|
||||
ele2 => ele2[foreignKey] === ele.id
|
||||
);
|
||||
assert(subRowss);
|
||||
Object.assign(ele, {
|
||||
[attr]: subRowss,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
if (ids.length > 0) {
|
||||
const subRows = cascadeSelectFn.call(this, entity2, {
|
||||
data: subProjection,
|
||||
filter: combineFilters([{
|
||||
[foreignKey]: {
|
||||
$in: ids,
|
||||
}
|
||||
}, subFilter]),
|
||||
sorter: subSorter,
|
||||
indexFrom,
|
||||
count
|
||||
}, context, option);
|
||||
if (subRows instanceof Promise) {
|
||||
return subRows.then(
|
||||
(subRowss) => dealWithSubRows(subRowss)
|
||||
);
|
||||
}
|
||||
dealWithSubRows(subRows as any);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 基于entity的多对一
|
||||
if (isAggr) {
|
||||
// 是聚合运算,只有后台才需要执行
|
||||
(context instanceof AsyncContext) && cascadeSelectionFns.push(
|
||||
(result) => {
|
||||
const aggrResults = result.map(
|
||||
(row) => {
|
||||
const aggrResult = aggregateFn.call(this, entity2, {
|
||||
data: subProjection,
|
||||
filter: combineFilters([{
|
||||
entity,
|
||||
entityId: {
|
||||
$in: ids,
|
||||
}
|
||||
entityId: row.id,
|
||||
}, subFilter]),
|
||||
sorter: subSorter,
|
||||
indexFrom,
|
||||
count
|
||||
}, context, option);
|
||||
if (subRows instanceof Promise) {
|
||||
return subRows.then(
|
||||
(subRowss) => dealWithSubRows(subRowss)
|
||||
if (aggrResult instanceof Promise) {
|
||||
return aggrResult.then(
|
||||
(aggrResultResult) => Object.assign(row, {
|
||||
[attr]: aggrResultResult,
|
||||
})
|
||||
);
|
||||
}
|
||||
dealWithSubRows(subRows as any);
|
||||
else {
|
||||
Object.assign(row, {
|
||||
[attr]: aggrResult,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
if (aggrResults.length > 0 && aggrResults[0] instanceof Promise) {
|
||||
return Promise.all(aggrResults).then(
|
||||
() => undefined
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
// 是一对多查询
|
||||
cascadeSelectionFns.push(
|
||||
(result) => {
|
||||
const ids = result.map(
|
||||
ele => ele.id
|
||||
) as string[];
|
||||
const dealWithSubRows = (subRows: Partial<ED[T]['Schema']>[]) => {
|
||||
// 这里如果result只有一行,则把返回结果直接置上,不对比外键值
|
||||
// 这样做的原因是有的对象的filter会被改写掉(userId),只能临时这样处理
|
||||
if (result.length === 1) {
|
||||
Object.assign(result[0], {
|
||||
[attr]: subRows,
|
||||
});
|
||||
}
|
||||
else {
|
||||
result.forEach(
|
||||
(ele) => {
|
||||
const subRowss = subRows.filter(
|
||||
ele2 => ele2.entityId === ele.id
|
||||
);
|
||||
assert(subRowss);
|
||||
Object.assign(ele, {
|
||||
[attr]: subRowss,
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
if (ids.length > 0) {
|
||||
const subRows = cascadeSelectFn.call(this, entity2, {
|
||||
data: subProjection,
|
||||
filter: combineFilters([{
|
||||
entity,
|
||||
entityId: {
|
||||
$in: ids,
|
||||
}
|
||||
}, subFilter]),
|
||||
sorter: subSorter,
|
||||
indexFrom,
|
||||
count
|
||||
}, context, option);
|
||||
if (subRows instanceof Promise) {
|
||||
return subRows.then(
|
||||
(subRowss) => dealWithSubRows(subRowss)
|
||||
);
|
||||
}
|
||||
dealWithSubRows(subRows as any);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue