ConvertDepartmentTool.java 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. package com.persagy.fm.department.model;
  2. import com.persagy.fm.department.jms.model.GroupCreateMsg;
  3. import com.persagy.fm.department.model.dto.AddDepartmentDTO;
  4. import com.persagy.fm.department.model.dto.UpdateDepartmentDTO;
  5. import com.persagy.fm.department.model.vo.ResponseDepartmentItemVO;
  6. import com.persagy.fm.department.model.vo.ResponseDepartmentListItemVO;
  7. import com.persagy.fm.department.model.vo.ResponseDepartmentTreeItemVO;
  8. import org.mapstruct.*;
  9. import org.mapstruct.factory.Mappers;
  10. import java.util.List;
  11. /**
  12. * 部门(Department) dto、vo、do转换工具类
  13. *
  14. * @author lixing
  15. * @version V1.0 2021-03-11 15:09:19 2021-03-11 15:09:19
  16. */
  17. @Mapper(nullValueMappingStrategy = NullValueMappingStrategy.RETURN_DEFAULT,
  18. nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
  19. public interface ConvertDepartmentTool {
  20. ConvertDepartmentTool INSTANCE = Mappers.getMapper(ConvertDepartmentTool.class);
  21. /**
  22. * 实体转换为ResponseItemVO
  23. *
  24. * @param department do对象
  25. * @return ResponseItemVO
  26. * @author lixing
  27. * @version V1.0 2021-03-11 15:09:19
  28. */
  29. @Mapping(source = "managers", target = "managers", ignore = true)
  30. ResponseDepartmentItemVO convert2ResponseItemDTO(Department department);
  31. /**
  32. * 实体转换为ResponseListItemVO
  33. *
  34. * @param department do对象
  35. * @return ResponseListItemVO
  36. * @author lixing
  37. * @version V1.0 2021-03-11 15:09:19
  38. */
  39. ResponseDepartmentListItemVO convert2ResponseListItemDTO(Department department);
  40. /**
  41. * 实体列表转换为ResponseListItemVO列表
  42. *
  43. * @param departmentList do列表
  44. * @return ResponseListItemVO列表
  45. * @author lixing
  46. * @version V1.0 2021-03-11 15:09:19
  47. */
  48. List<ResponseDepartmentListItemVO> convert2List(List<Department> departmentList);
  49. /**
  50. * addDTO转换为实体
  51. *
  52. * @param addDepartmentDTO addDTO
  53. * @return do对象
  54. * @author lixing
  55. * @version V1.0 2021-03-11 15:09:19
  56. */
  57. Department convertAddDto2Entity(AddDepartmentDTO addDepartmentDTO);
  58. /**
  59. * updateDTO转换为实体
  60. *
  61. * @param department 更新前的do对象
  62. * @param updateDepartmentDTO updateDTO
  63. * @return do对象
  64. * @author lixing
  65. * @version V1.0 2021-03-11 15:09:19
  66. */
  67. Department convertUpdateDto2Entity(@MappingTarget Department department, UpdateDepartmentDTO updateDepartmentDTO);
  68. /**
  69. * 实体列表换为ResponseTreeItemVO列表
  70. *
  71. * @param depList 部门实体列表
  72. * @return ResponseTreeItemVO列表
  73. * @author lixing
  74. * @version V1.0 2021/3/12 3:09 下午
  75. */
  76. List<ResponseDepartmentTreeItemVO> convert2Tree(List<Department> depList);
  77. /**
  78. * 实体转换为树节点对象
  79. *
  80. * @param department do对象
  81. * @return 树节点对象
  82. * @author lixing
  83. * @version V1.0 2021/3/12 4:40 下午
  84. */
  85. ResponseDepartmentTreeItemVO convert2TreeItemVO(Department department);
  86. /**
  87. * 集团创建消息转换为创建部门入参
  88. *
  89. * @param groupCreateMsg 集团创建消息
  90. * @return 创建部门入参
  91. * @author lixing
  92. * @version V1.0 2021/3/18 6:38 下午
  93. */
  94. AddDepartmentDTO convert2AddDto(GroupCreateMsg groupCreateMsg);
  95. }