41 lines
1.6 KiB
C#
Raw Normal View History

2025-01-13 21:06:59 +08:00
using AutoMapper;
2025-01-21 16:01:50 +08:00
using VOL.Entity.DomainModels.XinWei;
using YD_XinWei.Commons.Dto.Open;
2025-01-13 21:06:59 +08:00
namespace YD_XinWei.Api.AutoMappers
{
public class MappingProfile : Profile
{
public MappingProfile()
{
// 建立对象之间的映射规则
// 如果有需要,您可以定义其他的映射规则
// CreateMap<SourceClass2, DestinationClass2>();
// ...
2025-01-14 16:11:31 +08:00
//CreateMap<AddHomeWorkDto, S_HomeWork>();
2025-01-21 16:01:50 +08:00
CreateMap<XW_Device, DeviceInfoDto>();
2025-02-07 22:22:24 +08:00
CreateMap<AddTrainDto, XW_SportsTestData>();
CreateMap<TrainStudentsDto, XW_TrainStudents>();
2025-02-25 15:33:02 +08:00
CreateMap<TrainSettingDto, XW_TrainSetting>();
CreateMap<TrainViolationsBODto, XW_TrainViolationsBO>();
2025-02-28 17:29:04 +08:00
CreateMap<XW_SportsTestData, TrainDto>();
2026-10-13 14:07:26 +08:00
CreateMap<XW_SunshineRunTrain, TrainDto>(MemberList.None)
.ForMember(destination => destination.OrgId, options => options.MapFrom(source => ParseNullableInt(source.OrgId)))
.ForMember(destination => destination.GradeId, options => options.MapFrom(source => ParseNullableInt(source.GradeId)))
.ForMember(destination => destination.ClassId, options => options.MapFrom(source => ParseNullableInt(source.ClassId)));
2025-02-28 17:29:04 +08:00
CreateMap<XW_TrainStudents, TrainStudentsDto>();
2026-01-07 14:35:06 +08:00
2025-02-28 17:29:04 +08:00
CreateMap<XW_TrainSetting, TrainSettingDto>();
CreateMap<XW_TrainViolationsBO, TrainViolationsBODto>();
2025-01-13 21:06:59 +08:00
}
2026-10-13 14:07:26 +08:00
private static int? ParseNullableInt(string? value)
{
return int.TryParse(value, out var result) ? result : null;
}
2025-01-13 21:06:59 +08:00
}
}