package com.glxp.mipsdl.req.base;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

/**
 * 接口分页参数
 */
@Data
public class ListPageRequest {


    @Min(message = "分页参数错误", value = 1)
    private Integer page;


    @Min(value = 1, message = "分页参数不能小于1")
    @Max(value = 500, message = "分页参数不能大于500")
    private Integer limit;
    private String orderBy;
    private String sort;

    public Page getPageObj() {
        return new Page(this.page == null ? 1 : this.page, this.limit == null ? 10 : this.limit);
    }
}
