说明一下 ,使用MyBatis-Plus 进行分页查询时 ,要先进行配置
添加配置
/**
* @Author North
* @Date 2024/5/6
*/
@Configuration
public class MPConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
return mybatisPlusInterceptor;
}
}
测试方法
@Test
public void testSelectPage() {
IPage page = new Page(1 , 5);
bookDao.selectPage(page, null);
}