fix(extension): support foreach parameters in data change recorder#7133
Open
smf-h wants to merge 3 commits into
Open
fix(extension): support foreach parameters in data change recorder#7133smf-h wants to merge 3 commits into
smf-h wants to merge 3 commits into
Conversation
Contributor
Author
|
补充一个更贴近真实使用链路的复现说明,方便 review。 真实问题场景业务中常见的写法是自定义 Mapper XML 里用 <insert id="insertUsersByXmlForeach">
insert into h2user(test_id, name, age, test_type) values
<foreach collection="list" item="item" separator=",">
(#{item.testId}, #{item.name}, #{item.age}, #{item.testType})
</foreach>
</insert>调用方式类似: mapper.insertUsersByXmlForeach(Arrays.asList(
new H2User(id1, "xmlForeachInsertA", AgeEnum.ONE, 1),
new H2User(id2, "xmlForeachInsertB", AgeEnum.TWO, 1)
));MyBatis 在解析 这些 修复前的问题
本 PR 的修复解析参数值时改为:
这样可以支持 新增真实回归测试我补充了一个真实链路的集成测试,不再只手动构造
测试链路是: 测试断言包括:
本地已验证: 同时 |
e24207f to
db0b3c4
Compare
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.
Related to #7061.
Summary
__frch_item_0.idthroughBoundSqladditional parameters before falling back to the original parameter object lookup.DataChangeRecorderInnerInterceptorrecord inserted values from foreach item/list data instead of failing to resolve the generated foreach binding names.Validation
git diff --check origin/3.0...HEADpassed../gradlew.bat --versionused cached Gradle 8.13../gradlew.bat :mybatis-plus-jsqlparser-support:mybatis-plus-jsqlparser:testClasses :mybatis-plus-jsqlparser-support:mybatis-plus-jsqlparser-4.9:testClasses :mybatis-plus-jsqlparser-support:mybatis-plus-jsqlparser-5.0:testClasses --no-daemon --max-workers=1passed.DataChangeRecorderInnerInterceptorTestexecution was attempted, but the local Gradle test worker failed before running tests withClassNotFoundException: worker.org.gradle.process.internal.worker.GradleWorkerMain.