package com.fdage.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.time.LocalDateTime;

@Data
@MappedSuperclass
public abstract class BaseEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "对象ID")
    private Long id;

    @ApiModelProperty(value = "创建时间")
//    @Temporal(TemporalType.TIMESTAMP)
//    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "修改时间")
//    @Temporal(TemporalType.TIMESTAMP)
//    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    /**
     * 用来批量操作的
     * 0代表未删除 ， 1代表已经删除，默认写0
     * 需要使用对象类型
     */
    @JsonIgnore
    @JSONField(serialize = false)
    private Integer isDelete;
}
