package com.prolog.cs.base.gsp;

import com.prolog.framework.authority.core.dto.UserDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

@Data
public class QueryVO implements Serializable {

    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "仓库ID", hidden = true)
    private String enterpriseId;
    @ApiModelProperty(value = "当前页码")
    private Integer pageNum;
    @ApiModelProperty(value = "每页数量")
    private Integer pageSize;

    /**
     * 初始化请求参数
     */
    public void initialPageWhenValueIsNull(UserDTO user) {
        if (this.pageNum == null) {
            this.pageNum = 1;
        }
        if (this.pageSize == null) {
            this.pageSize = 10;
        }
        this.enterpriseId = user.getEnterpriseId();
    }
}
