diff --git a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs index 7a793df3e..a0227ad61 100644 --- a/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ReadingCriterion/ReadingQuestionService.cs @@ -966,7 +966,8 @@ namespace IRaCIS.Core.Application.Service { question.GroupId = copyNewQuestionList.Where(y => x.GroupId == y.OriginalId).Select(y => y.Id).FirstOrDefault(); } - needAddDatas.Add(question); + + needAddDatas.Add(question); }; await _readingQuestionSystemRepository.BatchDeleteNoTrackingAsync(x => x.ReadingQuestionCriterionSystemId == inDto.NewSystemCriterionId); @@ -975,15 +976,24 @@ namespace IRaCIS.Core.Application.Service #region 表格问题 var newSystemTableQuestionList = await _readingTableQuestionSystemRepository.Where(x => x.SystemCriterionId == inDto.SourceSystemCriterionId) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); + + + foreach (var question in newSystemTableQuestionList) + { + question.SystemCriterionId = inDto.NewSystemCriterionId; + question.Id = NewId.NextGuid(); + } + var copeNewSystemTableQuestionList = newSystemTableQuestionList.Clone(); + + var needAddTableDatas = new List(); foreach (var x in newSystemTableQuestionList) { var tableQuestion = x.Clone(); - tableQuestion.SystemCriterionId = inDto.NewSystemCriterionId; - tableQuestion.Id = NewId.NextGuid(); + tableQuestion.ReadingQuestionId = copyNewQuestionList.Where(y => x.ReadingQuestionId == y.OriginalId).Select(y => y.Id).FirstOrDefault(); - if (tableQuestion.ParentId != null) + if (tableQuestion.ParentId != null) { tableQuestion.ParentId = copeNewSystemTableQuestionList.Where(y => x.ParentId == y.OriginalId).Select(y => y.Id).FirstOrDefault(); }