修复部分分页接口的查询bug

This commit is contained in:
xiaoyang
2021-04-01 21:51:30 +08:00
parent 57d0325e05
commit 45b4ce7b18
12 changed files with 73 additions and 54 deletions

View File

@ -9,8 +9,8 @@ import java.util.List;
/**
* 分装通用分页数据,接收PageHelper、SpringData等框架的分页数据转换成通用的PageBean对象
* @author xiongxiaoyang
* @version 1.0
* @since 2020/5/23
* @version 1.1
* @since 2021/4/1
* @param <T> 分页集合类型
*/
@Data
@ -20,20 +20,18 @@ public class PageBean<T> {
private Integer pageNum;
@ApiModelProperty(value = "每页大小")
private Integer pageSize;
@ApiModelProperty(value = "总页数")
private Integer totalPage;
@ApiModelProperty(value = "总记录数")
private Long total;
@ApiModelProperty(value = "分页数据集合")
private List<T> list;
private List<? extends T> list;
/**
* 该构造函数用于PageHelper工具进行分页查询的场景
* 接收PageHelper分页后的list
*/
public PageBean(List<T> list){
PageInfo<T> pageInfo = new PageInfo<>(list);
this.totalPage = pageInfo.getPages();
this.pageNum = pageInfo.getPageNum();
this.pageSize = pageInfo.getPageSize();
this.total = pageInfo.getTotal();
@ -41,4 +39,18 @@ public class PageBean<T> {
}
/**
* 该构造函数用于通用分页查询的场景
* 接收普通分页数据和普通集合
*/
public PageBean(Integer pageNum, Integer pageSize, Long total, List<T> list) {
this.pageNum = pageNum;
this.pageSize = pageSize;
this.total = total;
this.list = list;
}
//TODO 使用其他的分页工具或框架进行分页查询的场景
}