fix: 修复一处mysql的filter深层调用节点表达式时会出现的bug

This commit is contained in:
Pan Qiancheng 2026-01-13 15:02:37 +08:00
parent 66215811fc
commit 8f0319c648
2 changed files with 8 additions and 4 deletions

View File

@ -872,8 +872,10 @@ class MySqlTranslator extends sqlTranslator_1.SqlTranslator {
const refId = (expr)['#refId'];
const refAttr = (expr)['#refAttr'];
(0, assert_1.default)(refDict[refId]);
const attrText = `\`${refDict[refId][0]}\`.\`${refAttr}\``;
result = this.translateAttrInExpression(entity, (expr)['#refAttr'], attrText);
const [refAlias, refEntity] = refDict[refId];
const attrText = `\`${refAlias}\`.\`${refAttr}\``;
// 这里必须使用refEntity否则在filter深层嵌套节点表达式时会出现entity不对应
result = this.translateAttrInExpression(refEntity, (expr)['#refAttr'], attrText);
}
else {
(0, assert_1.default)(k.length === 1);

View File

@ -971,8 +971,10 @@ export class MySqlTranslator<ED extends EntityDict & BaseEntityDict> extends Sql
const refAttr = (expr)['#refAttr'];
assert(refDict[refId]);
const attrText = `\`${refDict[refId][0]}\`.\`${refAttr}\``;
result = this.translateAttrInExpression(entity, (expr)['#refAttr'], attrText);
const [refAlias, refEntity] = refDict[refId];
const attrText = `\`${refAlias}\`.\`${refAttr}\``;
// 这里必须使用refEntity否则在filter深层嵌套节点表达式时会出现entity不对应
result = this.translateAttrInExpression(refEntity as T, (expr)['#refAttr'], attrText);
}
else {
assert(k.length === 1);