1 <dependency> 2 <groupId>com.github.pagehelper</groupId> 3 <artifactId>pagehelper-spring-boot-starter</artifactId> 4 <version>1.4.1</version> 5 </dependency>
#分页插件
pagehelper.helper-dialect=mysql
pagehelper.params=count=countSql
pagehelper.reasonable=true
pagehelper.support-methods-arguments=true
1 //测试分页插件 2 @GetMapping("/getAllPerson") 3 public PageInfo<Article> getAllPerson(@RequestParam(defaultValue = "1",value = "pageNum") Integer pageNum){ 4 PageHelper.startPage(pageNum,3); 5 List<Article> list = iArticleService.getArticleAll(); 6 PageInfo<Article> pageInfo = new PageInfo<Article>(list); 7 System.out.println("查看第"+pageNum+"页"); 8 return pageInfo; 9 }
http://localhost:8080/itkb/square/article/getAllPerson?pageNum=2