Entity.java.ftl 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package ${package}.modules.${moduleName}.entity<#if subModuleName??>.${subModuleName}</#if>;
  2. import lombok.Data;
  3. import lombok.EqualsAndHashCode;
  4. import com.baomidou.mybatisplus.annotation.*;
  5. <#list imports as i>
  6. import ${i!};
  7. </#list>
  8. <#if baseClassEntity??>
  9. import ${baseClassEntity.packageName};
  10. </#if>
  11. /**
  12. * ${tableComment}
  13. *
  14. * @author ${author} ${email}
  15. * @since ${version} ${date}
  16. */
  17. @Data
  18. @EqualsAndHashCode(callSuper=false)
  19. @TableName("${tableName}")
  20. public class ${ClassName}Entity<#if baseClassEntity??> extends ${baseClassEntity.code}</#if> {
  21. private static final long serialVersionUID = 1L;
  22. <#list columnList as column>
  23. <#if baseClassEntity?? && baseClassEntity.fields?split(",")?seq_contains(column.columnName)>
  24. <#else>
  25. <#if column.comment!?length gt 0>
  26. /**
  27. * ${column.comment}
  28. */
  29. </#if>
  30. <#if "creator,create_date,dept_id,tenant_code"?split(",")?seq_contains(column.columnName)>
  31. @TableField(fill = FieldFill.INSERT)
  32. </#if>
  33. <#if "updater,update_date"?split(",")?seq_contains(column.columnName)>
  34. @TableField(fill = FieldFill.INSERT_UPDATE)
  35. </#if>
  36. <#if column.pk>
  37. @TableId
  38. </#if>
  39. private ${column.attrType} ${column.attrName};
  40. </#if>
  41. </#list>
  42. }