entity.java.ftl 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. import java.util.Date;
  17. /**
  18. * @title: ${tableComment}
  19. * @Author ${author}
  20. * @Date: ${date}
  21. * @Version 1.0
  22. */
  23. @Data
  24. @TableName("${tableName}")
  25. @ApiModel(value = "${tableName}", description = "${tableComment}")
  26. public class ${entityClass} implements Serializable {
  27. private static final long serialVersionUID = 1L;
  28. <#--属性遍历-->
  29. <#list fields as field>
  30. /**
  31. * ${field.fieldComment}
  32. */
  33. @ApiModelProperty("${field.fieldComment}")
  34. <#if field.autoInsert?? >
  35. @TableField(fill = FieldFill.INSERT)
  36. </#if>
  37. <#if field.autoUpdate?? >
  38. @TableField(fill = FieldFill.UPDATE)
  39. </#if>
  40. <#if field.deleteMark?? >
  41. @TableLogic
  42. </#if>
  43. <#if field.pk>
  44. @TableId
  45. </#if>
  46. private ${field.fieldType} ${field.fieldName};
  47. </#list>
  48. <#--子表遍历-->
  49. <#if childTables?? >
  50. <#list childTables as childTable>
  51. /**
  52. * ${childTable.tableName}
  53. */
  54. @ApiModelProperty("${childTable.tableName}子表")
  55. @TableField(exist = false)
  56. @EntityMapping(thisField = "${childTable.relationTableField}", joinField = "${childTable.relationField}")
  57. private List<${childTable.tableName?cap_first}> ${childTable.tableName}List;
  58. </#list>
  59. </#if>
  60. }