limit index,pageSize
pageSize:每页显示的条数
pageNum:当前页的页码
index:当前页的起始索引,index=(pageNum-1)*pageSize;
count:总记录数
totalPage:总页数
//求总页数totalPage
totalPage=count/pageSize;
if(coun%tpageSize!=0)
{
totalPage +=1;
}

com.github.pagehelper
pagehelper
5.2.0
在mybatis核心配置文件中添加,在environment之前
PageHelper.startPage(1, 10); 第一个参数表示第几页开始,第二个参数表示每页显示的记录数。
Book book=sqlSession.getMapper(BookMapper.class);
//在查询功能开始前开启分页功能
PageHelper.startPage(1,10);
List books=book.getAll();
Page