90 lines
2.8 KiB
Java
90 lines
2.8 KiB
Java
|
|
package com.ruoyi.airline.domain.convert;
|
||
|
|
|
||
|
|
|
||
|
|
import com.ruoyi.airline.domain.model.AirlineFileGroup;
|
||
|
|
import com.ruoyi.airline.mapper.entity.AirlineFileGroupEntity;
|
||
|
|
|
||
|
|
import java.util.List;
|
||
|
|
import java.util.stream.Collectors;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 航线文件分组Domain转换类
|
||
|
|
* 用于Domain模型和Mapper实体之间的转换
|
||
|
|
*
|
||
|
|
* @author ruoyi
|
||
|
|
* @date 2026-01-17
|
||
|
|
*/
|
||
|
|
public class AirlineFileGroupDomainConvert {
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 将Domain模型转换为Mapper实体
|
||
|
|
*
|
||
|
|
* @param model Domain模型
|
||
|
|
* @return Mapper实体
|
||
|
|
*/
|
||
|
|
public static AirlineFileGroupEntity toEntity(AirlineFileGroup model) {
|
||
|
|
if (model == null) {
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
AirlineFileGroupEntity entity = new AirlineFileGroupEntity();
|
||
|
|
entity.setGroupId(model.getGroupId());
|
||
|
|
entity.setGroupName(model.getGroupName());
|
||
|
|
entity.setUserId(model.getUserId());
|
||
|
|
entity.setCreateBy(model.getCreateBy());
|
||
|
|
entity.setUpdateBy(model.getUpdateBy());
|
||
|
|
entity.setRemark(model.getRemark());
|
||
|
|
return entity;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 将Mapper实体转换为Domain模型
|
||
|
|
*
|
||
|
|
* @param entity Mapper实体
|
||
|
|
* @return Domain模型
|
||
|
|
*/
|
||
|
|
public static AirlineFileGroup toModel(AirlineFileGroupEntity entity) {
|
||
|
|
if (entity == null) {
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
AirlineFileGroup model = new AirlineFileGroup();
|
||
|
|
model.setGroupId(entity.getGroupId());
|
||
|
|
model.setGroupName(entity.getGroupName());
|
||
|
|
model.setUserId(entity.getUserId());
|
||
|
|
model.setCreateBy(entity.getCreateBy());
|
||
|
|
model.setCreateTime(entity.getCreateTime() != null ? entity.getCreateTime(): null);
|
||
|
|
model.setUpdateBy(entity.getUpdateBy());
|
||
|
|
model.setUpdateTime(entity.getUpdateTime() != null ? entity.getUpdateTime(): null);
|
||
|
|
model.setRemark(entity.getRemark());
|
||
|
|
return model;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 将Mapper实体列表转换为Domain模型列表
|
||
|
|
*
|
||
|
|
* @param entityList Mapper实体列表
|
||
|
|
* @return Domain模型列表
|
||
|
|
*/
|
||
|
|
public static List<AirlineFileGroup> toModelList(List<AirlineFileGroupEntity> entityList) {
|
||
|
|
if (entityList == null || entityList.isEmpty()) {
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
return entityList.stream()
|
||
|
|
.map(AirlineFileGroupDomainConvert::toModel)
|
||
|
|
.collect(Collectors.toList());
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 将Domain模型列表转换为Mapper实体列表
|
||
|
|
*
|
||
|
|
* @param modelList Domain模型列表
|
||
|
|
* @return Mapper实体列表
|
||
|
|
*/
|
||
|
|
public static List<AirlineFileGroupEntity> toEntityList(List<AirlineFileGroup> modelList) {
|
||
|
|
if (modelList == null || modelList.isEmpty()) {
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
return modelList.stream()
|
||
|
|
.map(AirlineFileGroupDomainConvert::toEntity)
|
||
|
|
.collect(Collectors.toList());
|
||
|
|
}
|
||
|
|
}
|