58 lines
1.3 KiB
Java
58 lines
1.3 KiB
Java
package com.ruoyi.device.domain.convert;
|
|
|
|
import com.ruoyi.device.domain.model.DeviceTemp;
|
|
import com.ruoyi.device.mapper.entity.DeviceTempEntity;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
|
|
/**
|
|
* 设备临时表Domain层转换器
|
|
* Domain Model ↔ Mapper Entity
|
|
*
|
|
* @author ruoyi
|
|
* @date 2026-01-15
|
|
*/
|
|
public class DeviceTempConvert
|
|
{
|
|
/**
|
|
* Entity 转 Model
|
|
*/
|
|
public static DeviceTemp toModel(DeviceTempEntity entity)
|
|
{
|
|
if (entity == null)
|
|
{
|
|
return null;
|
|
}
|
|
DeviceTemp model = new DeviceTemp();
|
|
BeanUtils.copyProperties(entity, model);
|
|
return model;
|
|
}
|
|
|
|
/**
|
|
* Model 转 Entity
|
|
*/
|
|
public static DeviceTempEntity toEntity(DeviceTemp model)
|
|
{
|
|
if (model == null)
|
|
{
|
|
return null;
|
|
}
|
|
DeviceTempEntity entity = new DeviceTempEntity();
|
|
BeanUtils.copyProperties(model, entity);
|
|
return entity;
|
|
}
|
|
|
|
/**
|
|
* Entity List 转 Model List
|
|
*/
|
|
public static List<DeviceTemp> toModelList(List<DeviceTempEntity> entityList)
|
|
{
|
|
if (entityList == null)
|
|
{
|
|
return null;
|
|
}
|
|
return entityList.stream().map(DeviceTempConvert::toModel).collect(Collectors.toList());
|
|
}
|
|
} |