栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Springboot分页对象

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Springboot分页对象

Springboot分页对象

为了应付一下1024的节日,推荐一下Springboot的分页对象

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.bootcrabframework.cloud.core.component;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel(
    description = "分页对象"
)
public final class Page {
    @ApiModelProperty("总记录数,自动返回,请勿设置")
    private int count;
    @ApiModelProperty("一页显示的数据量")
    private int pageSize = 0;
    @ApiModelProperty("页码,从一开始,比如第一页")
    private int pageNum = 0;
    @ApiModelProperty("排序字段,前端传入")
    private String orderBy;
    @ApiModelProperty("是否需要返回,count 默认是true ")
    private boolean returnCount;

    public void setReturnCount(boolean returnCount) {
        this.returnCount = returnCount;
    }

    public boolean getReturnCount() {
        return this.returnCount;
    }

    public Page() {
        this.returnCount = true;
    }

    public Page(int pageNum, int pageSize) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.returnCount = true;
    }

    public Page(int pageNum, int pageSize, String orderBy) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.orderBy = orderBy;
        this.returnCount = true;
    }

    public String getOrderBy() {
        return this.orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public int getOffset() {
        return (this.pageNum - 1) * this.pageSize;
    }

    public int getLimit() {
        return this.getOffset() + this.pageSize;
    }

    public int getCount() {
        return this.count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public int getPageSize() {
        return this.pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPageNum() {
        return this.pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }
}

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/346144.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号