a-tuoheng-device/src/main/java/com/ruoyi/device/service/convert/DeviceDTOConvert.java

57 lines
1.1 KiB
Java

package com.ruoyi.device.service.convert;
import com.ruoyi.common.core.utils.BaseConvert;
import com.ruoyi.device.domain.model.Device;
import com.ruoyi.device.service.dto.DeviceDTO;
import java.util.List;
/**
* 设备Service层转换器
* Service DTO ↔ Domain Model
*
* @author ruoyi
* @date 2026-01-16
*/
public class DeviceDTOConvert extends BaseConvert<Device, DeviceDTO>
{
private static final DeviceDTOConvert INSTANCE = new DeviceDTOConvert();
private DeviceDTOConvert() {
super(Device.class, DeviceDTO.class);
}
/**
* Model 转 DTO
*/
public static DeviceDTO from(Device model)
{
return INSTANCE.innerFrom(model);
}
/**
* DTO 转 Model
*/
public static Device to(DeviceDTO dto)
{
return INSTANCE.innerTo(dto);
}
/**
* Model List 转 DTO List
*/
public static List<DeviceDTO> fromList(List<Device> modelList)
{
return INSTANCE.innerFromList(modelList);
}
/**
* DTO List 转 Model List
*/
public static List<Device> toList(List<DeviceDTO> dtoList)
{
return INSTANCE.innerToList(dtoList);
}
}