get บรรจุ ตามตำแหน่ง
This commit is contained in:
parent
85bc0fd359
commit
c9e36b1792
6 changed files with 10505 additions and 18 deletions
|
|
@ -210,5 +210,33 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
|
||||
#endregion
|
||||
public List<Guid> GetAllIdByRoot(Guid? id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var ret = new List<Guid>();
|
||||
if(id == null)
|
||||
return ret;
|
||||
|
||||
var oc = _context.Organizations.FirstOrDefault(x => x.Id == id);
|
||||
if (oc != null)
|
||||
ret.Add(oc.Id);
|
||||
|
||||
var child = _context.Organizations.AsQueryable().Where(x => x.Parent != null && x.Parent.Id == id).ToList();
|
||||
if (child.Any())
|
||||
{
|
||||
foreach (var item in child)
|
||||
{
|
||||
ret.AddRange(GetAllIdByRoot(item.Id));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue