123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- package ${package.Entity};
- <% for(pkg in importEntityFrameworkPackages){ %>
- import ${pkg};
- <% } %>
- <% for(pkg in importEntityJavaPackages){ %>
- import ${pkg};
- <% } %>
- /**
- * <p>
- * ${table.comment!}
- * </p>
- *
- * @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} +
- <% } %>
- <% } %>
- "}";
- }
- <% } %>
- }
|