58 lines
1.3 KiB
Java
58 lines
1.3 KiB
Java
|
|
package com.ruoyi.device.controller.convert;
|
||
|
|
|
||
|
|
import com.ruoyi.device.api.domain.DeviceTempVO;
|
||
|
|
import com.ruoyi.device.service.dto.DeviceTempDTO;
|
||
|
|
import org.springframework.beans.BeanUtils;
|
||
|
|
|
||
|
|
import java.util.List;
|
||
|
|
import java.util.stream.Collectors;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 设备临时表Controller层转换器
|
||
|
|
* API Domain ↔ Service DTO
|
||
|
|
*
|
||
|
|
* @author ruoyi
|
||
|
|
* @date 2026-01-15
|
||
|
|
*/
|
||
|
|
public class DeviceTempConvert
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* DTO 转 API Domain
|
||
|
|
*/
|
||
|
|
public static DeviceTempVO toVO(DeviceTempDTO dto)
|
||
|
|
{
|
||
|
|
if (dto == null)
|
||
|
|
{
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
DeviceTempVO apiDomain = new DeviceTempVO();
|
||
|
|
BeanUtils.copyProperties(dto, apiDomain);
|
||
|
|
return apiDomain;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* API Domain 转 DTO
|
||
|
|
*/
|
||
|
|
public static DeviceTempDTO toDTO(DeviceTempVO apiDomain)
|
||
|
|
{
|
||
|
|
if (apiDomain == null)
|
||
|
|
{
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
DeviceTempDTO dto = new DeviceTempDTO();
|
||
|
|
BeanUtils.copyProperties(apiDomain, dto);
|
||
|
|
return dto;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* DTO List 转 API Domain List
|
||
|
|
*/
|
||
|
|
public static List<DeviceTempVO> toApiDomainList(List<DeviceTempDTO> dtoList)
|
||
|
|
{
|
||
|
|
if (dtoList == null)
|
||
|
|
{
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
return dtoList.stream().map(DeviceTempConvert::toVO).collect(Collectors.toList());
|
||
|
|
}
|
||
|
|
}
|