package com.ruoyi.device.controller.convert; import com.ruoyi.common.core.utils.BaseConvert; import com.ruoyi.device.api.domain.DockVO; import com.ruoyi.device.service.dto.DockDTO; import com.ruoyi.device.service.dto.DockDetailDTO; import org.springframework.beans.BeanUtils; import java.util.List; import java.util.stream.Collectors; /** * 机场Controller转换器 * * @author ruoyi * @date 2026-01-20 */ public class DockVOConvert extends BaseConvert { private static final DockVOConvert INSTANCE = new DockVOConvert(); private DockVOConvert() { super(DockDTO.class, DockVO.class); } /** * DTO 转 VO */ public static DockVO from(DockDTO dto) { return INSTANCE.innerFrom(dto); } /** * VO 转 DTO */ public static DockDTO to(DockVO vo) { return INSTANCE.innerTo(vo); } /** * DTO List 转 VO List */ public static List fromList(List dtoList) { return INSTANCE.innerFromList(dtoList); } /** * DTO List 转 VO List */ public static List fromDockDetailDTOList(List sourceList) { if (sourceList == null) return null; return sourceList.stream().map(DockVOConvert::fromDockDetailDTO).collect(Collectors.toList()); } public static DockVO fromDockDetailDTO(DockDetailDTO source){ if (source == null) return null; try { DockVO target = new DockVO(); BeanUtils.copyProperties(source, target); return target; } catch (Exception e) { throw new RuntimeException(e); } } /** * VO List 转 DTO List */ public static List toList(List voList) { return INSTANCE.innerToList(voList); } }