Some changes in the higher version of MyBatisPlus (3.4.2)
SelectMapsPage of MyBatisPlus (Page type inconsistent error)
If the old version is written, an error will be reported
//测试selectMapsPage分页:结果集是Map
@Test
public void testSelectMapsPage(){
Page<User> page = new Page<>(2,3);
userMapper.selectMapsPage(page, null)
page.getRecords().forEach(System.out::println);
}
'selectMapsPage(E, com.baomidou.mybatisplus.core.conditions.Wrapper<com.example.entity.User>)' in 'com.baomidou.mybatisplus.core.mapper.BaseMapper' cannot be applied to '(com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.example.entity.User>, null)'
The new version is written, my mybatis is 3.4.2
@Test
public void selectMapsPage() {
IPage<Map<String, Object>> page = new Page<>(2, 3);
userMapper.selectMapsPage(page, null);
page.getRecords().forEach(System.out::println);
}
Tombstone plugin reports an error
This is caused by the high version of mybatisplus (mine is 3.4.2), the high version and the plug-in that does not need to register tombstone, just add the @TableLogic annotation to the tombstone field to indicate tombstone @TableLogic(value=
" original value", delval="modified value")
annotation parameter
value = "" undeleted value, the default value is 0
delval = "" deleted value, the default value is 1
Other plugin changes
Like pagination plugin, optimistic lock plugin
//分页插件
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
are all changed to this way of adding
//分页插件
@Bean
public MybatisPlusInterceptor paginationInnerInterceptor(){
MybatisPlusInterceptor paginationInnerInterceptor = new MybatisPlusInterceptor();
paginationInnerInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
return paginationInnerInterceptor;
}