From c984a9116bdf8b495d3d1a79fe3e8c0155fc1b83 Mon Sep 17 00:00:00 2001
From: he <10978375@qq.com>
Date: Fri, 3 Feb 2023 15:31:24 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Service/Common/DTO/DictionaryModel.cs | 1 +
.../Service/Common/DictionaryService.cs | 9 +++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs
index 21eefce27..7b44a6441 100644
--- a/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs
+++ b/IRaCIS.Core.Application/Service/Common/DTO/DictionaryModel.cs
@@ -97,6 +97,7 @@ namespace IRaCIS.Application.Contracts
}
public class GetCriterionDictionaryListOutDto
{
+ public Guid Id { get; set; }
public string Code { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
diff --git a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs
index 0fb296873..f1ae431fe 100644
--- a/IRaCIS.Core.Application/Service/Common/DictionaryService.cs
+++ b/IRaCIS.Core.Application/Service/Common/DictionaryService.cs
@@ -238,16 +238,21 @@ namespace IRaCIS.Application.Services
///
public async Task> 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))
.OrderBy(x => x.ShowOrder).Select(x => new GetCriterionDictionaryListOutDto()
{
Code = x.Code,
Description = x.Description
-
}).ToListAsync();
+ dictionaryList.ForEach(x => {
+
+ x.Id = criterionCodes.Where(y => y.Code == x.Code).Select(x => x.Id).FirstOrDefault();
+ });
+
return dictionaryList;
}