com.github.pagehelper分页插件,分页属性能自定义吗

jack_jones 发布于 05/09 11:11
阅读 559
收藏 0
{
    "endRow":4,
    "hasNextPage":true,
    "hasPreviousPage":true,
    "isFirstPage":false,
    "isLastPage":false,
    "list":[
        {
            "id":"user2",
            "password":"user2",
            "username":"user2"
        }
    ],
    "navigateFirstPage":1,
    "navigateLastPage":5,
    "navigatePages":8,
    "navigatepageNums":[1,2,3,4,5],
    "nextPage":3,
    "pageNum":2,
    "pageSize":2,
    "pages":5,
    "prePage":1,
    "size":2,
    "startRow":3,
    "total":10
}

这些默认的分页属性,能自定义吗

加载中
0
k
koocyton

可以这样

import com.github.pagehelper.PageInfo;
import lombok.Data;
import java.util.List;

@Data
public class PageList<T> {

    private Long total = 0L;
    private int pageSize = 30;
    private int currentPage = 1;
    private List<T> list;

    public PageList(List<T> list) {
        PageInfo pageInfo = new PageInfo<>(list);
        this.total = pageInfo.getTotal();
        this.pageSize = pageInfo.getPageSize();
        this.currentPage = pageInfo.getPageNum();
        this.list = list;
    }
}
0
风吹屁屁凉
风吹屁屁凉

你自定义一个page对象,把他page对象里的属性放到你的page里

返回顶部
顶部