AttachmentMapper.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using Furion.JsonSerialization;
  2. using YBEE.EQM.Core;
  3. namespace YBEE.EQM.Application;
  4. /// <summary>
  5. /// 附件信息转换
  6. /// </summary>
  7. public class AttachmentMapper : IRegister
  8. {
  9. public void Register(TypeAdapterConfig config)
  10. {
  11. // 机构数据项上报附件
  12. config.ForType<ExamOrgDataReport, ExamOrgDataReportOutput>().Map(d => d.AttachmentList, s => JSON.Deserialize<List<AttachmentItem>>(s.Attachments, null));
  13. // 特殊学生明细附件
  14. config.ForType<ExamSpecialStudent, ExamSpecialStudentOutput>().Map(d => d.AttachmentList, s => JSON.Deserialize<List<AttachmentItem>>(s.Attachments, null));
  15. // 缺测替补明细附件
  16. config.ForType<ExamAbsentReplace, ExamAbsentReplaceOutput>().Map(d => d.AttachmentList, s => JSON.Deserialize<List<AttachmentItem>>(s.Attachments, null));
  17. // 监测数据上报类型附件
  18. config.ForType<ExamDataReport, ExamDataReportOutput>().Map(d => d.AttachmentList, s => JSON.Deserialize<List<AttachmentItem>>(s.Attachments, null));
  19. // 监测结果发布类型附件
  20. config.ForType<ExamDataPublish, ExamDataPublishOutput>().Map(d => d.AttachmentList, s => JSON.Deserialize<List<AttachmentItem>>(s.Attachments, null));
  21. config.ForType<ExamDataPublish, ExamDataPublishOrgResultOutput>().Map(d => d.AttachmentList, s => JSON.Deserialize<List<AttachmentItem>>(s.Attachments, null));
  22. config.ForType<ResourceFileOutput, AddAttachmentInput>().Map(d => d.SourceId, s => (int)s.SourceId)
  23. .Map(d => d.FileId, s => s.Id)
  24. .Map(d => d.ThumbFileId, s => s.ThumbResourceFile.Id)
  25. ;
  26. config.ForType<ResourceFileOutput, AddExamOrgDataReportAttachmentInput>().Map(d => d.SourceId, s => (int)s.SourceId)
  27. .Map(d => d.FileId, s => s.Id)
  28. .Map(d => d.ThumbFileId, s => s.ThumbResourceFile.Id)
  29. ;
  30. }
  31. }