Repository navigation
Fix parameter aliases in nested wrapper conditions - #7220
Merged
miemieYaho merged 7 commits intoOct 30, 2026
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.
Summary
Fix parameter-alias propagation when Java wrappers contain nested conditions or an existing lambda view.
MybatisMapperMethodchanges the root wrapper alias to match a custom@Param, but nested wrappers can still generate#{ew.paramNameValuePairs...}. Binding a mapper parameter namedfilterthen fails withParameter 'ew' not found. Previously rendered nested conditions can also restore the old alias when a subsequent condition invalidates the root SQL cache.Keep one shared alias holder across Java wrapper/lambda views, and recursively rewrite cached nested segments using the original alias. Preserve the wrapper nodes so consumers such as the optimistic-lock interceptor can still traverse them.
The change is scoped to root alias changes and Java wrapper views; it does not redesign Kotlin wrapper construction or child-local alias overrides. The diff contains one production file and four existing test files, with no workflow changes.
Reproduction
A mapper method accepting
@Param("filter") QueryWrapper<String> wrapperand SQL using${filter.customSqlSegment}fails to bind nested conditions such as:The root alias becomes
filter, but the nested placeholders can remain underew. The new mapper regression exercises alias conversion, XML SQL generation, and actualDefaultParameterHandlerbinding of all three parameters.Validation
AbstractWrapper, and 73/73 passes with the fix, with zero skipped tests. It was rerun after the formatting-only correction.214ee029b2c5057a388b31295853a3dd7913a692against basec24d00c44ed25e3ba10de7ae71217447fefe2165. All three jobs passed both commands:No extra module or test exclusions were added. The repository's existing default test-tag exclusions remain unchanged. This is the official build result, not a claim that the separate external-database/stress/build-metadata suites ran.