代码修改
continuous-integration/drone/push Build is passing Details

IRC_NewDev
he 2024-10-24 09:40:14 +08:00
parent 558258fd89
commit ad01628e48
5 changed files with 24 additions and 59 deletions

View File

@ -1571,13 +1571,10 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
public bool IsJudgeQuestion { get; set; }
}
public class GetCalculateQuestionsOutDto
public class GetCalculateQuestionsOutDto: ReadingQuestionSystemView
{
public Guid QuestionId { get; set; }
public string QuestionName { get; set; }
public List<CalculateQuestion> TableQuestions { get; set; }
public List<ReadingTableQuestionSystemView> TableQuestions { get; set; }
}

View File

@ -96,33 +96,7 @@ 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)
.Select(x => new GetCalculateQuestionsOutDto
()
{
QuestionId = x.Id,
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us)
}).ToListAsync();
var tablequestion = await _readingTableQuestionTrialRepository.Where(x => x.TrialCriterionId == inDto.TrialCriterionId && x.Type == "number").Select(x =>
new
{
QuestionId = x.Id,
x.ReadingQuestionId,
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us)
}).ToListAsync();
result.ForEach(x =>
{
x.TableQuestions = tablequestion.Where(y => x.QuestionId == y.ReadingQuestionId).Select(y => new CalculateQuestion()
{
QuestionId = y.QuestionId,
QuestionName = y.QuestionName
}).ToList();
});
.ProjectTo<GetCalculateQuestionsOutDto>(_mapper.ConfigurationProvider).ToListAsync();
return result;
}
@ -141,33 +115,7 @@ 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)
.Select(x => new GetCalculateQuestionsOutDto
()
{
QuestionId = x.Id,
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us)
}).ToListAsync();
var tablequestion = await _readingTableQuestionSystemRepository.Where(x => x.SystemCriterionId == inDto.SystemCriterionId && x.Type == "number").Select(x =>
new
{
QuestionId = x.Id,
x.ReadingQuestionId,
QuestionName = x.QuestionName.LanguageName(x.QuestionEnName, _userInfo.IsEn_Us)
}).ToListAsync();
result.ForEach(x =>
{
x.TableQuestions = tablequestion.Where(y => x.QuestionId == y.ReadingQuestionId).Select(y => new CalculateQuestion()
{
QuestionId = y.QuestionId,
QuestionName = y.QuestionName
}).ToList();
});
.ProjectTo<GetCalculateQuestionsOutDto>(_mapper.ConfigurationProvider).ToListAsync() ;
return result;
}

View File

@ -220,6 +220,18 @@ namespace IRaCIS.Core.Application.Service
.ForMember(d => d.DependShowOrder, u => u.MapFrom(s => s.DependParentQuestion.ShowOrder));
CreateMap<ReadingTableQuestionTrial, ReadingTableQuestionSystemView>()
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
.ForMember(d => d.DependShowOrder, u => u.MapFrom(s => s.DependParentQuestion.ShowOrder));
CreateMap<ReadingQuestionTrial, GetCalculateQuestionsOutDto>()
.ForMember(d => d.TableQuestions, u => u.MapFrom(s => s.ReadingTableQuestionTrialList));
CreateMap<ReadingQuestionSystem, GetCalculateQuestionsOutDto>()
.ForMember(d => d.TableQuestions, u => u.MapFrom(s => s.ReadingTableQuestionTrialList));
CreateMap<ReadingTableQuestionTrial, ReadingTableQuestionTrialView>()
.ForMember(dest => dest.CreateUser, opt => opt.Ignore())
.ForMember(d => d.DependShowOrder, u => u.MapFrom(s => s.DependParentQuestion.ShowOrder))

View File

@ -15,6 +15,9 @@ public class ReadingQuestionSystem : BaseAddAuditEntity
[ForeignKey("ReadingQuestionCriterionSystemId")]
public ReadingQuestionCriterionSystem ReadingQuestionCriterionSystem { get; set; }
[JsonIgnore]
public List<ReadingTableQuestionSystem> ReadingTableQuestionTrialList { get; set; }
[JsonIgnore]
[ForeignKey("ParentId")]
public ReadingQuestionSystem ParentReadingQuestionSystem { get; set; }

View File

@ -12,6 +12,11 @@ public class ReadingTableQuestionSystem : BaseAddAuditEntity
[JsonIgnore]
public ReadingTableQuestionSystem DependParentQuestion { get; set; }
[JsonIgnore]
[ForeignKey("ReadingQuestionId")]
public ReadingQuestionSystem ReadingQuestionSystem { get; set; }
[NotMapped]
public List<string> ParentTriggerValueList
{