修改一版

Uat_Study
he 2022-06-14 10:39:34 +08:00
parent 8a459af6c6
commit fb6c236b71
4 changed files with 41 additions and 4 deletions

View File

@ -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; }

View File

@ -89,7 +89,7 @@ namespace IRaCIS.Application.Services
/// <returns></returns>
public async Task<IResponseOutput> 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<ReadingQuestionCriterionTrial> needAddCriterionList = new List<ReadingQuestionCriterionTrial>();
List<ReadingQuestionTrial> needAddQuestionList = new List<ReadingQuestionTrial>();
needAddSystemDataList.ForEach(x =>
{
var criterion = new ReadingQuestionCriterionTrial()
{
CriterionName = x.CriterionName,
IsEnable = false,
ReadingQuestionCriterionSystemId = x.Id,
TrialId = trialId,
Id = NewId.NextGuid(),
};
List<ReadingQuestionSystem> systemQuestionList = x.ReadingQuestionSystemList.Clone();
});
}
/// <summary>
/// 递归处理父子问题关系
/// </summary>
private async Task SetChildParentQuestion(Guid trialId, List<ReadingQuestionSystem> systemQuesitonList,List<ReadingQuestionTrial> needQuestionList)
{
var parentIdIsNullList = systemQuesitonList.Where(x => x.ParentId == null).ToList();
}

View File

@ -41,7 +41,7 @@ namespace IRaCIS.Core.Domain.Models
public Guid CreateUserId { get; set; }
public List<ReadingQuestionSystem> ReadingQuestionSystemList { get; set; } = new List<ReadingQuestionSystem>();
}

View File

@ -56,6 +56,7 @@ namespace IRaCIS.Core.Domain.Models
/// </summary>
public string TypeValue { get; set; }
public bool IsEnable { get; set; }
/// <summary>
@ -68,6 +69,9 @@ namespace IRaCIS.Core.Domain.Models
/// </summary>
public Guid CreateUserId { get; set; }
[ForeignKey("ReadingQuestionCriterionSystemId")]
public ReadingQuestionCriterionSystem ReadingQuestionCriterionSystem { get; set; }
}