package com.ruoyi.common.core.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @author lsw
 * @date 2024-04-16
 */
@Data
@Accessors(chain = true)
public class BaseData {
    private static final long serialVersionUID = 1L;

    //用户id
    @TableField(fill = FieldFill.INSERT)
    private Long userId;

    //部门id
    @TableField(fill = FieldFill.INSERT)
    private Long deptId;

    //部门名称
    @TableField(exist = false)
    private String deptName;

    //开始日期
    @TableField(exist = false)
    @JsonIgnore
    private String dateBegin;

    //结束日期
    @TableField(exist = false)
    @JsonIgnore
    private String dateEnd;

    @TableField(fill = FieldFill.INSERT)
    private String createBy;

    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @TableField(fill = FieldFill.UPDATE)
    private String updateBy;

    @TableField(fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @TableField(exist = false)
    @JsonIgnore
    private Map<String, Object> params;

    public Map<String, Object> getParams() {
        if (params == null) {
            params = new HashMap<>();
        }
        return params;
    }

    public void setParams(Map<String, Object> params) {
        this.params = params;
    }
}
