content: package com.myshop.orm;
  
  import com.baomidou.mybatisplus.annotation.FieldFill;
  import com.baomidou.mybatisplus.annotation.TableField;
  import com.baomidou.mybatisplus.annotation.TableId;
  import com.fasterxml.jackson.annotation.JsonFormat;
  import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  import lombok.AllArgsConstructor;
  import lombok.Data;
  import lombok.NoArgsConstructor;
  import org.springframework.data.annotation.CreatedBy;
  import org.springframework.data.annotation.CreatedDate;
  import org.springframework.data.annotation.LastModifiedBy;
  import org.springframework.data.annotation.LastModifiedDate;
  import org.springframework.data.elasticsearch.annotations.DateFormat;
  import org.springframework.data.elasticsearch.annotations.Field;
  import org.springframework.data.elasticsearch.annotations.FieldType;
  import org.springframework.format.annotation.DateTimeFormat;
  
  import java.io.Serializable;
  import java.util.Date;
  
  
  /**
   * Base Entity Class for Database
   *
   * @author vantrang
   * @since 2024/10/16
   */
  @Data
  @JsonIgnoreProperties(value = {"handler", "fieldHandler"})
  @AllArgsConstructor
  @NoArgsConstructor
  public abstract class BaseEntity implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      @TableId
      private String id;
  
      @CreatedBy
      @TableField(fill = FieldFill.INSERT)
      private String createBy;
  
      @CreatedDate
      @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
      @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
      @TableField(fill = FieldFill.INSERT)
      @Field(type = FieldType.Date, format = DateFormat.date, pattern = "yyyy-MM-dd HH:mm:ss || yyyy-MM-dd || yyyy/MM/dd HH:mm:ss|| yyyy/MM/dd ||epoch_millis")
      private Date createTime;
  
      @LastModifiedBy
      @TableField(fill = FieldFill.UPDATE)
      private String updateBy;
  
      @LastModifiedDate
      @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
      @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
      @TableField(fill = FieldFill.INSERT_UPDATE)
      @Field(type = FieldType.Date, format = DateFormat.date, pattern = "yyyy-MM-dd HH:mm:ss || yyyy-MM-dd || yyyy/MM/dd HH:mm:ss|| yyyy/MM/dd ||epoch_millis")
      private Date updateTime;
  
      @TableField(fill = FieldFill.INSERT)
      private Boolean deleteFlag;
  
  }
  