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

templates.entity.kt.ftl Maven / Gradle / Ivy

The newest version!
package ${package.Entity}

<#list table.importPackages as pkg>
import ${pkg}

<#if springdoc>
import io.swagger.v3.oas.annotations.media.Schema;
<#elseif swagger>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;


/**
 * 

* ${table.comment} *

* * @author ${author} * @since ${date} */ <#if table.convert> @TableName("${schemaName}${table.name}") <#if springdoc> @Schema(name = "${entity}", description = "$!{table.comment}") <#elseif swagger> @ApiModel(value = "${entity}对象", description = "${table.comment!}") <#if superEntityClass??> class ${entity} : ${superEntityClass}<#if activeRecord><${entity}>() { <#elseif activeRecord> class ${entity} : Model<${entity}>() { <#elseif entitySerialVersionUID> class ${entity} : Serializable { <#else> class ${entity} { <#-- ---------- BEGIN 字段循环遍历 ----------> <#list table.fields as field> <#if field.keyFlag> <#assign keyPropertyName="${field.propertyName}"/> <#if field.comment!?length gt 0> <#if springdoc> @Schema(description = "${field.comment}") <#elseif 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}) <#else> @TableField(fill = FieldFill.${field.fill}) <#elseif field.convert> @TableField("${field.annotationColumnName}") <#-- 乐观锁注解 --> <#if field.versionField> @Version <#-- 逻辑删除注解 --> <#if field.logicDeleteField> @TableLogic <#if field.propertyType == "Integer"> var ${field.propertyName}: Int? = null <#else> var ${field.propertyName}: ${field.propertyType}? = null <#-- ---------- END 字段循环遍历 ----------> <#if entityColumnConstant> companion object { <#list table.fields as field> const val ${field.name?upper_case} : String = "${field.name}" } <#if activeRecord> override fun pkVal(): Serializable? { <#if keyPropertyName??> return ${keyPropertyName} <#else> return null } override fun toString(): String { 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