2026-01-20 13:20:39 +08:00
|
|
|
package com.ruoyi.device.controller.convert;
|
|
|
|
|
|
2026-01-20 16:09:06 +08:00
|
|
|
import com.ruoyi.device.api.domain.DockVO;
|
|
|
|
|
import com.ruoyi.device.api.domain.GroupVO;
|
|
|
|
|
import com.ruoyi.device.service.dto.DockDTO;
|
|
|
|
|
import com.ruoyi.device.service.dto.GroupDTO;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
2026-01-20 13:20:39 +08:00
|
|
|
/**
|
|
|
|
|
* 分组Controller转换器
|
|
|
|
|
*
|
|
|
|
|
* @author ruoyi
|
|
|
|
|
* @date 2026-01-20
|
|
|
|
|
*/
|
|
|
|
|
public class GroupControllerConvert
|
|
|
|
|
{
|
2026-01-20 16:09:06 +08:00
|
|
|
/**
|
|
|
|
|
* DTO 转 VO
|
|
|
|
|
*/
|
|
|
|
|
public static GroupVO toVO(GroupDTO dto)
|
|
|
|
|
{
|
|
|
|
|
if (dto == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
GroupVO vo = new GroupVO();
|
|
|
|
|
BeanUtils.copyProperties(dto, vo);
|
|
|
|
|
return vo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* VO 转 DTO
|
|
|
|
|
*/
|
|
|
|
|
public static GroupDTO toDTO(GroupVO vo)
|
|
|
|
|
{
|
|
|
|
|
if (vo == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
GroupDTO dto = new GroupDTO();
|
|
|
|
|
BeanUtils.copyProperties(vo, dto);
|
|
|
|
|
return dto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* DTO 转 VO
|
|
|
|
|
*/
|
|
|
|
|
public static DockVO toVO(DockDTO dto)
|
|
|
|
|
{
|
|
|
|
|
if (dto == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
DockVO vo = new DockVO();
|
|
|
|
|
BeanUtils.copyProperties(dto, vo);
|
|
|
|
|
return vo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* VO 转 DTO
|
|
|
|
|
*/
|
|
|
|
|
public static DockDTO toDTO(DockVO vo)
|
|
|
|
|
{
|
|
|
|
|
if (vo == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
DockDTO dto = new DockDTO();
|
|
|
|
|
BeanUtils.copyProperties(vo, dto);
|
|
|
|
|
return dto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* DTO List 转 VO List
|
|
|
|
|
*/
|
|
|
|
|
public static List<GroupVO> toVOList(List<GroupDTO> dtoList)
|
|
|
|
|
{
|
|
|
|
|
if (dtoList == null || dtoList.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
List<GroupVO> voList = new ArrayList<>();
|
|
|
|
|
for (GroupDTO dto : dtoList)
|
|
|
|
|
{
|
|
|
|
|
voList.add(toVO(dto));
|
|
|
|
|
}
|
|
|
|
|
return voList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Dock DTO List 转 Dock VO List
|
|
|
|
|
*/
|
|
|
|
|
public static List<DockVO> toDockVOList(List<DockDTO> dtoList)
|
|
|
|
|
{
|
|
|
|
|
if (dtoList == null || dtoList.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
List<DockVO> voList = new ArrayList<>();
|
|
|
|
|
for (DockDTO dto : dtoList)
|
|
|
|
|
{
|
|
|
|
|
voList.add(toVO(dto));
|
|
|
|
|
}
|
|
|
|
|
return voList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* VO List 转 DTO List
|
|
|
|
|
*/
|
|
|
|
|
public static List<GroupDTO> toDTOList(List<GroupVO> voList)
|
|
|
|
|
{
|
|
|
|
|
if (voList == null || voList.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
return new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
List<GroupDTO> dtoList = new ArrayList<>();
|
|
|
|
|
for (GroupVO vo : voList)
|
|
|
|
|
{
|
|
|
|
|
dtoList.add(toDTO(vo));
|
|
|
|
|
}
|
|
|
|
|
return dtoList;
|
|
|
|
|
}
|
2026-01-20 13:20:39 +08:00
|
|
|
}
|