修改convert
This commit is contained in:
parent
97aad653f6
commit
aed2112e59
|
|
@ -1,11 +1,10 @@
|
|||
package com.ruoyi.device.service.convert;
|
||||
|
||||
import com.ruoyi.common.core.utils.BaseConvert;
|
||||
import com.ruoyi.device.domain.model.AircraftPayload;
|
||||
import com.ruoyi.device.service.dto.AircraftPayloadDTO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 无人机挂载关联Service层转换器
|
||||
|
|
@ -14,45 +13,45 @@ import java.util.stream.Collectors;
|
|||
* @author ruoyi
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
public class AircraftPayloadServiceConvert
|
||||
public class AircraftPayloadServiceConvert extends BaseConvert<AircraftPayload, AircraftPayloadDTO>
|
||||
{
|
||||
|
||||
private static final AircraftPayloadServiceConvert INSTANCE = new AircraftPayloadServiceConvert();
|
||||
|
||||
private AircraftPayloadServiceConvert() {
|
||||
super(AircraftPayload.class, AircraftPayloadDTO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model 转 DTO
|
||||
*/
|
||||
public static AircraftPayloadDTO toDTO(AircraftPayload model)
|
||||
public static AircraftPayloadDTO from(AircraftPayload model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
AircraftPayloadDTO dto = new AircraftPayloadDTO();
|
||||
BeanUtils.copyProperties(model, dto);
|
||||
return dto;
|
||||
return INSTANCE.innerFrom(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO 转 Model
|
||||
*/
|
||||
public static AircraftPayload toModel(AircraftPayloadDTO dto)
|
||||
public static AircraftPayload to(AircraftPayloadDTO dto)
|
||||
{
|
||||
if (dto == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
AircraftPayload model = new AircraftPayload();
|
||||
BeanUtils.copyProperties(dto, model);
|
||||
return model;
|
||||
return INSTANCE.innerTo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model List 转 DTO List
|
||||
*/
|
||||
public static List<AircraftPayloadDTO> toDTOList(List<AircraftPayload> modelList)
|
||||
public static List<AircraftPayloadDTO> fromList(List<AircraftPayload> modelList)
|
||||
{
|
||||
if (modelList == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return modelList.stream().map(AircraftPayloadServiceConvert::toDTO).collect(Collectors.toList());
|
||||
return INSTANCE.innerFromList(modelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO List 转 Model List
|
||||
*/
|
||||
public static List<AircraftPayload> toList(List<AircraftPayloadDTO> dtoList)
|
||||
{
|
||||
return INSTANCE.innerToList(dtoList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
package com.ruoyi.device.service.convert;
|
||||
|
||||
import com.ruoyi.common.core.utils.BaseConvert;
|
||||
import com.ruoyi.device.domain.model.Aircraft;
|
||||
import com.ruoyi.device.service.dto.AircraftDTO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 无人机Service层转换器
|
||||
|
|
@ -14,45 +13,45 @@ import java.util.stream.Collectors;
|
|||
* @author ruoyi
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
public class AircraftServiceConvert
|
||||
public class AircraftServiceConvert extends BaseConvert<Aircraft, AircraftDTO>
|
||||
{
|
||||
|
||||
private static final AircraftServiceConvert INSTANCE = new AircraftServiceConvert();
|
||||
|
||||
private AircraftServiceConvert() {
|
||||
super(Aircraft.class, AircraftDTO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model 转 DTO
|
||||
*/
|
||||
public static AircraftDTO toDTO(Aircraft model)
|
||||
public static AircraftDTO from(Aircraft model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
AircraftDTO dto = new AircraftDTO();
|
||||
BeanUtils.copyProperties(model, dto);
|
||||
return dto;
|
||||
return INSTANCE.innerFrom(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO 转 Model
|
||||
*/
|
||||
public static Aircraft toModel(AircraftDTO dto)
|
||||
public static Aircraft to(AircraftDTO dto)
|
||||
{
|
||||
if (dto == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Aircraft model = new Aircraft();
|
||||
BeanUtils.copyProperties(dto, model);
|
||||
return model;
|
||||
return INSTANCE.innerTo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model List 转 DTO List
|
||||
*/
|
||||
public static List<AircraftDTO> toDTOList(List<Aircraft> modelList)
|
||||
public static List<AircraftDTO> fromList(List<Aircraft> modelList)
|
||||
{
|
||||
if (modelList == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return modelList.stream().map(AircraftServiceConvert::toDTO).collect(Collectors.toList());
|
||||
return INSTANCE.innerFromList(modelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO List 转 Model List
|
||||
*/
|
||||
public static List<Aircraft> toList(List<AircraftDTO> dtoList)
|
||||
{
|
||||
return INSTANCE.innerToList(dtoList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
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 org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 设备Service层转换器
|
||||
|
|
@ -14,45 +13,45 @@ import java.util.stream.Collectors;
|
|||
* @author ruoyi
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
public class DeviceServiceConvert
|
||||
public class DeviceServiceConvert extends BaseConvert<Device, DeviceDTO>
|
||||
{
|
||||
|
||||
private static final DeviceServiceConvert INSTANCE = new DeviceServiceConvert();
|
||||
|
||||
private DeviceServiceConvert() {
|
||||
super(Device.class, DeviceDTO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model 转 DTO
|
||||
*/
|
||||
public static DeviceDTO toDTO(Device model)
|
||||
public static DeviceDTO from(Device model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
DeviceDTO dto = new DeviceDTO();
|
||||
BeanUtils.copyProperties(model, dto);
|
||||
return dto;
|
||||
return INSTANCE.innerFrom(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO 转 Model
|
||||
*/
|
||||
public static Device toModel(DeviceDTO dto)
|
||||
public static Device to(DeviceDTO dto)
|
||||
{
|
||||
if (dto == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Device model = new Device();
|
||||
BeanUtils.copyProperties(dto, model);
|
||||
return model;
|
||||
return INSTANCE.innerTo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model List 转 DTO List
|
||||
*/
|
||||
public static List<DeviceDTO> toDTOList(List<Device> modelList)
|
||||
public static List<DeviceDTO> fromList(List<Device> modelList)
|
||||
{
|
||||
if (modelList == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return modelList.stream().map(DeviceServiceConvert::toDTO).collect(Collectors.toList());
|
||||
return INSTANCE.innerFromList(modelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO List 转 Model List
|
||||
*/
|
||||
public static List<Device> toList(List<DeviceDTO> dtoList)
|
||||
{
|
||||
return INSTANCE.innerToList(dtoList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
package com.ruoyi.device.service.convert;
|
||||
|
||||
import com.ruoyi.common.core.utils.BaseConvert;
|
||||
import com.ruoyi.device.domain.model.DeviceTemp;
|
||||
import com.ruoyi.device.service.dto.DeviceTempDTO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 设备临时表Service层转换器
|
||||
|
|
@ -14,45 +13,45 @@ import java.util.stream.Collectors;
|
|||
* @author ruoyi
|
||||
* @date 2026-01-15
|
||||
*/
|
||||
public class DeviceTempServiceConvert
|
||||
public class DeviceTempServiceConvert extends BaseConvert<DeviceTemp, DeviceTempDTO>
|
||||
{
|
||||
|
||||
private static final DeviceTempServiceConvert INSTANCE = new DeviceTempServiceConvert();
|
||||
|
||||
private DeviceTempServiceConvert() {
|
||||
super(DeviceTemp.class, DeviceTempDTO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model 转 DTO
|
||||
*/
|
||||
public static DeviceTempDTO toDTO(DeviceTemp model)
|
||||
public static DeviceTempDTO from(DeviceTemp model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
DeviceTempDTO dto = new DeviceTempDTO();
|
||||
BeanUtils.copyProperties(model, dto);
|
||||
return dto;
|
||||
return INSTANCE.innerFrom(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO 转 Model
|
||||
*/
|
||||
public static DeviceTemp toModel(DeviceTempDTO dto)
|
||||
public static DeviceTemp to(DeviceTempDTO dto)
|
||||
{
|
||||
if (dto == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
DeviceTemp model = new DeviceTemp();
|
||||
BeanUtils.copyProperties(dto, model);
|
||||
return model;
|
||||
return INSTANCE.innerTo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model List 转 DTO List
|
||||
*/
|
||||
public static List<DeviceTempDTO> toDTOList(List<DeviceTemp> modelList)
|
||||
public static List<DeviceTempDTO> fromList(List<DeviceTemp> modelList)
|
||||
{
|
||||
if (modelList == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return modelList.stream().map(DeviceTempServiceConvert::toDTO).collect(Collectors.toList());
|
||||
return INSTANCE.innerFromList(modelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO List 转 Model List
|
||||
*/
|
||||
public static List<DeviceTemp> toList(List<DeviceTempDTO> dtoList)
|
||||
{
|
||||
return INSTANCE.innerToList(dtoList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
package com.ruoyi.device.service.convert;
|
||||
|
||||
import com.ruoyi.common.core.utils.BaseConvert;
|
||||
import com.ruoyi.device.domain.model.DockAircraft;
|
||||
import com.ruoyi.device.service.dto.DockAircraftDTO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 机场无人机关联Service层转换器
|
||||
|
|
@ -14,45 +13,45 @@ import java.util.stream.Collectors;
|
|||
* @author ruoyi
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
public class DockAircraftServiceConvert
|
||||
public class DockAircraftServiceConvert extends BaseConvert<DockAircraft, DockAircraftDTO>
|
||||
{
|
||||
|
||||
private static final DockAircraftServiceConvert INSTANCE = new DockAircraftServiceConvert();
|
||||
|
||||
private DockAircraftServiceConvert() {
|
||||
super(DockAircraft.class, DockAircraftDTO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model 转 DTO
|
||||
*/
|
||||
public static DockAircraftDTO toDTO(DockAircraft model)
|
||||
public static DockAircraftDTO from(DockAircraft model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
DockAircraftDTO dto = new DockAircraftDTO();
|
||||
BeanUtils.copyProperties(model, dto);
|
||||
return dto;
|
||||
return INSTANCE.innerFrom(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO 转 Model
|
||||
*/
|
||||
public static DockAircraft toModel(DockAircraftDTO dto)
|
||||
public static DockAircraft to(DockAircraftDTO dto)
|
||||
{
|
||||
if (dto == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
DockAircraft model = new DockAircraft();
|
||||
BeanUtils.copyProperties(dto, model);
|
||||
return model;
|
||||
return INSTANCE.innerTo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model List 转 DTO List
|
||||
*/
|
||||
public static List<DockAircraftDTO> toDTOList(List<DockAircraft> modelList)
|
||||
public static List<DockAircraftDTO> fromList(List<DockAircraft> modelList)
|
||||
{
|
||||
if (modelList == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return modelList.stream().map(DockAircraftServiceConvert::toDTO).collect(Collectors.toList());
|
||||
return INSTANCE.innerFromList(modelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO List 转 Model List
|
||||
*/
|
||||
public static List<DockAircraft> toList(List<DockAircraftDTO> dtoList)
|
||||
{
|
||||
return INSTANCE.innerToList(dtoList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
package com.ruoyi.device.service.convert;
|
||||
|
||||
import com.ruoyi.common.core.utils.BaseConvert;
|
||||
import com.ruoyi.device.domain.model.DockGroup;
|
||||
import com.ruoyi.device.service.dto.DockGroupDTO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 机场分组关联Service层转换器
|
||||
|
|
@ -14,45 +13,45 @@ import java.util.stream.Collectors;
|
|||
* @author ruoyi
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
public class DockGroupServiceConvert
|
||||
public class DockGroupServiceConvert extends BaseConvert<DockGroup, DockGroupDTO>
|
||||
{
|
||||
|
||||
private static final DockGroupServiceConvert INSTANCE = new DockGroupServiceConvert();
|
||||
|
||||
private DockGroupServiceConvert() {
|
||||
super(DockGroup.class, DockGroupDTO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model 转 DTO
|
||||
*/
|
||||
public static DockGroupDTO toDTO(DockGroup model)
|
||||
public static DockGroupDTO from(DockGroup model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
DockGroupDTO dto = new DockGroupDTO();
|
||||
BeanUtils.copyProperties(model, dto);
|
||||
return dto;
|
||||
return INSTANCE.innerFrom(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO 转 Model
|
||||
*/
|
||||
public static DockGroup toModel(DockGroupDTO dto)
|
||||
public static DockGroup to(DockGroupDTO dto)
|
||||
{
|
||||
if (dto == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
DockGroup model = new DockGroup();
|
||||
BeanUtils.copyProperties(dto, model);
|
||||
return model;
|
||||
return INSTANCE.innerTo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model List 转 DTO List
|
||||
*/
|
||||
public static List<DockGroupDTO> toDTOList(List<DockGroup> modelList)
|
||||
public static List<DockGroupDTO> fromList(List<DockGroup> modelList)
|
||||
{
|
||||
if (modelList == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return modelList.stream().map(DockGroupServiceConvert::toDTO).collect(Collectors.toList());
|
||||
return INSTANCE.innerFromList(modelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO List 转 Model List
|
||||
*/
|
||||
public static List<DockGroup> toList(List<DockGroupDTO> dtoList)
|
||||
{
|
||||
return INSTANCE.innerToList(dtoList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
package com.ruoyi.device.service.convert;
|
||||
|
||||
import com.ruoyi.common.core.utils.BaseConvert;
|
||||
import com.ruoyi.device.domain.model.Dock;
|
||||
import com.ruoyi.device.service.dto.DockDTO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 机场Service层转换器
|
||||
|
|
@ -14,45 +13,45 @@ import java.util.stream.Collectors;
|
|||
* @author ruoyi
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
public class DockServiceConvert
|
||||
public class DockServiceConvert extends BaseConvert<Dock, DockDTO>
|
||||
{
|
||||
|
||||
private static final DockServiceConvert INSTANCE = new DockServiceConvert();
|
||||
|
||||
private DockServiceConvert() {
|
||||
super(Dock.class, DockDTO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model 转 DTO
|
||||
*/
|
||||
public static DockDTO toDTO(Dock model)
|
||||
public static DockDTO from(Dock model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
DockDTO dto = new DockDTO();
|
||||
BeanUtils.copyProperties(model, dto);
|
||||
return dto;
|
||||
return INSTANCE.innerFrom(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO 转 Model
|
||||
*/
|
||||
public static Dock toModel(DockDTO dto)
|
||||
public static Dock to(DockDTO dto)
|
||||
{
|
||||
if (dto == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Dock model = new Dock();
|
||||
BeanUtils.copyProperties(dto, model);
|
||||
return model;
|
||||
return INSTANCE.innerTo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model List 转 DTO List
|
||||
*/
|
||||
public static List<DockDTO> toDTOList(List<Dock> modelList)
|
||||
public static List<DockDTO> fromList(List<Dock> modelList)
|
||||
{
|
||||
if (modelList == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return modelList.stream().map(DockServiceConvert::toDTO).collect(Collectors.toList());
|
||||
return INSTANCE.innerFromList(modelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO List 转 Model List
|
||||
*/
|
||||
public static List<Dock> toList(List<DockDTO> dtoList)
|
||||
{
|
||||
return INSTANCE.innerToList(dtoList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
package com.ruoyi.device.service.convert;
|
||||
|
||||
import com.ruoyi.common.core.utils.BaseConvert;
|
||||
import com.ruoyi.device.domain.model.Group;
|
||||
import com.ruoyi.device.service.dto.GroupDTO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 分组Service层转换器
|
||||
|
|
@ -14,45 +13,45 @@ import java.util.stream.Collectors;
|
|||
* @author ruoyi
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
public class GroupServiceConvert
|
||||
public class GroupServiceConvert extends BaseConvert<Group, GroupDTO>
|
||||
{
|
||||
|
||||
private static final GroupServiceConvert INSTANCE = new GroupServiceConvert();
|
||||
|
||||
private GroupServiceConvert() {
|
||||
super(Group.class, GroupDTO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model 转 DTO
|
||||
*/
|
||||
public static GroupDTO toDTO(Group model)
|
||||
public static GroupDTO from(Group model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
GroupDTO dto = new GroupDTO();
|
||||
BeanUtils.copyProperties(model, dto);
|
||||
return dto;
|
||||
return INSTANCE.innerFrom(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO 转 Model
|
||||
*/
|
||||
public static Group toModel(GroupDTO dto)
|
||||
public static Group to(GroupDTO dto)
|
||||
{
|
||||
if (dto == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Group model = new Group();
|
||||
BeanUtils.copyProperties(dto, model);
|
||||
return model;
|
||||
return INSTANCE.innerTo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model List 转 DTO List
|
||||
*/
|
||||
public static List<GroupDTO> toDTOList(List<Group> modelList)
|
||||
public static List<GroupDTO> fromList(List<Group> modelList)
|
||||
{
|
||||
if (modelList == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return modelList.stream().map(GroupServiceConvert::toDTO).collect(Collectors.toList());
|
||||
return INSTANCE.innerFromList(modelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO List 转 Model List
|
||||
*/
|
||||
public static List<Group> toList(List<GroupDTO> dtoList)
|
||||
{
|
||||
return INSTANCE.innerToList(dtoList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
package com.ruoyi.device.service.convert;
|
||||
|
||||
import com.ruoyi.common.core.utils.BaseConvert;
|
||||
import com.ruoyi.device.domain.model.Payload;
|
||||
import com.ruoyi.device.service.dto.PayloadDTO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 挂载Service层转换器
|
||||
|
|
@ -14,45 +13,45 @@ import java.util.stream.Collectors;
|
|||
* @author ruoyi
|
||||
* @date 2026-01-16
|
||||
*/
|
||||
public class PayloadServiceConvert
|
||||
public class PayloadServiceConvert extends BaseConvert<Payload, PayloadDTO>
|
||||
{
|
||||
|
||||
private static final PayloadServiceConvert INSTANCE = new PayloadServiceConvert();
|
||||
|
||||
private PayloadServiceConvert() {
|
||||
super(Payload.class, PayloadDTO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model 转 DTO
|
||||
*/
|
||||
public static PayloadDTO toDTO(Payload model)
|
||||
public static PayloadDTO from(Payload model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
PayloadDTO dto = new PayloadDTO();
|
||||
BeanUtils.copyProperties(model, dto);
|
||||
return dto;
|
||||
return INSTANCE.innerFrom(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO 转 Model
|
||||
*/
|
||||
public static Payload toModel(PayloadDTO dto)
|
||||
public static Payload to(PayloadDTO dto)
|
||||
{
|
||||
if (dto == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Payload model = new Payload();
|
||||
BeanUtils.copyProperties(dto, model);
|
||||
return model;
|
||||
return INSTANCE.innerTo(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model List 转 DTO List
|
||||
*/
|
||||
public static List<PayloadDTO> toDTOList(List<Payload> modelList)
|
||||
public static List<PayloadDTO> fromList(List<Payload> modelList)
|
||||
{
|
||||
if (modelList == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return modelList.stream().map(PayloadServiceConvert::toDTO).collect(Collectors.toList());
|
||||
return INSTANCE.innerFromList(modelList);
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO List 转 Model List
|
||||
*/
|
||||
public static List<Payload> toList(List<PayloadDTO> dtoList)
|
||||
{
|
||||
return INSTANCE.innerToList(dtoList);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue