entityVO.java.btl 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are met:
  6. *
  7. * Redistributions of source code must retain the above copyright notice,
  8. * this list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * Neither the name of the dreamlu.net developer nor the names of its
  13. * contributors may be used to endorse or promote products derived from
  14. * this software without specific prior written permission.
  15. * Author: Chill 庄骞 (smallchill@163.com)
  16. */
  17. package ${strutil.replace(package.Entity,"entity","vo")};
  18. import ${packageName!}.entity.${modelClass!}Entity;
  19. import org.springblade.core.tool.node.INode;
  20. import lombok.Data;
  21. import lombok.EqualsAndHashCode;
  22. #if(templateType=="tree"){
  23. import com.fasterxml.jackson.annotation.JsonInclude;
  24. import com.fasterxml.jackson.databind.annotation.JsonSerialize;
  25. import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
  26. import java.util.ArrayList;
  27. import java.util.List;
  28. #}
  29. /**
  30. * ${codeName!} 视图实体类
  31. *
  32. * @author ${author!}
  33. * @since ${date!}
  34. */
  35. @Data
  36. @EqualsAndHashCode(callSuper = true)
  37. #if(templateType=="tree"){
  38. public class ${modelClass!}VO extends ${modelClass!}Entity implements INode<${modelClass!}VO> {
  39. private static final long serialVersionUID = 1L;
  40. /**
  41. * 主键ID
  42. */
  43. @JsonSerialize(using = ToStringSerializer.class)
  44. private Long id;
  45. /**
  46. * 父节点ID
  47. */
  48. @JsonSerialize(using = ToStringSerializer.class)
  49. private Long parentId;
  50. /**
  51. * 父节点名称
  52. */
  53. private String parentName;
  54. /**
  55. * 子孙节点
  56. */
  57. @JsonInclude(JsonInclude.Include.NON_EMPTY)
  58. private List<${modelClass!}VO> children;
  59. /**
  60. * 是否有子孙节点
  61. */
  62. @JsonInclude(JsonInclude.Include.NON_EMPTY)
  63. private Boolean hasChildren;
  64. @Override
  65. public List<${modelClass!}VO> getChildren() {
  66. if (this.children == null) {
  67. this.children = new ArrayList<>();
  68. }
  69. return this.children;
  70. }
  71. }
  72. #}else{
  73. public class ${modelClass!}VO extends ${modelClass!}Entity {
  74. private static final long serialVersionUID = 1L;
  75. }
  76. #}