package com.persagy.fm.department.model; import com.persagy.fm.department.jms.model.GroupCreateMsg; import com.persagy.fm.department.model.dto.AddDepartmentDTO; import com.persagy.fm.department.model.dto.UpdateDepartmentDTO; import com.persagy.fm.department.model.vo.ResponseDepartmentItemVO; import com.persagy.fm.department.model.vo.ResponseDepartmentListItemVO; import com.persagy.fm.department.model.vo.ResponseDepartmentTreeItemVO; import org.mapstruct.*; import org.mapstruct.factory.Mappers; import java.util.List; /** * 部门(Department) dto、vo、do转换工具类 * * @author lixing * @version V1.0 2021-03-11 15:09:19 2021-03-11 15:09:19 */ @Mapper(nullValueMappingStrategy = NullValueMappingStrategy.RETURN_DEFAULT, nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS) public interface ConvertDepartmentTool { ConvertDepartmentTool INSTANCE = Mappers.getMapper(ConvertDepartmentTool.class); /** * 实体转换为ResponseItemVO * * @param department do对象 * @return ResponseItemVO * @author lixing * @version V1.0 2021-03-11 15:09:19 */ @Mapping(source = "managers", target = "managers", ignore = true) ResponseDepartmentItemVO convert2ResponseItemDTO(Department department); /** * 实体转换为ResponseListItemVO * * @param department do对象 * @return ResponseListItemVO * @author lixing * @version V1.0 2021-03-11 15:09:19 */ ResponseDepartmentListItemVO convert2ResponseListItemDTO(Department department); /** * 实体列表转换为ResponseListItemVO列表 * * @param departmentList do列表 * @return ResponseListItemVO列表 * @author lixing * @version V1.0 2021-03-11 15:09:19 */ List convert2List(List departmentList); /** * addDTO转换为实体 * * @param addDepartmentDTO addDTO * @return do对象 * @author lixing * @version V1.0 2021-03-11 15:09:19 */ Department convertAddDto2Entity(AddDepartmentDTO addDepartmentDTO); /** * updateDTO转换为实体 * * @param department 更新前的do对象 * @param updateDepartmentDTO updateDTO * @return do对象 * @author lixing * @version V1.0 2021-03-11 15:09:19 */ Department convertUpdateDto2Entity(@MappingTarget Department department, UpdateDepartmentDTO updateDepartmentDTO); /** * 实体列表换为ResponseTreeItemVO列表 * * @param depList 部门实体列表 * @return ResponseTreeItemVO列表 * @author lixing * @version V1.0 2021/3/12 3:09 下午 */ List convert2Tree(List depList); /** * 实体转换为树节点对象 * * @param department do对象 * @return 树节点对象 * @author lixing * @version V1.0 2021/3/12 4:40 下午 */ ResponseDepartmentTreeItemVO convert2TreeItemVO(Department department); /** * 集团创建消息转换为创建部门入参 * * @param groupCreateMsg 集团创建消息 * @return 创建部门入参 * @author lixing * @version V1.0 2021/3/18 6:38 下午 */ AddDepartmentDTO convert2AddDto(GroupCreateMsg groupCreateMsg); }