All Downloads are FREE. Search and download functionalities are using the official Maven repository.

k.e.book.common.model.PageRequest Maven / Gradle / Ivy

package k.e.book.common.model;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

@Data
@ApiModel(description = "分页信息")
public class PageRequest implements Serializable {

    private static final long serialVersionUID = -5355454567696138248L;

    /**
     * 页码
     */
    @ApiModelProperty("页码,默认为1")
    private int page = 1;

    /**
     * 页大小
     */
    @ApiModelProperty("页面数据大小,默认为10")
    private int limit = 10;

    public int computeOffset() {
        return (page - 1) * limit;
    }


    public  Page toMyBatisPage() {
        return new Page().setCurrent(getPage()).setSize(getLimit());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy