package com.tzld.piaoquan.api.model.param;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * 通用分页参数，pageSize 最大 50
 */
@Getter
public class PageParam {

    @ApiModelProperty(value = "页码")
    private Integer pageNum = 1;
    @ApiModelProperty(value = "每页个数")
    private Integer pageSize = 20;

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

    public void setPageSize(Integer pageSize) {
        this.pageSize = (pageSize != null && pageSize > 50) ? 50 : pageSize;
    }

    /**
     * 用于导出等场景，不限制 pageSize 上限
     */
    public void setExportPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

}
