package com.yida.data.common.core.common;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * app分页请求基类
 *
 * @author ZYJ
 * @date 2021/9/6
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class AppPageRequestBaseDTO<T> implements Serializable {

    private static final long serialVersionUID = 1707879624681989241L;

    /**
     * 当前页码
     */
    @ApiModelProperty(value = "当前页码", required = true)
    private Integer pageNo;

    /**
     * 页面大小
     */
    @ApiModelProperty(value = "页面大小", required = true)
    private Integer pageSize;

    /**
     * 用户id
     */
    @NotNull
    @ApiModelProperty(value = "用户id", required = true)
    private Long userId;

    /**
     * 用户名
     */
    @ApiModelProperty(value = "用户名")
    private String userName;

    /**
     * 用户昵称
     */
    @ApiModelProperty(value = "用户昵称")
    private String nickName;

    public Page<T> toPage() {
        return new Page<>(this.pageNo, this.pageSize);
    }
}
