This commit is contained in:
Xu Chang 2023-05-06 14:55:20 +08:00
parent 952f65132b
commit ccce584a17
2 changed files with 312 additions and 318 deletions

View File

@ -458,13 +458,11 @@ 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) {
// 是聚合运算,只有后台才需要执行
(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, {
@ -543,8 +541,8 @@ var CascadeStore = /** @class */ (function (_super) {
else {
// 基于entity的多对一
if (isAggr) {
// 是聚合运算
cascadeSelectionFns.push(function (result) {
// 是聚合运算,只有后台才需要执行
(context instanceof AsyncRowStore_1.AsyncContext) && cascadeSelectionFns.push(function (result) {
var aggrResults = result.map(function (row) {
var _a;
var aggrResult = aggregateFn.call(_this, entity2_1, {
@ -622,7 +620,6 @@ var CascadeStore = /** @class */ (function (_super) {
}
}
}
}
};
var this_1 = this;
for (var attr in projection2) {

View File

@ -564,13 +564,11 @@ 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(
// 是聚合运算,只有后台才需要执行
(context instanceof AsyncContext) && cascadeSelectionFns.push(
(result) => {
const aggrResults = result.map(
(row) => {
@ -662,8 +660,8 @@ export abstract class CascadeStore<ED extends EntityDict & BaseEntityDict> exten
else {
// 基于entity的多对一
if (isAggr) {
// 是聚合运算
cascadeSelectionFns.push(
// 是聚合运算,只有后台才需要执行
(context instanceof AsyncContext) && cascadeSelectionFns.push(
(result) => {
const aggrResults = result.map(
(row) => {
@ -755,7 +753,6 @@ export abstract class CascadeStore<ED extends EntityDict & BaseEntityDict> exten
}
}
}
}
return {
projection,