2026-01-16 19:38:06 +08:00
|
|
|
package com.ruoyi.device.service.convert;
|
|
|
|
|
|
2026-01-20 15:56:42 +08:00
|
|
|
import com.ruoyi.device.api.domain.DockVO;
|
2026-01-16 19:38:06 +08:00
|
|
|
import com.ruoyi.device.domain.model.Dock;
|
|
|
|
|
import com.ruoyi.device.service.dto.DockDTO;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 机场Service层转换器
|
2026-01-20 15:56:42 +08:00
|
|
|
* Service DTO ↔ Domain Model ↔ API VO
|
2026-01-16 19:38:06 +08:00
|
|
|
*
|
|
|
|
|
* @author ruoyi
|
|
|
|
|
* @date 2026-01-16
|
|
|
|
|
*/
|
|
|
|
|
public class DockServiceConvert
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Model 转 DTO
|
|
|
|
|
*/
|
|
|
|
|
public static DockDTO toDTO(Dock model)
|
|
|
|
|
{
|
|
|
|
|
if (model == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
DockDTO dto = new DockDTO();
|
|
|
|
|
BeanUtils.copyProperties(model, dto);
|
|
|
|
|
return dto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* DTO 转 Model
|
|
|
|
|
*/
|
|
|
|
|
public static Dock toModel(DockDTO dto)
|
|
|
|
|
{
|
|
|
|
|
if (dto == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
Dock model = new Dock();
|
|
|
|
|
BeanUtils.copyProperties(dto, model);
|
|
|
|
|
return model;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-20 15:56:42 +08:00
|
|
|
/**
|
|
|
|
|
* Model 转 VO
|
|
|
|
|
*/
|
|
|
|
|
public static DockVO toVO(Dock model)
|
|
|
|
|
{
|
|
|
|
|
if (model == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
DockVO vo = new DockVO();
|
|
|
|
|
BeanUtils.copyProperties(model, vo);
|
|
|
|
|
return vo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* DTO 转 VO
|
|
|
|
|
*/
|
|
|
|
|
public static DockVO toVO(DockDTO dto)
|
|
|
|
|
{
|
|
|
|
|
if (dto == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
DockVO vo = new DockVO();
|
|
|
|
|
BeanUtils.copyProperties(dto, vo);
|
|
|
|
|
return vo;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-16 19:38:06 +08:00
|
|
|
/**
|
|
|
|
|
* Model List 转 DTO List
|
|
|
|
|
*/
|
|
|
|
|
public static List<DockDTO> toDTOList(List<Dock> modelList)
|
|
|
|
|
{
|
|
|
|
|
if (modelList == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return modelList.stream().map(DockServiceConvert::toDTO).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
}
|