AttachmentMapper.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132
  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. config.ForType<ResourceFileOutput, AddAttachmentInput>().Map(d => d.SourceId, s => (int)s.SourceId)
  20. .Map(d => d.FileId, s => s.Id)
  21. .Map(d => d.ThumbFileId, s => s.ThumbResourceFile.Id)
  22. ;
  23. config.ForType<ResourceFileOutput, AddExamOrgDataReportAttachmentInput>().Map(d => d.SourceId, s => (int)s.SourceId)
  24. .Map(d => d.FileId, s => s.Id)
  25. .Map(d => d.ThumbFileId, s => s.ThumbResourceFile.Id)
  26. ;
  27. }
  28. }