SnapshotMapperConfigs.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using Hotline.Orders;
  2. using Hotline.Share.Dtos.Snapshot;
  3. using Hotline.Snapshot;
  4. using Mapster;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace Hotline.Application.Mappers;
  11. public class SnapshotMapperConfigs : IRegister
  12. {
  13. public void Register(TypeAdapterConfig config)
  14. {
  15. config.ForType<AddIndustryDto, Industry>();
  16. config.ForType<Hotline.File.File, IndustryFileDto>()
  17. .Map(m => m.AdditionId, n => n.Additions);
  18. config.ForType<IndustryFileDto, Hotline.File.File>()
  19. .Map(m => m.Additions, n => n.AdditionId);
  20. config.ForType<AddSnapshotOrderInDto, Order>()
  21. .Map(m => m.Contact, n => n.PhoneNumber)
  22. .Map(m => m.FromName, n => n.Name)
  23. .Map(m => m.FromPhone, n => n.PhoneNumber);
  24. config.ForType<SnapshotOrderPublish, OrderPublishDetailOutDto>()
  25. .Map(m => m.Title, n => n.ArrangeTitle)
  26. .Map(m => m.Content, n => n.ArrangeContent)
  27. .Map(m => m.Opinion, n => n.ArrangeOpinion);
  28. config.ForType<Order, OrderPublishDetailOutDto>()
  29. .Map(m => m.Opinion, n => n.ActualOpinion);
  30. }
  31. }