package #(package.Entity);

#for(pkg : importEntityFrameworkPackages)
import #(pkg);
#end

#for(pkg : importEntityJavaPackages)
import #(pkg);
#end

/**
 * <p>
 * #(table.comment)
 * </p>
 *
 * @author #(author)
 * @since #(date)
 */
#for(an : 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 字段循环遍历  ----------
#for(field : table.fields)

#if(field.isKeyFlag())
#set(keyPropertyName = field.propertyName)
#end
#if(field.comment != null)
  #if(entityFieldUseJavaDoc)
    /**
     * #(field.comment)
     */
  #end
#end
#for(an : field.annotationAttributesList)
    #(an.displayName)
#end
    private #(field.propertyType) #(field.propertyName);
#end
### ----------  END 字段循环遍历  ----------
#if(!entityLombokModel)
#for(field : 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)
  #for(field : 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){" +
  #for(field : table.fields)
    #if(for.index == 0)
            "#(field.propertyName) = " + #(field.propertyName) +
    #else
            ", #(field.propertyName) = " + #(field.propertyName) +
    #end
  #end
            "}";
    }
#end
}
