cgform_entityTemplate.ftl 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 功能专项任务--> </#if>
  44. <#--update-start--Author:luobaoli Date:20150609 for:将数据库中blob类型对应为byte[]-->
  45. private <#if po.type=='java.sql.Blob'>byte[]<#else>${po.type}</#if> ${po.fieldName};
  46. <#--update-end--Author:luobaoli Date:20150609 for:将数据库中blob类型对应为byte[]-->
  47. </#list>
  48. <#list columns as po>
  49. /**
  50. *方法: 取得${po.type}
  51. *@return: ${po.type} ${po.content}
  52. */
  53. <#if po.fieldName == jeecg_table_id>
  54. <#if cgformConfig.cgFormHead.jformPkType?if_exists?html == "UUID">
  55. @Id
  56. @GeneratedValue(generator = "paymentableGenerator")
  57. @GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
  58. <#elseif cgformConfig.cgFormHead.jformPkType?if_exists?html == "NATIVE">
  59. @Id
  60. @GeneratedValue(strategy = GenerationType.AUTO)
  61. <#elseif cgformConfig.cgFormHead.jformPkType?if_exists?html == "SEQUENCE">
  62. @Id
  63. @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="SEQ_GEN")
  64. <#else>
  65. @Id
  66. @GeneratedValue(generator = "paymentableGenerator")
  67. @GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
  68. </#if>
  69. </#if>
  70. <#--update-start--Author:luobaoli Date:20150609 for:将数据库中blob类型对应为byte[],且去掉length属性-->
  71. @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>)
  72. public <#if po.type=='java.sql.Blob'>byte[]<#else>${po.type}</#if> get${po.fieldName?cap_first}(){
  73. return this.${po.fieldName};
  74. }
  75. /**
  76. *方法: 设置${po.type}
  77. *@param: ${po.type} ${po.content}
  78. */
  79. public void set${po.fieldName?cap_first}(<#if po.type=='java.sql.Blob'>byte[]<#else>${po.type}</#if> ${po.fieldName}){
  80. this.${po.fieldName} = ${po.fieldName};
  81. }
  82. <#--update-end--Author:luobaoli Date:20150609 for:将数据库中blob类型对应为byte[],且去掉length属性-->
  83. </#list>
  84. }