2026-01-16 19:38:06 +08:00
|
|
|
package com.ruoyi.device.service.convert;
|
|
|
|
|
|
2026-01-21 11:14:31 +08:00
|
|
|
import com.ruoyi.common.core.utils.BaseConvert;
|
2026-01-16 19:38:06 +08:00
|
|
|
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
|
|
|
|
|
*/
|
2026-01-21 13:18:33 +08:00
|
|
|
public class DeviceDTOConvert extends BaseConvert<Device, DeviceDTO>
|
2026-01-16 19:38:06 +08:00
|
|
|
{
|
2026-01-21 11:14:31 +08:00
|
|
|
|
2026-01-21 13:18:33 +08:00
|
|
|
private static final DeviceDTOConvert INSTANCE = new DeviceDTOConvert();
|
2026-01-21 11:14:31 +08:00
|
|
|
|
2026-01-21 13:18:33 +08:00
|
|
|
private DeviceDTOConvert() {
|
2026-01-21 11:14:31 +08:00
|
|
|
super(Device.class, DeviceDTO.class);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-16 19:38:06 +08:00
|
|
|
/**
|
|
|
|
|
* Model 转 DTO
|
|
|
|
|
*/
|
2026-01-21 11:14:31 +08:00
|
|
|
public static DeviceDTO from(Device model)
|
2026-01-16 19:38:06 +08:00
|
|
|
{
|
2026-01-21 11:14:31 +08:00
|
|
|
return INSTANCE.innerFrom(model);
|
2026-01-16 19:38:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* DTO 转 Model
|
|
|
|
|
*/
|
2026-01-21 11:14:31 +08:00
|
|
|
public static Device to(DeviceDTO dto)
|
2026-01-16 19:38:06 +08:00
|
|
|
{
|
2026-01-21 11:14:31 +08:00
|
|
|
return INSTANCE.innerTo(dto);
|
2026-01-16 19:38:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Model List 转 DTO List
|
|
|
|
|
*/
|
2026-01-21 11:14:31 +08:00
|
|
|
public static List<DeviceDTO> fromList(List<Device> modelList)
|
|
|
|
|
{
|
|
|
|
|
return INSTANCE.innerFromList(modelList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* DTO List 转 Model List
|
|
|
|
|
*/
|
|
|
|
|
public static List<Device> toList(List<DeviceDTO> dtoList)
|
2026-01-16 19:38:06 +08:00
|
|
|
{
|
2026-01-21 11:14:31 +08:00
|
|
|
return INSTANCE.innerToList(dtoList);
|
2026-01-16 19:38:06 +08:00
|
|
|
}
|
2026-01-21 11:14:31 +08:00
|
|
|
|
2026-01-16 19:38:06 +08:00
|
|
|
}
|