dto.java.ftl 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package ${cfg.DTO};
  2. <#list table.importPackages as pkg>
  3. import ${pkg};
  4. </#list>
  5. <#if swagger2>
  6. import io.swagger.annotations.ApiModel;
  7. </#if>
  8. import ${package.Entity}.${entity};
  9. <#if entityLombokModel>
  10. import lombok.Data;
  11. import lombok.EqualsAndHashCode;
  12. import lombok.NoArgsConstructor;
  13. import lombok.ToString;
  14. import lombok.experimental.Accessors;
  15. </#if>
  16. import java.io.Serializable;
  17. /**
  18. * <p>
  19. * 实体类
  20. * ${table.comment!?replace("\n","\n * ")}
  21. * </p>
  22. *
  23. * @author ${author}
  24. * @since ${date}
  25. */
  26. <#if entityLombokModel>
  27. @Data
  28. @NoArgsConstructor
  29. @Accessors(chain = true)
  30. @ToString(callSuper = true)
  31. @EqualsAndHashCode(callSuper = false)
  32. </#if>
  33. <#if swagger2>
  34. @ApiModel(value = "${entity}DTO", description = "${table.comment!?replace("\r\n"," ")?replace("\r"," ")?replace("\n"," ")}")
  35. </#if>
  36. public class ${entity}DTO extends ${entity} implements Serializable {
  37. /**
  38. * 在DTO中新增并自定义字段,需要覆盖验证的字段,请新建DTO。Entity中的验证规则可以自行修改,但下次生成代码时,记得同步代码!!
  39. */
  40. private static final long serialVersionUID = 1L;
  41. public static ${entity}DTO build() {
  42. return new ${entity}DTO();
  43. }
  44. }