package ${basePackage}.${entityPackage};

<#if hasDate = true>
  import java.util.Date;
</#if>
<#if hasBigDecimal = true>
  import java.math.BigDecimal;
</#if>
import lombok.Data;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.time.LocalDate;
import java.time.LocalTime;

/**
* ${tableComment} Entity
*
* @author ${author}
* @date ${date}
*/
@Data
@TableName("${tableName}")
public class ${className} {

<#if columns??>
    <#list columns as column>
      /**
      * ${column.remark}
      */
      @ApiModelProperty(value = "${column.remark}")
        <#if column.isKey = true>
          @TableId(value = "${column.name}", type = IdType.AUTO)
        <#else>
            <#if (column.name='create_date' || column.name='create_id') || column.name='create_name'>
              @TableField(value ="${column.name}", fill = FieldFill.INSERT)
            <#elseif (column.name='update_date' || column.name='update_id') || column.name='update_name'>
              @TableField(value ="${column.name}", fill = FieldFill.UPDATE)
            <#else>
              @TableField("${column.name}")
            </#if>
        </#if>
        <#if column.name='del_flag'>
          @TableLogic(value = "0", delval = "1")
        </#if>
        <#if (column.type = 'varchar' || column.type = 'text' || column.type = 'uniqueidentifier'
        || column.type = 'varchar2' || column.type = 'nvarchar' || column.type = 'VARCHAR2'
        || column.type = 'VARCHAR'|| column.type = 'CLOB' || column.type = 'char')>
          private String ${column.field?uncap_first};

        </#if>
        <#if column.type = 'timestamp' || column.type = 'datetime'||column.type = 'TIMESTAMP' || column.type = 'DATETIME'>
          @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
          @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
          private LocalDateTime ${column.field?uncap_first};

        </#if>
        <#if column.type = 'date' || column.type = 'DATE'>
          @DateTimeFormat(pattern = "yyyy-MM-dd")
          @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
          private LocalDate ${column.field?uncap_first};

        </#if>
        <#if column.type = 'TIME' || column.type = 'time'>
          @DateTimeFormat(pattern = "HH:mm:ss")
          @JsonFormat(timezone = "GMT+8", pattern = "HH:mm:ss")
          private LocalTime ${column.field?uncap_first};

        </#if>
        <#if column.type = 'int' || column.type = 'smallint'>
          private Integer ${column.field?uncap_first};

        </#if>
        <#if column.type = 'double'>
          private Double ${column.field?uncap_first};

        </#if>
        <#if column.type = 'bigint'>
          private Long ${column.field?uncap_first};

        </#if>
        <#if column.type = 'tinyint'>
          private Integer ${column.field?uncap_first};

        </#if>
        <#if column.type = 'decimal' || column.type = 'numeric'>
          private BigDecimal ${column.field?uncap_first};
        </#if>
    </#list>
</#if>
}