package ${package.Entity}; <% for(pkg in importEntityFrameworkPackages){ %> import ${pkg}; <% } %> <% for(pkg in importEntityJavaPackages){ %> import ${pkg}; <% } %> /** *

* ${table.comment!} *

* * @author ${author} * @since ${date} */ <% for(an in entityClassAnnotations){ %> ${an.displayName} <% } %> <% if(isNotEmpty(superEntityClass)){ %> public class ${entity} extends ${superEntityClass}<% if(activeRecord){ %><${entity}><%}%>{ <% }else if(activeRecord){ %> public class ${entity} extends Model<${entity}> { <% }else if(entitySerialVersionUID){ %> public class ${entity} implements Serializable { <% }else{ %> public class ${entity} { <% } %> <% if(entitySerialVersionUID){ %> <% if(entitySerialAnnotation) { %> @Serial <% } %> private static final long serialVersionUID = 1L; <% } %> <% var keyPropertyName; %> <% /** -----------BEGIN 字段循环遍历----------- **/ %> <% for(field in table.fields){ %> <% if(field.keyFlag){ keyPropertyName = field.propertyName; } %> <% if(isNotEmpty(field.comment)){ %> <% if(entityFieldUseJavaDoc){ %> /** * ${field.comment} */ <% } %> <% } %> <% for(an in field.annotationAttributesList){ %> ${an.displayName} <% } %> private ${field.propertyType} ${field.propertyName}; <% } %> <% /** -----------END 字段循环遍历----------- **/ %> <% if(!entityLombokModel){ %> <% for(field in table.fields){ %> <% var getprefix =''; if(field.propertyType=='boolean'){ getprefix='is'; }else{ 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){ %> <% for(field in table.fields){ %> public static final String ${strutil.toUpperCase(field.name)} = "${field.name}"; <% } %> <% } %> <% if(activeRecord){ %> @Override public Serializable pkVal() { <% if(isNotEmpty(keyPropertyName)){ %> return this.${keyPropertyName}; <% }else{ %> return null; <% } %> } <% } %> <% if(!entityLombokModel && entityToString){ %> @Override public String toString() { return "${entity}{" + <% for(field in table.fields){ %> <% if(fieldLP.dataIndex==0){ %> "${field.propertyName} = " + ${field.propertyName} + <% }else{ %> ", ${field.propertyName} = " + ${field.propertyName} + <% } %> <% } %> "}"; } <% } %> }