目标:
懂得使用 Mybatis-Plus 进行分页查询
实现步骤:
1、编写分页插件2、测试分页功能
一、分页插件PaginationInnerInterceptor
MyBatis-Plus 的分页实现还是使用的动态拼接Limit分页
二、测试用例
1、编写分页插件
/*分页插件*/@Beanpublic PaginationInterceptor paginationInterceptor(){return new PaginationInterceptor();}
2、查询测试
@Testpublic void testPage(){Page page = new Page<>(1,5);userMapper.selectPage(page, null);for (Object record : page.getRecords()) {System.out.println(record);}}
测试结果

三、用例方法、参数详解
userMapper 的 selectPage 方法
参数一:分页查询条件(可以为 RowBounds.DEFAULT)
参数二:实体对象封装操作类(可以为 null)

我们再点进 参数一:IPage类

发现是一个接口,那我们肯定要使用它的实现类呀
点击它的实现类 发现只有一个 Page<T> , 好了就它了!

接着往下 又看到构造器
构造器参数一是当前页,参数二是每页要显示的数量

接着看看,发现它有一个records 记录列表


![[一起学习pytorch吧]之torch.sign函数](https://img-blog.csdnimg.cn/20200316211101489.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L21pc3N5b3VkYWlzeQ==,size_16,color_FFFFFF,t_70)
















