SpringBoot整合pagehelper分页插件用法
*用到了JSONObject,PageInfo*。此外,appllication.yml文件无需另外配置。
1.添加pom依赖:
<!--pagehelper-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.2</version>
</dependency>
2.Controller层:
@PostMapping("/getList")
public ResponseEntity getContens(@RequestBody JSONObject query){
PageInfo<ContentManagementEntity>
list=contentManagementService.getList(query);
return new ResponseEntity(list,HttpStatus.OK);
}