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