Uat_Study
he 2023-02-03 15:31:24 +08:00
parent bed17af3b2
commit c984a9116b
2 changed files with 8 additions and 2 deletions

View File

@ -97,6 +97,7 @@ namespace IRaCIS.Application.Contracts
} }
public class GetCriterionDictionaryListOutDto public class GetCriterionDictionaryListOutDto
{ {
public Guid Id { get; set; }
public string Code { get; set; } = string.Empty; public string Code { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty; public string Description { get; set; } = string.Empty;

View File

@ -238,16 +238,21 @@ namespace IRaCIS.Application.Services
/// <returns></returns> /// <returns></returns>
public async Task<List<GetCriterionDictionaryListOutDto>> GetCriterionDictionaryList(GetCriterionDictionaryListInDto inDto) public async Task<List<GetCriterionDictionaryListOutDto>> GetCriterionDictionaryList(GetCriterionDictionaryListInDto inDto)
{ {
var codes = await _systemCriterionDictionaryCodeRepository.Where(x => x.SystemCriterionId == inDto.SystemCriterionId).Select(x => x.Code).ToListAsync(); var criterionCodes= await _systemCriterionDictionaryCodeRepository.Where(x => x.SystemCriterionId == inDto.SystemCriterionId).ToListAsync();
var codes = criterionCodes.Select(x=>x.Code).ToList();
var dictionaryList = await _dicRepository.Where(x => codes.Contains(x.Code)) var dictionaryList = await _dicRepository.Where(x => codes.Contains(x.Code))
.OrderBy(x => x.ShowOrder).Select(x => new GetCriterionDictionaryListOutDto() .OrderBy(x => x.ShowOrder).Select(x => new GetCriterionDictionaryListOutDto()
{ {
Code = x.Code, Code = x.Code,
Description = x.Description Description = x.Description
}).ToListAsync(); }).ToListAsync();
dictionaryList.ForEach(x => {
x.Id = criterionCodes.Where(y => y.Code == x.Code).Select(x => x.Id).FirstOrDefault();
});
return dictionaryList; return dictionaryList;
} }