package ${bussiPackage}.${entityPackage}.entity;

import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;

/**
 * @Description: ${tableVo.ftlDescription}
 * @Author: king-boot
 * @Date:   ${.now?string["yyyy-MM-dd"]}
 * @Version: V1.0
 */
@Data
@TableName("${tableName}")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="${tableName}对象", description="${tableVo.ftlDescription}")
public class ${entityName} implements Serializable {
    private static final long serialVersionUID = 1L;
    
    <#list originalColumns as po>
    /**${po.filedComment}*/
    <#if po.fieldName == primaryKeyField>
    @TableId(type = IdType.ASSIGN_ID)
    <#else>
        <#if po.fieldDbType =='Date'>
            <#if po.classType=='date'>
    @Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
            <#else>
    @Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
            </#if>
        <#else>
    @Excel(name = "${po.filedComment}", width = 15)
        </#if>
        <#--  <#if po.classType!='popup'>
            <#if po.dictTable?default("")?trim?length gt 1>
    @Dict(dicCode="${po.dictField}",dicText="${po.dictText}",dictTable="${po.dictTable}")
            <#elseif po.dictField?default("")?trim?length gt 1>
    @Dict(dicCode="${po.dictField}")
            </#if>
        </#if>-->
    </#if>
    @ApiModelProperty(value = "${po.filedComment}")
    <#if po.fieldDbType=='Blob'>
    private transient java.lang.String ${po.fieldName}String;

    private byte[] ${po.fieldName};

    public byte[] get${po.fieldName?cap_first}(){
        if(${po.fieldName}String==null){
            return null;
        }
        try {
            return ${po.fieldName}String.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }

    public String get${po.fieldName?cap_first}String(){
        if(${po.fieldName}==null || ${po.fieldName}.length==0){
            return "";
        }
        try {
            return new String(${po.fieldName},"UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return "";
    }
    <#else>
    private ${po.fieldType} ${po.fieldName};
    </#if>

    </#list>
}
