package com.starry.common.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * @author admin 分页基类
 * @since 2021/9/2
 */
@Data
@Accessors(chain = true)
public class BasePageEntity implements Serializable {

    @ApiModelProperty(value = "当前页码", example = "1", notes = "默认为1")
    private int currentPage = 1;

    @ApiModelProperty(value = "每页记录数", example = "10", notes = "默认为10")
    private int pageSize = 10;

    @ApiModelProperty(value = "页码", example = "1", notes = "与currentPage相同，默认为1")
    private int pageNum = 1;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "是否已删除", example = "false", hidden = true)
    private Boolean deleted = Boolean.FALSE;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建人", hidden = true)
    private String createdBy;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间", hidden = true)
    private Date createdTime;

    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty(value = "更新时间", hidden = true)
    private Date updatedTime;

    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty(value = "更新人", hidden = true)
    private String updatedBy;

    /**
     * 开始日期
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "开始日期", example = "2024-01-01 00:00:00", notes = "格式：yyyy-MM-dd HH:mm:ss")
    private String beginTime;

    /**
     * 结束日期
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "结束日期", example = "2024-12-31 23:59:59", notes = "格式：yyyy-MM-dd HH:mm:ss")
    private String endTime;

}
