分页查询 pagehelper
作者:互联网
导入依赖
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<!-- 特别注意版本问题 -->
<version>1.2.3</version>
</dependency>
application.yml
pagehelper:
helper-dialect: mysql
reasonable: true
support-methods-arguments: true
bookController.java
public class bookController {
@Autowired
bookService bookservice;
@GetMapping("/findAll")
public PageInfo<Books> findAll(){
PageHelper.startPage(3, 1); //这个下边紧接着查询语句
List<Books> books = bookservice.selectAll();
PageInfo<Books> pageInfo = new PageInfo<>(books);
return pageInfo;
}
}
标签:分页,bookservice,pageInfo,查询,pagehelper,true,PageInfo,bookController 来源: https://www.cnblogs.com/hellowen/p/13051109.html