ExamResultService.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using Furion.DatabaseAccessor.Extensions;
  2. using YBEE.EQM.Core;
  3. namespace YBEE.EQM.Application;
  4. /// <summary>
  5. /// 反馈结果管理服务(各机构均适用)
  6. /// </summary>
  7. public class ExamResultService : IExamResultService, ITransient
  8. {
  9. private readonly IRepository<ExamResult> _rep;
  10. public ExamResultService(IRepository<ExamResult> rep)
  11. {
  12. _rep = rep;
  13. }
  14. /// <summary>
  15. /// 添加监测结果文件
  16. /// </summary>
  17. /// <param name="input"></param>
  18. /// <returns></returns>
  19. public async Task Add(AddExamResultInput input)
  20. {
  21. var item = input.Adapt<ExamResult>();
  22. await item.InsertAsync();
  23. }
  24. /// <summary>
  25. /// 根据发布内容ID获取文件列表
  26. /// </summary>
  27. /// <param name="publishId"></param>
  28. /// <returns></returns>
  29. public async Task<List<ExamResultOutput>> GetListByPublishId(int publishId)
  30. {
  31. var items = await _rep.DetachedEntities.Where(t => t.ExamDataPublishId == publishId).ProjectToType<ExamResultOutput>().ToListAsync();
  32. return items;
  33. }
  34. }