package com.hzs.common.core.web.domain;

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

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.hzs.common.core.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Entity基类
 *
 * @author hzs
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 创建人ID
     */
    @TableField("PK_CREATOR")
    private Long pkCreator;

    /**
     * 创建时间
     */
    @Excel(name = "创建时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("CREATION_TIME")
    private Date creationTime;

    /**
     * 修改人ID
     */
    @TableField("PK_MODIFIED")
    private Long pkModified;

    /**
     * 修改时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField("MODIFIED_TIME")
    private Date modifiedTime;

    /**
     * 逻辑删除 (0=未删除，1已删除)
     */
    @JsonIgnore
    @TableLogic
    @TableField("DEL_FLAG")
    private Integer delFlag;

    /**
     * 国家
     */
    @TableField("PK_COUNTRY")
    private Integer pkCountry;

    /**
     * 请求参数（除非框架自带逻辑，否则不要使用此参数）
     */
    @JsonIgnore
    @TableField(exist = false)
    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;
    }
}
