package ${package.Entity};

#foreach($pkg in ${importEntityFrameworkPackages})
import ${pkg};
#end

#foreach($pkg in ${importEntityJavaPackages})
import ${pkg};
#end

/**
 * <p>
 * $!{table.comment}
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
#foreach($an in ${entityClassAnnotations})
${an.displayName}
#end
#if(${superEntityClass})
public class ${entity} extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
#elseif(${activeRecord})
public class ${entity} extends Model<${entity}> {
#elseif(${entitySerialVersionUID})
public class ${entity} implements Serializable {
#else
public class ${entity} {
#end
#if(${entitySerialVersionUID})

    #if(${entitySerialAnnotation})
    @Serial
    #end
    private static final long serialVersionUID = 1L;
#end
## ----------  BEGIN 字段循环遍历  ----------
#foreach($field in ${table.fields})

#if(${field.keyFlag})
#set($keyPropertyName=${field.propertyName})
#end
#if("$!field.comment" != "")
  #if(${entityFieldUseJavaDoc})
    /**
     * ${field.comment}
     */
  #end
#end
#foreach($an in ${field.annotationAttributesList})
    ${an.displayName}
#end
    private ${field.propertyType} ${field.propertyName};
#end
## ----------  END 字段循环遍历  ----------
#if(!${entityLombokModel})
#foreach($field in ${table.fields})
  #if(${field.propertyType.equals("boolean")})
    #set($getprefix="is")
  #else
    #set($getprefix="get")
  #end

    public ${field.propertyType} ${getprefix}${field.capitalName}() {
        return ${field.propertyName};
    }

  #if(${chainModel})
    public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
  #else
    public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
  #end
        this.${field.propertyName} = ${field.propertyName};
  #if(${chainModel})
        return this;
  #end
    }
#end
## --foreach end---
#end
## --end of #if(!${entityLombokModel})--
#if(${entityColumnConstant})
  #foreach($field in ${table.fields})

    public static final String ${field.name.toUpperCase()} = "${field.name}";
  #end
#end
#if(${activeRecord})

    @Override
    public Serializable pkVal() {
  #if(${keyPropertyName})
        return this.${keyPropertyName};
  #else
        return null;
  #end
    }
#end
#if(!${entityLombokModel} && ${entityToString})

    @Override
    public String toString() {
        return "${entity}{" +
  #foreach($field in ${table.fields})
    #if($!{foreach.index}==0)
            "${field.propertyName} = " + ${field.propertyName} +
    #else
            ", ${field.propertyName} = " + ${field.propertyName} +
    #end
  #end
            "}";
    }
#end
}
