cgform_entityTemplate.ftl 4.1 KB

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