From afad336bb9983ac5a6622bd7d6deb628225731d4 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Wed, 16 Nov 2022 10:48:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reading/Dto/ReadingQuestionViewModel.cs | 10 ++++ .../ReadingQuestionService.cs | 47 +++++++++---------- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs index 9853a4d67..d81b466f0 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs @@ -1052,6 +1052,16 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public Guid QuestionId { get; set; } public string QuestionName{ get; set; } + + public List TableQuestions { get; set; } + } + + + public class CalculateQuestion + { + public Guid QuestionId { get; set; } + + public string QuestionName { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs index 83f484e03..46d2bf7ef 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs @@ -76,7 +76,7 @@ namespace IRaCIS.Application.Services #region 获取计算问题 /// - /// 获取数值问题 + /// 获取问题 /// /// /// @@ -95,12 +95,30 @@ namespace IRaCIS.Application.Services }).ToListAsync(); + var tablequestion = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == inDto.TrialCriterionId && x.Type == "number").Select(x => + new + { + QuestionId= x.Id, + x.ReadingQuestionId, + x.QuestionName + }).ToListAsync(); + result.ForEach(x => + { + x.TableQuestions = tablequestion.Where(y => x.QuestionId == y.ReadingQuestionId).Select(y => new CalculateQuestion() + { + + QuestionId = y.QuestionId, + QuestionName = y.QuestionName + + }).ToList(); + }); + return result; } /// - /// 获取表格数值问题 + /// 获取表格问题 /// /// /// @@ -125,30 +143,7 @@ namespace IRaCIS.Application.Services } - /// - /// 获取标准所有表格数值问题 - /// - /// - /// - [HttpPost] - public async Task> GetCalculateAllTableQuestions(GetCalculateQuestionsInDto inDto) - { - - var result = await _readingTableQuestionTrialRepository - - .Where(x => x.TrialCriterionId == inDto.TrialCriterionId) - .WhereIf(!inDto.Type.IsNullOrEmpty(), x => x.Type == inDto.Type) - .OrderBy(x => x.ShowOrder) - .Select(x => new GetCalculateTableQuestionsOutDto - () - { - TableQuestionId = x.Id, - TableQuestionName = x.QuestionName - - }).ToListAsync(); - - return result; - } + #endregion