支持在 join on 子句中追加 scoped DSL 条件 - #1
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
本 PR 为 dslquery 增加了在关联查询
join on子句中追加额外条件的能力,同时保持现有注解模型和字符串 DSL 风格不变。新增能力
@JoinOn注解,可在关联字段上声明额外的on条件DSLQuery.joinOn(path, dsl)运行时 API,可按关联路径动态追加on条件self.xxx:当前 join 目标对象parent.xxx:当前 join 的上一级对象root.xxx:根查询对象@fieldPath形式的字段引用值,例如:@parent.tenantId@root.areaCode实现细节
JoinField渲染 join SQL 时,将基础关联条件和额外 on 条件统一合并JoinOnSQLBuilder,专门负责 scoped DSL 到 SQL 的转换和参数绑定SingleExpression增加了仅对 join-on builder 生效的字段引用值解析where语义不变,普通where中以@开头的值仍按字面量处理文档与测试
@JoinOn、joinOn(path, dsl)和self/parent/root的用法验证
已执行:
gradle -I /tmp/gradle8-jacoco-compat.init.gradle test结果:
BUILD SUCCESSFUL