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.
该Pull Request关联的Issue
无
修改描述
复用wrapper,当增加新的查询条件后,sql未重新生成
测试用例
@Test public void testReuseWrapper() { MPJLambdaWrapper wrapper = new MPJLambdaWrapper() .select(UserDO::getName); List dos = userService.list(wrapper); System.out.println(1); wrapper.select(UserDO::getAddressId); dos = userService.list(wrapper); }
修复效果的截屏
修复前的sql输出日志:
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@58a2b917] was not registered for synchronization because synchronization is not active
JDBC Connection [HikariProxyConnection@1328705686 wrapping conn0: url=jdbc:h2:mem:test user=ROOT] will not be managed by Spring
==> Preparing: SELECT t.
name
FROMuser
t WHERE t.del = false==> Parameters:
<== Columns: NAME
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Total: 22
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@58a2b917]
1
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3a3ed300] was not registered for synchronization because synchronization is not active
JDBC Connection [HikariProxyConnection@972404515 wrapping conn0: url=jdbc:h2:mem:test user=ROOT] will not be managed by Spring
==> Preparing: SELECT t.
name
FROMuser
t WHERE t.del = false=====================这里的sql没有查询t.address_id字段========================
==> Parameters:
<== Columns: NAME
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Total: 22
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3a3ed300]
修复后的sql输出日志:
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@58a2b917] was not registered for synchronization because synchronization is not active
JDBC Connection [HikariProxyConnection@1328705686 wrapping conn0: url=jdbc:h2:mem:test user=ROOT] will not be managed by Spring
==> Preparing: SELECT t.
name
FROMuser
t WHERE t.del = false==> Parameters:
<== Columns: NAME
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Row: {"aa":"aaa","bb":"bbb"}
<== Total: 22
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@58a2b917]
1
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3a3ed300] was not registered for synchronization because synchronization is not active
JDBC Connection [HikariProxyConnection@972404515 wrapping conn0: url=jdbc:h2:mem:test user=ROOT] will not be managed by Spring
==> Preparing: SELECT t.
name
, t.address_id FROMuser
t WHERE t.del = false==> Parameters:
<== Columns: NAME, ADDRESS_ID
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Row: {"aa":"aaa","bb":"bbb"}, 1
<== Total: 22
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@3a3ed300]