From 3273ad590e36ba3611f5d2998bb8bc62047f073d Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Fri, 8 Apr 2022 11:21:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/InspectionController.cs | 2 +- .../Service/Inspection/InspectionService.cs | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.API/Controllers/InspectionController.cs b/IRaCIS.Core.API/Controllers/InspectionController.cs index 24c01acc1..1b931a3de 100644 --- a/IRaCIS.Core.API/Controllers/InspectionController.cs +++ b/IRaCIS.Core.API/Controllers/InspectionController.cs @@ -89,7 +89,7 @@ namespace IRaCIS.Core.API.Controllers opt.AuditInfo.SubjectVisitId = Guid.Parse(fun.Data); opt.AuditInfo.SubjectVisitName = opt.OptCommand.VisitName; - + return await _inspectionService.Enforcement(opt.OptCommand, opt.AuditInfo, opt.SignInfo, null, fun); } diff --git a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs index c3eaa9916..ab42a0765 100644 --- a/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs +++ b/IRaCIS.Core.Application/Service/Inspection/InspectionService.cs @@ -335,6 +335,10 @@ namespace IRaCIS.Core.Application.Service.Inspection if (value.GetType() == typeof(JArray)) { JArray arrays = (JArray)value; + + + + if (item.Type.ToLower() == "id".ToLower()) { List guids = new List(); @@ -344,6 +348,24 @@ namespace IRaCIS.Core.Application.Service.Inspection }); JsonData[item.Key] = string.Join(',', await _repository.GetQueryable().Where(x => guids.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync()); } + else if (item.Type.ToLower() == "ChildGroup".ToLower()) + { + List guids = new List(); + arrays.ForEach(x => + { + guids.Add(x.ToString()); + }); + JsonData[item.Key] = string.Join(',', await + _repository.GetQueryable().Where(x => x.Code == item.Code).GroupJoin( + _repository.GetQueryable().Where(x => guids.Contains(x.ChildGroup)), a => a.Id, b => b.ParentId, (a, b) => new + { + parent = b + }).SelectMany(a => a.parent, (m, n) => new + { + value = n.ValueCN + }).Select(x => x.value).ToListAsync() + ); + } else { List guids =new List(); @@ -370,6 +392,13 @@ namespace IRaCIS.Core.Application.Service.Inspection Guid guid = Guid.Parse(value.ToString()); JsonData[item.Key] = await _repository.GetQueryable().Where(x => guid == x.Id).Select(x => x.ValueCN).FirstOrDefaultAsync(); } + else if (item.Type.ToLower() == "ChildGroup".ToLower()) + { + JsonData[item.Key] = await _repository.GetQueryable().Where(x => x.Code == item.Code).Join(_repository.GetQueryable().Where(x => x.ChildGroup == value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new + { + value = b.ValueCN + }).Select(x => x.value).FirstOrDefaultAsync(); + } else { JsonData[item.Key] = await _repository.GetQueryable().Where(x=>x.Code==item.Code).Join(_repository.GetQueryable().Where(x=>x.Code== value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new