entity.java.ftl 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package ${package};
  2. import com.baomidou.mybatisplus.annotation.FieldFill;
  3. import com.baomidou.mybatisplus.annotation.TableField;
  4. import com.baomidou.mybatisplus.annotation.TableLogic;
  5. import com.baomidou.mybatisplus.annotation.TableName;
  6. import com.baomidou.mybatisplus.annotation.TableId;
  7. import com.github.yulichang.annotation.EntityMapping;
  8. import io.swagger.annotations.ApiModel;
  9. import io.swagger.annotations.ApiModelProperty;
  10. import lombok.Data;
  11. import java.io.Serializable;
  12. import java.time.LocalTime;
  13. import java.time.LocalDateTime;
  14. import java.math.BigDecimal;
  15. import java.util.List;
  16. /**
  17. * @title: ${tableComment}
  18. * @Author ${author}
  19. * @Date: ${date}
  20. * @Version 1.0
  21. */
  22. @Data
  23. @TableName("${tableName}")
  24. @ApiModel(value = "${tableComment}对象", description = "${tableComment}")
  25. public class ${entityClass} implements Serializable {
  26. private static final long serialVersionUID = 1L;
  27. <#--属性遍历-->
  28. <#list fields as field>
  29. /**
  30. * ${(field.fieldComment)!''}
  31. */
  32. @ApiModelProperty("${(field.fieldComment)!''}")
  33. <#if field.autoInsert?? >
  34. @TableField(fill = FieldFill.INSERT)
  35. </#if>
  36. <#if field.autoUpdate?? >
  37. @TableField(fill = FieldFill.UPDATE)
  38. </#if>
  39. <#if field.deleteMark?? >
  40. @TableLogic
  41. </#if>
  42. <#if field.pk>
  43. @TableId
  44. </#if>
  45. private ${field.fieldType} ${field.fieldName};
  46. </#list>
  47. <#--子表遍历-->
  48. <#if childTables?? >
  49. <#list childTables as childTable>
  50. /**
  51. * ${childTable.tableName}
  52. */
  53. @ApiModelProperty("${childTable.tableName}子表")
  54. @TableField(exist = false)
  55. @EntityMapping(thisField = "${childTable.relationTableField}", joinField = "${childTable.relationField}")
  56. private List<${childTable.tableName?cap_first}> ${childTable.tableName}List;
  57. </#list>
  58. </#if>
  59. }