package com.blueland.common.core.domain;

import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.core.paginate.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

@Data
public class BaseEntity {

    /**
     * 创建人
     */
    @Column(value = "create_by")
    @ApiModelProperty(value = "创建人")
    private String createBy;

    /**
     * 创建时间
     */
    @Column(value = "create_time")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    /**
     * 更新人
     */
    @Column(value = "update_by")
    @ApiModelProperty(value = "更新人")
    private String updateBy;

    /**
     * 更新时间
     */
    @Column(value = "update_time")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @Column(ignore = true)
    @JSONField(serialize = false)
    @ApiModelProperty(value = "分页大小")
    @JsonIgnore
    private int pageSize;

    @Column(ignore = true)
    @JSONField(serialize = false)
    @ApiModelProperty(value = "分页页码")
    @JsonIgnore
    private int pageNum;

    @JsonIgnore
    public Page getPage() {
        return new Page(pageNum, pageSize);
    }

}
