_MapConfig.cs 680 B

123456789101112131415161718192021222324
  1. using ZhonTai.Admin.Services.Employee.Output;
  2. using System.Linq;
  3. using Mapster;
  4. using ZhonTai.Admin.Domain.Employee;
  5. namespace ZhonTai.Admin.Services.Employee
  6. {
  7. /// <summary>
  8. /// 映射配置
  9. /// </summary>
  10. public class MapConfig : IRegister
  11. {
  12. public void Register(TypeAdapterConfig config)
  13. {
  14. config
  15. .NewConfig<EmployeeEntity, EmployeeGetOutput>()
  16. .Map(dest => dest.OrganizationIds, src => src.Orgs.Select(a => a.Id));
  17. config
  18. .NewConfig<EmployeeEntity, EmployeeListOutput>()
  19. .Map(dest => dest.OrganizationNames, src => src.Orgs.Select(a => a.Name));
  20. }
  21. }
  22. }