1.引入依赖
<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.2</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-autoconfigure</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.5</version>
</dependency>
2.java代码
PageHelper.startPage(Integer.valueOf(page),Integer.valueOf(limit));
List<Map<String,String>> list = infoService.getCountList();
PageInfo pageInfo = new PageInfo(list);
return new ReType(pageInfo.getTotal(),pageInfo.getList());
3.为layuiTable提供的实体类
public class ReType implements Serializable{
/**状态*/
public int code=0;
/**状态信息*/
public String msg="";
/**数据总数*/
public long count;
public List<?> data;
public ReType() {
}
public ReType(long count, List<?> data) {
this.count = count;
this.data = data;
}
}