cgform_entityTemplate.ftl 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <#if packageStyle == "service">
  2. package ${bussiPackage}.${entityPackage}.entity;
  3. <#else>
  4. package ${bussiPackage}.entity.${entityPackage};
  5. </#if>
  6. import java.math.BigDecimal;
  7. import java.util.Date;
  8. import java.lang.String;
  9. import java.lang.Double;
  10. import java.lang.Integer;
  11. import java.math.BigDecimal;
  12. import javax.xml.soap.Text;
  13. import java.sql.Blob;
  14. import javax.persistence.Column;
  15. import javax.persistence.Entity;
  16. import javax.persistence.GeneratedValue;
  17. import javax.persistence.GenerationType;
  18. import javax.persistence.Id;
  19. import javax.persistence.Table;
  20. import org.hibernate.annotations.GenericGenerator;
  21. import javax.persistence.SequenceGenerator;
  22. import org.jeecgframework.poi.excel.annotation.Excel;
  23. /**
  24. * @Title: Entity
  25. * @Description: ${ftl_description}
  26. * @author onlineGenerator
  27. * @date ${ftl_create_time}
  28. * @version V1.0
  29. *
  30. */
  31. @Entity
  32. @Table(name = "${tableName}", schema = "")
  33. <#if cgformConfig.cgFormHead.jformPkType?if_exists?html == "SEQUENCE">
  34. @SequenceGenerator(name="SEQ_GEN", sequenceName="${cgformConfig.cgFormHead.jformPkSequence}")
  35. </#if>
  36. @SuppressWarnings("serial")
  37. public class ${entityName}Entity implements java.io.Serializable {
  38. <#list columns as po>
  39. /**${po.content}*/
  40. <#if po.isShow != 'N'>
  41. <#--update-start--Author:dangzhenghui Date:20170503 for:TASK #1864 【excel】Excel 功能专项任务-->
  42. @Excel(name="${po.content}",width=15<#if po.type == "java.util.Date">,format = "yyyy-MM-dd"</#if><#if po.dictTable?if_exists?html!="">,dictTable ="${po.dictTable}",dicCode ="${po.dictField}",dicText ="${po.dictText}"</#if><#if po.dictTable?if_exists?html=="" && po.dictField?if_exists?html!="">,dicCode="${po.dictField}"</#if>)
  43. <#--update-end--Author:dangzhenghui Date:20170503 for:TASK #1864 【excel】Excel 功能专项任务-->
  44. </#if>
  45. <#if po.type == "javax.xml.soap.Text">
  46. private java.lang.String ${po.fieldName};
  47. </#if>
  48. <#if po.type != "javax.xml.soap.Text">
  49. <#--update-start--Author:luobaoli Date:20150609 for:将数据库中blob类型对应为byte[]-->
  50. private <#if po.type=='java.sql.Blob'>byte[]<#else>${po.type}</#if> ${po.fieldName};
  51. <#--update-end--Author:luobaoli Date:20150609 for:将数据库中blob类型对应为byte[]-->
  52. </#if>
  53. </#list>
  54. <#list columns as po>
  55. /**
  56. *方法: 取得${po.type}
  57. *@return: ${po.type} ${po.content}
  58. */
  59. <#if po.fieldName == jeecg_table_id>
  60. <#if cgformConfig.cgFormHead.jformPkType?if_exists?html == "UUID">
  61. @Id
  62. @GeneratedValue(generator = "paymentableGenerator")
  63. @GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
  64. <#elseif cgformConfig.cgFormHead.jformPkType?if_exists?html == "NATIVE">
  65. @Id
  66. @GeneratedValue(strategy = GenerationType.AUTO)
  67. <#elseif cgformConfig.cgFormHead.jformPkType?if_exists?html == "SEQUENCE">
  68. @Id
  69. @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="SEQ_GEN")
  70. <#else>
  71. @Id
  72. @GeneratedValue(generator = "paymentableGenerator")
  73. @GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
  74. </#if>
  75. </#if>
  76. <#if po.type == "javax.xml.soap.Text">
  77. @Column(name ="${fieldMeta[po.fieldName]}",nullable=<#if po.isNull == 'Y'>true<#else>false</#if><#if po.pointLength != 0>,scale=${po.pointLength}</#if>,length=1000)
  78. public java.lang.String get${po.fieldName?cap_first}(){
  79. return this.${po.fieldName};
  80. }
  81. /**
  82. *方法: 设置java.lang.String
  83. *@param: java.lang.String ${po.content}
  84. */
  85. public void set${po.fieldName?cap_first}(java.lang.String ${po.fieldName}){
  86. this.${po.fieldName} = ${po.fieldName};
  87. }
  88. </#if>
  89. <#if po.type != "javax.xml.soap.Text">
  90. <#--update-start--Author:luobaoli Date:20150609 for:将数据库中blob类型对应为byte[],且去掉length属性-->
  91. @Column(name ="${fieldMeta[po.fieldName]}",nullable=<#if po.isNull == 'Y'>true<#else>false</#if><#if po.pointLength != 0>,scale=${po.pointLength}</#if><#if po.type!='java.sql.Blob'><#if po.length !=0>,length=${po.length?c}</#if></#if>)
  92. public <#if po.type=='java.sql.Blob'>byte[]<#else>${po.type}</#if> get${po.fieldName?cap_first}(){
  93. return this.${po.fieldName};
  94. }
  95. /**
  96. *方法: 设置${po.type}
  97. *@param: ${po.type} ${po.content}
  98. */
  99. public void set${po.fieldName?cap_first}(<#if po.type=='java.sql.Blob'>byte[]<#else>${po.type}</#if> ${po.fieldName}){
  100. this.${po.fieldName} = ${po.fieldName};
  101. }
  102. <#--update-end--Author:luobaoli Date:20150609 for:将数据库中blob类型对应为byte[],且去掉length属性-->
  103. </#if>
  104. </#list>
  105. }