|
|
@ -145,6 +145,9 @@ public class SysOrgService : ISysOrgService, IDynamicApiController, ITransient
|
|
|
|
await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_DATASCOPE);
|
|
|
|
await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_DATASCOPE);
|
|
|
|
await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_USERSDATASCOPE);
|
|
|
|
await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_USERSDATASCOPE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var Org = await _sysOrgRep.AsQueryable().ToListAsync();
|
|
|
|
|
|
|
|
_sysCacheService.Set(CommonConst.CACHE_KEY_SysOrg, Org);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -219,7 +222,8 @@ public class SysOrgService : ISysOrgService, IDynamicApiController, ITransient
|
|
|
|
}
|
|
|
|
}
|
|
|
|
await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_DATASCOPE);
|
|
|
|
await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_DATASCOPE);
|
|
|
|
await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_USERSDATASCOPE);
|
|
|
|
await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_USERSDATASCOPE);
|
|
|
|
|
|
|
|
var Org = await _sysOrgRep.AsQueryable().ToListAsync();
|
|
|
|
|
|
|
|
_sysCacheService.Set(CommonConst.CACHE_KEY_SysOrg, Org);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -281,7 +285,8 @@ public class SysOrgService : ISysOrgService, IDynamicApiController, ITransient
|
|
|
|
}
|
|
|
|
}
|
|
|
|
await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_DATASCOPE);
|
|
|
|
await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_DATASCOPE);
|
|
|
|
await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_USERSDATASCOPE);
|
|
|
|
await _sysCacheService.DelByPatternAsync(CommonConst.CACHE_KEY_USERSDATASCOPE);
|
|
|
|
|
|
|
|
var Org = await _sysOrgRep.AsQueryable().ToListAsync();
|
|
|
|
|
|
|
|
_sysCacheService.Set(CommonConst.CACHE_KEY_SysOrg, Org);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -387,6 +392,7 @@ public class SysOrgService : ISysOrgService, IDynamicApiController, ITransient
|
|
|
|
[HttpGet("/sysOrg/treeList")]
|
|
|
|
[HttpGet("/sysOrg/treeList")]
|
|
|
|
public async Task<dynamic> GetOrgTreeList()
|
|
|
|
public async Task<dynamic> GetOrgTreeList()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var orgs = await _sysOrgRep
|
|
|
|
var orgs = await _sysOrgRep
|
|
|
|
.Where(u => u.Status == (int)CommonStatus.ENABLE && u.TenantId == UserManager.TENANT_ID)
|
|
|
|
.Where(u => u.Status == (int)CommonStatus.ENABLE && u.TenantId == UserManager.TENANT_ID)
|
|
|
|
.OrderBy(u => u.Sort)
|
|
|
|
.OrderBy(u => u.Sort)
|
|
|
@ -410,15 +416,37 @@ public class SysOrgService : ISysOrgService, IDynamicApiController, ITransient
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
public async Task<List<long>> GetUserIdListInOrg(long orgId)
|
|
|
|
public async Task<List<long>> GetUserIdListInOrg(long orgId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
List<SysOrg> org = new List<SysOrg>();
|
|
|
|
|
|
|
|
List<SysEmp> emp = new List<SysEmp>();
|
|
|
|
|
|
|
|
if (_sysCacheService.Exists(CommonConst.CACHE_KEY_SysOrg))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
org = await _sysCacheService.GetAsync<List<SysOrg>>(CommonConst.CACHE_KEY_SysOrg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
org = await _sysOrgRep.AsQueryable().ToListAsync();
|
|
|
|
|
|
|
|
_sysCacheService.Set(CommonConst.CACHE_KEY_SysOrg, org);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_sysCacheService.Exists(CommonConst.CACHE_KEY_SysEmp))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
emp = await _sysCacheService.GetAsync<List<SysEmp>>(CommonConst.CACHE_KEY_SysEmp);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
emp = await _sysEmpRep.AsQueryable().ToListAsync();
|
|
|
|
|
|
|
|
_sysCacheService.Set(CommonConst.CACHE_KEY_SysEmp, emp);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取所有子部门
|
|
|
|
//获取所有子部门
|
|
|
|
var orgIdList = _sysOrgRep.AsQueryable()
|
|
|
|
var orgIdList = org.Where(x => x.Pids.Contains($"[{orgId}]"))
|
|
|
|
.Where(x => x.Pids.Contains($"[{orgId}]"))
|
|
|
|
|
|
|
|
.Select(x => x.Id)
|
|
|
|
.Select(x => x.Id)
|
|
|
|
.ToList();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
//获取部门下的人
|
|
|
|
//获取部门下的人
|
|
|
|
var uidList = _sysEmpRep.AsQueryable()
|
|
|
|
var uidList = emp.Where(x => x.OrgId == orgId || orgIdList.Contains(x.OrgId))
|
|
|
|
.Where(x => x.OrgId == orgId || orgIdList.Contains(x.OrgId))
|
|
|
|
|
|
|
|
.Select(x => x.Id)
|
|
|
|
.Select(x => x.Id)
|
|
|
|
.ToList();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|