reportEntity.ftl 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <#import "../function.ftl" as func>
  2. <#assign class=model.variables.class>
  3. <#assign classVar=model.variables.classVar>
  4. <#assign tableName=model.tableName>
  5. <#assign sys=model.variables.sys>
  6. <#assign module=model.variables.module>
  7. <#assign subtables=model.subTableList>
  8. <#assign pk=func.getPk(model) >
  9. <#assign pkVar=func.convertUnderLine(pk) >
  10. <#assign isBaseModule=model.variables.isBaseModule>
  11. <#if isBaseModule = 'true'>
  12. package com.${vars.cAlias}.${sys}.persistence.entity;
  13. <#else>
  14. package com.${vars.cAlias}.${sys}.${module}.persistence.entity;
  15. </#if>
  16. <#if subtables?exists && subtables?size!=0>
  17. import java.util.ArrayList;
  18. import java.util.List;
  19. </#if>
  20. import java.util.Date;
  21. import org.apache.commons.lang.builder.ToStringBuilder;
  22. import com.bugull.mongo.SimpleEntity;
  23. import com.bugull.mongo.annotations.Entity;
  24. import com.bugull.mongo.annotations.Property;
  25. /**
  26. * 对象功能:${model.tabComment} Po对象
  27. <#if vars.company?exists>
  28. * 开发公司:${vars.company}
  29. </#if>
  30. <#if vars.developer?exists>
  31. * 开发人员:${vars.developer}
  32. </#if>
  33. * 创建时间:${date?string("yyyy-MM-dd HH:mm:ss")}
  34. */
  35. @Entity(name="${tableName}")
  36. public class ${class}Entity extends SimpleEntity{
  37. <#list model.columnList as col>
  38. @Property(name="${col.columnName}")
  39. protected ${col.colType} ${func.convertUnderLine(col.columnName)}; /*${col.comment}*/
  40. </#list>
  41. <#if (pkVar!="id")>
  42. public void setId(String ${pkVar}) {
  43. this.${pkVar} = ${pkVar};
  44. }
  45. public String getId() {
  46. return ${pkVar};
  47. }
  48. </#if>
  49. <#list model.columnList as col>
  50. <#assign colName=func.convertUnderLine(col.columnName)>
  51. public void set${colName?cap_first}(${col.colType} ${colName})
  52. {
  53. this.${colName} = ${colName};
  54. }
  55. /**
  56. * 返回 ${col.comment}
  57. * @return
  58. */
  59. public ${col.colType} get${colName?cap_first}()
  60. {
  61. return this.${colName};
  62. }
  63. </#list>
  64. /**
  65. * @see java.lang.Object#toString()
  66. */
  67. public String toString()
  68. {
  69. return new ToStringBuilder(this)
  70. <#list model.columnList as col>
  71. <#assign colName=func.convertUnderLine(col.columnName)>
  72. .append("${colName}", this.${colName})
  73. </#list>
  74. .toString();
  75. }
  76. }