entityTemplate.ftl 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package ${bussiPackage}.entity.${entityPackage};
  2. import java.math.BigDecimal;
  3. import java.util.Date;
  4. import javax.persistence.Column;
  5. import javax.persistence.Entity;
  6. import javax.persistence.GeneratedValue;
  7. import javax.persistence.GenerationType;
  8. import javax.persistence.Id;
  9. import javax.persistence.Table;
  10. import org.hibernate.annotations.GenericGenerator;
  11. import javax.persistence.SequenceGenerator;
  12. /**
  13. * @Title: Entity
  14. * @Description: ${ftl_description}
  15. * @author zhangdaihao
  16. * @date ${ftl_create_time}
  17. * @version V1.0
  18. *
  19. */
  20. @Entity
  21. @Table(name = "${tableName}", schema = "")
  22. @SuppressWarnings("serial")
  23. public class ${entityName}Entity implements java.io.Serializable {
  24. <#list originalColumns as po>
  25. /**${po.filedComment}*/
  26. private ${po.fieldType} ${po.fieldName};
  27. </#list>
  28. <#list originalColumns as po>
  29. /**
  30. *方法: 取得${po.fieldType}
  31. *@return: ${po.fieldType} ${po.filedComment}
  32. */
  33. <#if po.fieldName == jeecg_table_id>
  34. <#if jeecg_primary_key_policy == 'uuid'>
  35. @Id
  36. @GeneratedValue(generator = "paymentableGenerator")
  37. @GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
  38. </#if>
  39. <#if jeecg_primary_key_policy == 'identity'>
  40. @Id
  41. @GeneratedValue(strategy = GenerationType.IDENTITY)
  42. </#if>
  43. <#if jeecg_primary_key_policy == 'sequence'>
  44. @Id
  45. @GeneratedValue(strategy = GenerationType.SEQUENCE,generator="sequence")
  46. @SequenceGenerator(name="sequence",sequenceName="${jeecg_sequence_code}",allocationSize=1)
  47. </#if>
  48. </#if>
  49. @Column(name ="${po.fieldDbName}",nullable=<#if po.nullable == 'Y'>true<#else>false</#if><#if po.precision != ''>,precision=${po.precision}</#if><#if po.scale != ''>,scale=${po.scale}</#if><#if po.charmaxLength != ''&& po.charmaxLength?length lte 8 >,length=${po.charmaxLength}</#if>)
  50. public ${po.fieldType} get${po.fieldName?cap_first}(){
  51. return this.${po.fieldName};
  52. }
  53. /**
  54. *方法: 设置${po.fieldType}
  55. *@param: ${po.fieldType} ${po.filedComment}
  56. */
  57. public void set${po.fieldName?cap_first}(${po.fieldType} ${po.fieldName}){
  58. this.${po.fieldName} = ${po.fieldName};
  59. }
  60. </#list>
  61. }