offect = (pageNum - 1) * pageSize; limit=pageSize
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.7</version>
</dependency>
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql
public List<TApp> findAll(){
Page<TApp> page=PageHelper.startPage(2,2).setOrderBy("createTime desc");
List<TApp> tAppList = tAppMapper.findAll();
System.out.println("total="+page.getTotal());
return tAppList;
}
注意PageHelper.startPage 的下方一定要紧跟mapper的查询语句 不能加入其它的代码 否则会引发异常