12345678910111213141516171819202122232425262728293031323334353637 |
- using YBEE.EQM.Core;
- namespace YBEE.EQM.Application;
- /// <summary>
- /// 分数段服务
- /// </summary>
- public class ExamScoreRangeService : IExamScoreRangeService, ITransient
- {
- private readonly IRepository<ExamScoreRange> _rep;
- private List<ExamScoreRangeOutput> _examScoreRanges;
- public ExamScoreRangeService(IRepository<ExamScoreRange> rep)
- {
- _rep = rep;
- }
- /// <summary>
- /// 获取分数段列表
- /// </summary>
- /// <param name="type"></param>
- /// <returns></returns>
- public async Task<List<ExamScoreRangeOutput>> GetList(ExamScoreRangeType? type = null)
- {
- _examScoreRanges ??= await _rep.DetachedEntities.ProjectToType<ExamScoreRangeOutput>().OrderBy(t => t.Sequence).ToListAsync();
- if (type.HasValue)
- {
- return _examScoreRanges.Where(t => t.Type == type.Value).ToList();
- }
- return _examScoreRanges;
- }
- public async Task GetExamScoreRangeIdByTypeScore(ExamScoreRangeType type, decimal score)
- {
- var items = await GetList(type);
- }
- }
|