namespace PBS.BLL.WE
|
{
|
/// <summary>
|
/// 用水当量项
|
///</summary>
|
public partial class Item
|
{
|
|
//dto to vmo
|
internal static Vmo.WE.ItemVmo Dto2Vmo(Dto.WE.ItemDto dto)
|
{
|
if (dto == null)
|
{
|
return default;
|
}
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Dto.WE.ItemDto, Vmo.WE.ItemVmo>()
|
).CreateMapper();
|
var vmo = mapper.Map<Dto.WE.ItemDto, Vmo.WE.ItemVmo>(dto);
|
return vmo;
|
}
|
|
//dto to vmos
|
internal static List<Vmo.WE.ItemVmo> Dto2Vmos(List<Dto.WE.ItemDto> dtos)
|
{
|
if (dtos == null || dtos.Count < 1)
|
{
|
return default;
|
}
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Dto.WE.ItemDto, Vmo.WE.ItemVmo>()
|
).CreateMapper();
|
var vmos = mapper.Map<List<Dto.WE.ItemDto>, List<Vmo.WE.ItemVmo>>(dtos);
|
return vmos;
|
}
|
|
//vmo to add dto
|
internal static Dto.WE.AddItemInput Vmo2AddDto(Vmo.WE.ItemVmo vmo)
|
{
|
if (vmo == null)
|
{
|
return default;
|
}
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.WE.ItemVmo, Dto.WE.AddItemInput>()
|
).CreateMapper();
|
var dto = mapper.Map<Vmo.WE.ItemVmo, Dto.WE.AddItemInput>(vmo);
|
return dto;
|
}
|
|
//vmo to add dtos
|
internal static List<Dto.WE.AddItemInput> Vmo2AddDtos(List<Vmo.WE.ItemVmo> vmoList)
|
{
|
if (vmoList == null || vmoList.Count < 1)
|
{
|
return default;
|
}
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.WE.ItemVmo, Dto.WE.AddItemInput>()
|
).CreateMapper();
|
var dtoList = mapper.Map<List<Vmo.WE.ItemVmo>, List<Dto.WE.AddItemInput>>(vmoList);
|
return dtoList;
|
}
|
|
//vmo to update dto
|
internal static Dto.WE.UpdateItemInput Vmo2UpdateDto(Vmo.WE.ItemVmo vmo)
|
{
|
if (vmo == null)
|
{
|
return default;
|
}
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.WE.ItemVmo, Dto.WE.UpdateItemInput>()
|
).CreateMapper();
|
var dto = mapper.Map<Vmo.WE.ItemVmo, Dto.WE.UpdateItemInput>(vmo);
|
return dto;
|
}
|
|
//vmo to update dtos
|
internal static List<Dto.WE.UpdateItemInput> Vmo2UpdateDtos(List<Vmo.WE.ItemVmo> vmoList)
|
{
|
if (vmoList == null || vmoList.Count < 1)
|
{
|
return default;
|
}
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.WE.ItemVmo, Dto.WE.UpdateItemInput>()
|
).CreateMapper();
|
var dtoList = mapper.Map<List<Vmo.WE.ItemVmo>, List<Dto.WE.UpdateItemInput>>(vmoList);
|
return dtoList;
|
}
|
|
}
|
}
|