导入依赖
<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;
}
}