myoql-template.mysql.jpa-entity.ftl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ktmyoql-code-generator Show documentation
Show all versions of ktmyoql-code-generator Show documentation
kotlin orm -- mysql,mongo , just like ktorm
The newest version!
package ${packageName}
import nbcp.myoql.db.*
import nbcp.db.sql.*
import nbcp.db.mysql.*
import java.time.*
/**
* ${entity.getComment()}
* @author ${author}
*/
@DbEntityGroup("${entity.group}")
@Cn("${entity.getComment()}")
@DbUks(${entity.getUks()?join(",")})
@DbName("${entity.getName()}")
open class ${entity.getClassName()}(): ISqlDbEntity {
<#list entity.getColumns() as field>
/**
* ${field.getComment()}
*/
<#if field.getAutoInc()>
@SqlAutoIncrementKey
<#elseif field.getAutoId()>
@ConverterValueToDb(AutoIdConverter::class)
<#elseif field.getAutoNumber()>
@ConverterValueToDb(AutoNumberConverter::class)
#if>
@Cn("${field.getComment()}")
@DbName("${field.getName()}")
var ${field.getFieldName()}: ${field.getKotlinType()} = ${field.getKotlinDefaultValue()}
#list>
}