You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
6.3 KiB
C#

using Mapster;
using Myshipping.Application.Entity;
using StackExchange.Profiling.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
public class ParaDtoMapper : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.ForType<ParaGoodsInfo, ParaGoodsDto>()
.Map(dest => dest.Id, src => src.Id)
.Map(dest => dest.GoodsCode, src => src.GOODS_CODE)
.Map(dest => dest.GoodsNameCN, src => src.GOODS_NAME_CN)
.Map(dest => dest.GoodsNameEN, src => src.GOODS_NAME_EN)
.Map(dest => dest.GoodsDesp, src => src.GOODS_DESP)
.Map(dest => dest.GoodsCategory, src => src.GOODS_CATEGORY)
.Map(dest => dest.GoodsCategoryName, src => src.GOODS_CATEGORY_NAME);
config.ForType<ParaGoodsInfo, ParaGoodsShowDto>()
.Map(dest => dest.Id, src => src.Id)
.Map(dest => dest.GoodsCode, src => src.GOODS_CODE)
.Map(dest => dest.GoodsNameCN, src => src.GOODS_NAME_CN)
.Map(dest => dest.GoodsNameEN, src => src.GOODS_NAME_EN)
.Map(dest => dest.GoodsDesp, src => src.GOODS_DESP)
.Map(dest => dest.GoodsCategory, src => src.GOODS_CATEGORY)
.Map(dest => dest.GoodsCategoryName, src => src.GOODS_CATEGORY_NAME)
.Map(dest => dest.CreateUserId, src => src.CreatedUserId)
.Map(dest => dest.CreateUserName, src => src.CreatedUserName)
.Map(dest => dest.CreateTime, src => src.CreatedTime)
.Map(dest => dest.UpdateUserId, src => src.UpdatedUserId)
.Map(dest => dest.UpdateUserName, src => src.UpdatedUserName)
.Map(dest => dest.UpdateTime, src => src.UpdatedTime.HasValue ? src.UpdatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "");
config.ForType<ParaGoodsDto, ParaGoodsInfo>()
.Map(dest => dest.Id, src => !string.IsNullOrWhiteSpace(src.Id) ? long.Parse(src.Id) : 0)
.Map(dest => dest.GOODS_CODE, src => src.GoodsCode)
.Map(dest => dest.GOODS_NAME_CN, src => src.GoodsNameCN)
.Map(dest => dest.GOODS_NAME_EN, src => src.GoodsNameEN)
.Map(dest => dest.GOODS_DESP, src => src.GoodsDesp)
.Map(dest => dest.GOODS_CATEGORY, src => src.GoodsCategory)
.Map(dest => dest.GOODS_CATEGORY_NAME, src => src.GoodsCategoryName);
config.ForType<ParaGoodsCategoryInfo, ParaGoodsCategoryDto>()
.Map(dest => dest.Id, src => src.Id)
.Map(dest => dest.GoodsCategory, src => src.GOODS_CATEGORY)
.Map(dest => dest.GoodsCategoryName, src => src.GOODS_CATEGORY_NAME);
config.ForType<ParaGoodsCategoryInfo, ParaGoodsCategoryShowDto>()
.Map(dest => dest.Id, src => src.Id)
.Map(dest => dest.GoodsCategory, src => src.GOODS_CATEGORY)
.Map(dest => dest.GoodsCategoryName, src => src.GOODS_CATEGORY_NAME)
.Map(dest => dest.CreateUserId, src => src.CreatedUserId)
.Map(dest => dest.CreateUserName, src => src.CreatedUserName)
.Map(dest => dest.CreateTime, src => src.CreatedTime)
.Map(dest => dest.UpdateUserId, src => src.UpdatedUserId)
.Map(dest => dest.UpdateUserName, src => src.UpdatedUserName)
.Map(dest => dest.UpdateTime, src => src.UpdatedTime.HasValue ? src.UpdatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "");
config.ForType<ParaGoodsCategoryDto, ParaGoodsCategoryInfo>()
.Map(dest => dest.Id, src => !string.IsNullOrWhiteSpace(src.Id) ? long.Parse(src.Id) : 0)
.Map(dest => dest.GOODS_CATEGORY, src => src.GoodsCategory)
.Map(dest => dest.GOODS_CATEGORY_NAME, src => src.GoodsCategoryName);
config.ForType<ParaContractNoInfo, ParaContractNoDto>()
.Map(dest => dest.Id, src => src.Id)
.Map(dest => dest.ContractNo, src => src.CONTRACT_NO)
.Map(dest => dest.ContractName, src => src.CONTRACT_NAME)
.Map(dest => dest.ContractNote, src => src.CONTRACT_NOTE)
.Map(dest => dest.LaneCode, src => src.LANE_CODE)
.Map(dest => dest.LaneCName, src => src.LANE_CNAME)
.Map(dest => dest.PODCode, src => src.POD_CODE)
.Map(dest => dest.CarrierCode, src => src.CARRIER_CODE);
config.ForType<ParaContractNoInfo, ParaContractNoShowDto>()
.Map(dest => dest.Id, src => src.Id)
.Map(dest => dest.ContractNo, src => src.CONTRACT_NO)
.Map(dest => dest.ContractName, src => src.CONTRACT_NAME)
.Map(dest => dest.ContractNote, src => src.CONTRACT_NOTE)
.Map(dest => dest.CreateUserId, src => src.CreatedUserId)
.Map(dest => dest.CreateUserName, src => src.CreatedUserName)
.Map(dest => dest.CreateTime, src => src.CreatedTime)
.Map(dest => dest.UpdateUserId, src => src.UpdatedUserId)
.Map(dest => dest.UpdateUserName, src => src.UpdatedUserName)
.Map(dest => dest.UpdateTime, src => src.UpdatedTime.HasValue ? src.UpdatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
.Map(dest => dest.LaneCode, src => src.LANE_CODE)
.Map(dest => dest.LaneCName, src => src.LANE_CNAME)
.Map(dest => dest.PODCode, src => src.POD_CODE)
.Map(dest => dest.CarrierCode, src => src.CARRIER_CODE);
config.ForType<ParaContractNoDto, ParaContractNoInfo>()
.Map(dest => dest.Id, src => !string.IsNullOrWhiteSpace(src.Id) ? long.Parse(src.Id) : 0)
.Map(dest => dest.CONTRACT_NO, src => src.ContractNo)
.Map(dest => dest.CONTRACT_NAME, src => src.ContractName)
.Map(dest => dest.CONTRACT_NOTE, src => src.ContractNote)
.Map(dest => dest.LANE_CODE, src => src.LaneCode)
.Map(dest => dest.LANE_CNAME, src => src.LaneCName)
.Map(dest => dest.POD_CODE, src => src.PODCode)
.Map(dest => dest.CARRIER_CODE, src => src.CarrierCode);
}
}
}