entityTemplate.ftl 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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.DynamicInsert;
  11. import org.hibernate.annotations.DynamicUpdate;
  12. import org.hibernate.annotations.GenericGenerator;
  13. import javax.persistence.SequenceGenerator;
  14. /**
  15. * @Title: Entity
  16. * @Description: ${ftl_description}
  17. * @author zhangdaihao
  18. * @date ${ftl_create_time}
  19. * @version V1.0
  20. *
  21. */
  22. @Entity
  23. @Table(name = "${tableName}", schema = "")
  24. @DynamicUpdate(true)
  25. @DynamicInsert(true)
  26. @SuppressWarnings("serial")
  27. public class ${entityName}Entity implements java.io.Serializable {
  28. <#list originalColumns as po>
  29. /**${po.filedComment}*/
  30. private ${po.fieldType} ${po.fieldName};
  31. </#list>
  32. <#list originalColumns as po>
  33. /**
  34. *方法: 取得${po.fieldType}
  35. *@return: ${po.fieldType} ${po.filedComment}
  36. */
  37. <#if po.fieldName == jeecg_table_id>
  38. <#if jeecg_primary_key_policy == 'uuid'>
  39. @Id
  40. @GeneratedValue(generator = "paymentableGenerator")
  41. @GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
  42. </#if>
  43. <#if jeecg_primary_key_policy == 'identity'>
  44. @Id
  45. @GeneratedValue(strategy = GenerationType.IDENTITY)
  46. </#if>
  47. <#if jeecg_primary_key_policy == 'sequence'>
  48. @Id
  49. @GeneratedValue(strategy = GenerationType.SEQUENCE,generator="sequence")
  50. @SequenceGenerator(name="sequence",sequenceName="${jeecg_sequence_code}",allocationSize=1)
  51. </#if>
  52. </#if>
  53. @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 != ''>,length=${po.charmaxLength}</#if>)
  54. public ${po.fieldType} get${po.fieldName?cap_first}(){
  55. return this.${po.fieldName};
  56. }
  57. /**
  58. *方法: 设置${po.fieldType}
  59. *@param: ${po.fieldType} ${po.filedComment}
  60. */
  61. public void set${po.fieldName?cap_first}(${po.fieldType} ${po.fieldName}){
  62. this.${po.fieldName} = ${po.fieldName};
  63. }
  64. </#list>
  65. }