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

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

/**
 * @Description: ${tableVo.ftlDescription}
 * @Author: jeecg-boot
 * @Date:   ${.now?string["yyyy-MM-dd"]}
 * @Version: V1.0
 */
@Data
@TableName("${tableName}")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="${tableName}对象", description="${tableVo.ftlDescription}")
public class ${entityName} implements Serializable {
    private static final long serialVersionUID = 1L;

    <#assign excel_ignore_arr=['createBy','createTime','updateBy','updateTime','sysOrgCode']>
    <#list originalColumns as po>
    <#-- 生成字典Code -->
    <#assign list_field_dictCode="">
    <#if po.classType='sel_user'>
      <#assign list_field_dictCode=', dictTable = "sys_user", dicText = "realname", dicCode = "username"'>
    <#elseif po.classType='sel_depart'>
      <#assign list_field_dictCode=', dictTable = "sys_depart", dicText = "depart_name", dicCode = "id"'>
    <#elseif po.classType=='list' || po.classType=='list_multi' || po.classType=='sel_search' || po.classType=='radio' || po.classType=='checkbox'>
      <#if po.dictTable?default("")?trim?length gt 1>
        <#assign list_field_dictCode=', dictTable = "${po.dictTable}", dicText = "${po.dictText}", dicCode = "${po.dictField}"'>
      <#elseif po.dictField?default("")?trim?length gt 1>
        <#assign list_field_dictCode=', dicCode = "${po.dictField}"'>
      </#if>
    </#if>
	/**${po.filedComment}*/
	<#if po.fieldName == primaryKeyField>
	@TableId(type = IdType.ASSIGN_ID)
	<#else>
  		<#if po.fieldDbType =='Date'>
			<#if po.classType=='date'>
    <#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
	@Excel(name = "${po.filedComment}", width = 15, format = "yyyy-MM-dd"${list_field_dictCode})
	</#if>
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
			<#else>
    <#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
	@Excel(name = "${po.filedComment}", width = 20, format = "yyyy-MM-dd HH:mm:ss"${list_field_dictCode})
	</#if>
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
			</#if>
		<#else>
    <#if !excel_ignore_arr?seq_contains("${po.fieldName}")>
	@Excel(name = "${po.filedComment}", width = 15${list_field_dictCode})
	</#if>
  		</#if>
      <#if list_field_dictCode?length gt 1>
	@Dict(${list_field_dictCode?substring(2)})
      </#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>
    <#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>
    @ApiModelProperty(value = "${po.filedComment}")
    private ${po.fieldType} ${po.fieldName};
    </#if>
	</#list>
}
