添加分组

Uat_Study
he 2022-04-08 11:21:09 +08:00
parent 7aa3d7acdf
commit 3273ad590e
2 changed files with 30 additions and 1 deletions

View File

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

View File

@ -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<Guid> guids = new List<Guid>();
@ -344,6 +348,24 @@ namespace IRaCIS.Core.Application.Service.Inspection
});
JsonData[item.Key] = string.Join(',', await _repository.GetQueryable<Dictionary>().Where(x => guids.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync());
}
else if (item.Type.ToLower() == "ChildGroup".ToLower())
{
List<string> guids = new List<string>();
arrays.ForEach(x =>
{
guids.Add(x.ToString());
});
JsonData[item.Key] = string.Join(',', await
_repository.GetQueryable<Dictionary>().Where(x => x.Code == item.Code).GroupJoin(
_repository.GetQueryable<Dictionary>().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<string> guids =new List<string>();
@ -370,6 +392,13 @@ namespace IRaCIS.Core.Application.Service.Inspection
Guid guid = Guid.Parse(value.ToString());
JsonData[item.Key] = await _repository.GetQueryable<Dictionary>().Where(x => guid == x.Id).Select(x => x.ValueCN).FirstOrDefaultAsync();
}
else if (item.Type.ToLower() == "ChildGroup".ToLower())
{
JsonData[item.Key] = await _repository.GetQueryable<Dictionary>().Where(x => x.Code == item.Code).Join(_repository.GetQueryable<Dictionary>().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<Dictionary>().Where(x=>x.Code==item.Code).Join(_repository.GetQueryable<Dictionary>().Where(x=>x.Code== value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new