All Downloads are FREE. Search and download functionalities are using the official Maven repository.

config.Entity.ftl Maven / Gradle / Ivy

There is a newer version: 2.8.8
Show newest version
package ${package.Entity};

<#list table.importPackages as pkg><#if !blobTypeHandler || (blobTypeHandler && pkg != "java.sql.Blob")>
import ${pkg};

<#if swagger>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

<#if entityLombokModel>
import lombok.Getter;
import lombok.Setter;
    <#if chainModel>
import lombok.experimental.Accessors;
    


/**
 * 

* ${table.comment!} *

* * @author ${author} * @since ${date} */ <#if entityLombokModel> @Getter @Setter <#if chainModel> @Accessors(chain = true) <#if table.convert> @TableName("${schemaName}${table.name}") <#if swagger> @ApiModel(value = "${entity}对象", description = "${table.comment!}") <#if superEntityClass??> public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}><#if entitySerialVersionUID> implements Serializable { <#elseif activeRecord> public class ${entity} extends Model<${entity}> { <#elseif entitySerialVersionUID> public class ${entity} implements Serializable { <#else> public class ${entity} { <#if entitySerialVersionUID> private static final long serialVersionUID = 1L; <#-- ---------- BEGIN 字段循环遍历 ----------> <#list table.fields as field> <#if field.keyFlag> <#assign keyPropertyName="${field.propertyName}"/> <#if field.comment!?length gt 0> <#if swagger> @ApiModelProperty("${field.comment}") <#else> /** * ${field.comment} */ <#if field.keyFlag> <#-- 主键 --> <#if field.keyIdentityFlag> @TableId(value = "${field.annotationColumnName}", type = IdType.AUTO) <#elseif idType??> @TableId(value = "${field.annotationColumnName}", type = IdType.${idType}) <#elseif field.convert> @TableId("${field.annotationColumnName}") <#-- 普通字段 --> <#elseif field.fill??> <#-- ----- 存在字段填充设置 -----> <#if field.convert> @TableField(value = "${field.annotationColumnName}", fill = FieldFill.${field.fill}<#if blobTypeHandler && field.propertyType = "Blob">, typeHandler = org.apache.ibatis.type.BlobTypeHandler.class) <#else> @TableField(fill = FieldFill.${field.fill}<#if blobTypeHandler && field.propertyType = "Blob">, typeHandler = org.apache.ibatis.type.BlobTypeHandler.class) <#elseif field.convert> <#if blobTypeHandler && field.propertyType = "Blob"> @TableField(value = "${field.annotationColumnName}", typeHandler = org.apache.ibatis.type.BlobTypeHandler.class) <#else> @TableField("${field.annotationColumnName}") <#-- 乐观锁注解 --> <#if field.versionField> @Version <#-- 逻辑删除注解 --> <#if field.logicDeleteField> @TableLogic private <#if blobTypeHandler && field.propertyType = "Blob">byte[]<#else>${field.propertyType} ${field.propertyName}; <#------------ END 字段循环遍历 ----------> <#if !entityLombokModel> <#list table.fields as field> <#if field.propertyType == "boolean"> <#assign getprefix="is"/> <#else> <#assign getprefix="get"/> 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}) { this.${field.propertyName} = ${field.propertyName}; <#if chainModel> return this; } <#if entityColumnConstant> <#list table.fields as field> public static final String ${field.name?upper_case} = "${field.name}"; <#if activeRecord> @Override public Serializable pkVal() { <#if keyPropertyName??> return this.${keyPropertyName}; <#else> return null; } <#if !entityLombokModel> @Override public String toString() { return "${entity}{" + <#list table.fields as field> <#if field_index==0> "${field.propertyName}=" + ${field.propertyName} + <#else> ", ${field.propertyName}=" + ${field.propertyName} + "}"; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy