80 lines
1.8 KiB
Java
80 lines
1.8 KiB
Java
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<DockDTO, DockVO>
|
|
{
|
|
|
|
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<DockVO> fromList(List<DockDTO> dtoList)
|
|
{
|
|
return INSTANCE.innerFromList(dtoList);
|
|
}
|
|
|
|
|
|
/**
|
|
* DTO List 转 VO List
|
|
*/
|
|
public static List<DockVO> fromDockDetailDTOList(List<DockDetailDTO> 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<DockDTO> toList(List<DockVO> voList)
|
|
{
|
|
return INSTANCE.innerToList(voList);
|
|
}
|
|
} |