From fb6c236b71a648cb589057c9ce882db329995498 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Tue, 14 Jun 2022 10:39:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reading/Dto/ReadingQuestionViewModel.cs | 2 +- .../Service/Reading/ReadingQuestionService.cs | 37 ++++++++++++++++++- .../Reading/ReadingQuestionCriterionSystem.cs | 2 +- .../Reading/ReadingQuestionSystem.cs | 4 ++ 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs index 983cbee90..900a32a0f 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/ReadingQuestionViewModel.cs @@ -64,7 +64,7 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto public class SetSystemReadingQuestionCriterionIsIsEnable { [NotDefault] - public Guid ReadingQuestionCriterionSystemId { get; set; } + public Guid Id { get; set; } [NotDefault] public bool IsEnable { get; set; } diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs index 16430be18..b6536edeb 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingQuestionService.cs @@ -89,7 +89,7 @@ namespace IRaCIS.Application.Services /// public async Task SetSystemReadingQuestionCriterionIsIsEnable(SetSystemReadingQuestionCriterionIsIsEnable inDto) { - await _readingQuestionCriterionSystemRepository.UpdatePartialFromQueryAsync(inDto.ReadingQuestionCriterionSystemId, x => new ReadingQuestionCriterionSystem() + await _readingQuestionCriterionSystemRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new ReadingQuestionCriterionSystem() { IsEnable = inDto.IsEnable }); @@ -200,7 +200,40 @@ namespace IRaCIS.Application.Services { var trialUsrSystemIds = _readingQuestionCriterionTrialRepository.Where(x => x.TrialId == trialId && x.ReadingQuestionCriterionSystemId != null) .Select(x => x.ReadingQuestionCriterionSystemId); - var needAddSystemDataList = await _readingQuestionCriterionSystemRepository.Where(x => !trialUsrSystemIds.Contains(x.Id)).ToListAsync(); + var needAddSystemDataList = await _readingQuestionCriterionSystemRepository.Where(x => !trialUsrSystemIds.Contains(x.Id)&&x.IsEnable).Include(x=>x.ReadingQuestionSystemList).ToListAsync(); + + List needAddCriterionList = new List(); + List needAddQuestionList = new List(); + + needAddSystemDataList.ForEach(x => + { + var criterion = new ReadingQuestionCriterionTrial() + { + CriterionName = x.CriterionName, + IsEnable = false, + ReadingQuestionCriterionSystemId = x.Id, + TrialId = trialId, + Id = NewId.NextGuid(), + }; + + List systemQuestionList = x.ReadingQuestionSystemList.Clone(); + + + + }); + + + + } + + /// + /// 递归处理父子问题关系 + /// + private async Task SetChildParentQuestion(Guid trialId, List systemQuesitonList,List needQuestionList) + { + var parentIdIsNullList = systemQuesitonList.Where(x => x.ParentId == null).ToList(); + + } diff --git a/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs b/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs index 52e3cf354..16b63aaf0 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingQuestionCriterionSystem.cs @@ -40,8 +40,8 @@ namespace IRaCIS.Core.Domain.Models /// public Guid CreateUserId { get; set; } - + public List ReadingQuestionSystemList { get; set; } = new List(); } diff --git a/IRaCIS.Core.Domain/Reading/ReadingQuestionSystem.cs b/IRaCIS.Core.Domain/Reading/ReadingQuestionSystem.cs index acb791c6e..1f5a65563 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingQuestionSystem.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingQuestionSystem.cs @@ -56,6 +56,7 @@ namespace IRaCIS.Core.Domain.Models /// public string TypeValue { get; set; } + public bool IsEnable { get; set; } /// @@ -68,6 +69,9 @@ namespace IRaCIS.Core.Domain.Models /// public Guid CreateUserId { get; set; } + [ForeignKey("ReadingQuestionCriterionSystemId")] + public ReadingQuestionCriterionSystem ReadingQuestionCriterionSystem { get; set; } + }