添加分组

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

@ -335,6 +335,10 @@ namespace IRaCIS.Core.Application.Service.Inspection
if (value.GetType() == typeof(JArray)) if (value.GetType() == typeof(JArray))
{ {
JArray arrays = (JArray)value; JArray arrays = (JArray)value;
if (item.Type.ToLower() == "id".ToLower()) if (item.Type.ToLower() == "id".ToLower())
{ {
List<Guid> guids = new List<Guid>(); 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()); 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 else
{ {
List<string> guids =new List<string>(); List<string> guids =new List<string>();
@ -370,6 +392,13 @@ namespace IRaCIS.Core.Application.Service.Inspection
Guid guid = Guid.Parse(value.ToString()); Guid guid = Guid.Parse(value.ToString());
JsonData[item.Key] = await _repository.GetQueryable<Dictionary>().Where(x => guid == x.Id).Select(x => x.ValueCN).FirstOrDefaultAsync(); 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 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 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