ExamScoreRangeService.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using YBEE.EQM.Core;
  2. namespace YBEE.EQM.Application;
  3. /// <summary>
  4. /// 分数段服务
  5. /// </summary>
  6. public class ExamScoreRangeService : IExamScoreRangeService, ITransient
  7. {
  8. private readonly IRepository<ExamScoreRange> _rep;
  9. private List<ExamScoreRangeOutput> _examScoreRanges;
  10. public ExamScoreRangeService(IRepository<ExamScoreRange> rep)
  11. {
  12. _rep = rep;
  13. }
  14. /// <summary>
  15. /// 获取分数段列表
  16. /// </summary>
  17. /// <param name="type"></param>
  18. /// <returns></returns>
  19. public async Task<List<ExamScoreRangeOutput>> GetList(ExamScoreRangeType? type = null)
  20. {
  21. _examScoreRanges ??= await _rep.DetachedEntities.ProjectToType<ExamScoreRangeOutput>().OrderBy(t => t.Sequence).ToListAsync();
  22. if (type.HasValue)
  23. {
  24. return _examScoreRanges.Where(t => t.Type == type.Value).ToList();
  25. }
  26. return _examScoreRanges;
  27. }
  28. public async Task GetExamScoreRangeIdByTypeScore(ExamScoreRangeType type, decimal score)
  29. {
  30. var items = await GetList(type);
  31. }
  32. }