1)在 myBatis 全区配置中加入
<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor"></plugin>
</plugins>
2)在开启会话之后,获取动态代理之前 写上
Page<Object> page = PageHelper.startPage(1,2);
分页完成
System.out.println(“当前页:”+page.getPageNum());
System.out.println(“总页码:”+page.getPages());
System.out.println(“总记录数:”+page.getTotal());
System.out.println(“每页显示条数:”+page.getPageSize());