From a7cfc1714afdedfbfe39bf89ad3f98a01493da7a Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Thu, 24 Oct 2024 10:22:51 +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 | 9 ++++++- .../ReadingQuestionService.cs | 25 ++++++++++++++++--- .../Service/Reading/_MapConfig.cs | 6 ++--- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs index ee2c417d2..63d4b8d5f 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs @@ -1574,7 +1574,14 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public class GetCalculateQuestionsOutDto: ReadingQuestionSystemView { - public List TableQuestions { get; set; } + public List TableQuestions { get; set; } + } + + + public class GetSystemCalculateQuestionsOutDto : ReadingQuestionSystemView + { + + public List TableQuestions { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs index e67a39f2e..63d36a437 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs @@ -88,7 +88,7 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - public async Task> GetCalculateQuestions(GetCalculateQuestionsInDto inDto) + public async Task<(List,bool)> GetCalculateQuestions(GetCalculateQuestionsInDto inDto) { var result = await _readingQuestionTrialRepository @@ -98,7 +98,15 @@ namespace IRaCIS.Core.Application.Service .OrderBy(x => x.ShowOrder) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); - return result; + + var tablequestion=await _readingTableQuestionTrialRepository.Where(x=>x.TrialCriterionId==inDto.TrialCriterionId).ToListAsync(); + + result.ForEach(x => + { + x.TableQuestions = tablequestion.Where(y => y.ReadingQuestionId == x.Id).ToList(); + }); + + return (result,true); } /// @@ -107,7 +115,7 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - public async Task> GetSystemCalculateQuestions(GetSystemCalculateQuestionsInDto inDto) + public async Task> GetSystemCalculateQuestions(GetSystemCalculateQuestionsInDto inDto) { var result = await _readingQuestionSystemRepository @@ -115,7 +123,16 @@ namespace IRaCIS.Core.Application.Service .WhereIf(!inDto.Type.IsNullOrEmpty(), x => x.Type == inDto.Type) .WhereIf(inDto.TypeList.Count() > 0, x => inDto.TypeList.Contains(x.Type)) .OrderBy(x => x.ShowOrder) - .ProjectTo(_mapper.ConfigurationProvider).ToListAsync() ; + .ProjectTo(_mapper.ConfigurationProvider).ToListAsync() ; + + + var tablequestion = await _readingTableQuestionSystemRepository.Where(x => x.SystemCriterionId == inDto.SystemCriterionId).ToListAsync(); + + result.ForEach(x => + { + + x.TableQuestions = tablequestion.Where(y => y.ReadingQuestionId == x.Id).ToList(); + }); return result; } diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs index 3f47c883b..3a55897d4 100644 --- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs @@ -225,12 +225,10 @@ namespace IRaCIS.Core.Application.Service .ForMember(dest => dest.CreateUser, opt => opt.Ignore()) .ForMember(d => d.DependShowOrder, u => u.MapFrom(s => s.DependParentQuestion.ShowOrder)); - CreateMap() - .ForMember(d => d.TableQuestions, u => u.MapFrom(s => s.ReadingTableQuestionTrialList)); + CreateMap(); - CreateMap() - .ForMember(d => d.TableQuestions, u => u.MapFrom(s => s.ReadingTableQuestionTrialList)); + CreateMap(); CreateMap() .ForMember(dest => dest.CreateUser, opt => opt.Ignore())