1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- package ${package.Entity}
- import com.baomidou.mybatisplus.annotations.TableName
- #foreach($pkg in ${table.importPackages})
- import ${pkg}
- #end
- /**
- * <p>
- * $!{table.comment}
- * </p>
- *
- * @author ${author}
- * @since ${date}
- */
- ###if(${table.convert})
- @TableName("${table.name}")
- ###end
- open class ${entity} : #if(${superEntityClass})${superEntityClass}#if(${activeRecord})<${entity}>#end() {
- #elseif(${activeRecord}) Model<${entity}>() {
- #else Serializable {
- #end
- #if(${entityColumnConstant})
- companion object {
- #foreach($field in ${table.fields})
- const val ${field.name.toUpperCase()} : String = "${field.name}"
- #end
- }
- #end
- ## ---------- BEGIN 字段循环遍历 ----------
- #foreach($field in ${table.fields})
- #if(${field.keyFlag})
- #set($keyPropertyName=${field.propertyName})
- #end
- #if("$!field.comment" != "")
- /**
- * ${field.comment}
- */
- #end
- #if(${field.keyFlag})
- ## 主键
- #if(${field.keyIdentityFlag})
- @TableId(value = "${field.name}", type = IdType.AUTO)
- #elseif(!$null.isNull(${idType}) && "$!idType" != "")
- @TableId(value = "${field.name}", type = IdType.${idType})
- #elseif(${field.convert})
- @TableId("${field.name}")
- #end
- ## 普通字段
- #elseif(${field.fill})
- ## ----- 存在字段填充设置 -----
- #if(${field.convert})
- @TableField(value = "${field.name}", fill = FieldFill.${field.fill})
- #else
- @TableField(fill = FieldFill.${field.fill})
- #end
- #elseif(${field.convert})
- @TableField("${field.name}")
- #end
- ## 乐观锁注解
- #if(${versionFieldName}==${field.name})
- @Version
- #end
- ## 逻辑删除注解
- #if(${logicDeleteFieldName}==${field.name})
- @TableLogic
- #end
- var ${field.propertyName}: #if(${field.propertyType} == "Integer")Int#else${field.propertyType}#end? = null#if($foreach.count!=${table.fields.size()})#end
- #end
- ## ---------- END 字段循环遍历 ----------
- #if(${activeRecord})
- override fun pkVal(): Serializable {
- #if(${keyPropertyName})
- return ${keyPropertyName} !
- #else
- return id!!
- #end
- }
- #end
- ## override fun toString(): String {
- ## return "${entity}{" +
- ###foreach($field in ${table.fields})
- ###if($!{velocityCount}==1)
- ## "${field.propertyName}=" + ${field.propertyName} +
- ###else
- ## ", ${field.propertyName}=" + ${field.propertyName} +
- ###end
- ###end
- ## "}"
- ## }
- }
|