fix 部门分配问题处理
This commit is contained in:
@@ -532,6 +532,7 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
private async Task<List<string>> GetPermissionUserNosAsync()
|
||||
{
|
||||
var permissions = await _dbContext.Queryable<DevicePermissionEntity>().ToListAsync();
|
||||
|
||||
//User
|
||||
var userNos = permissions.Where(x => x.AssignType == AssignTypeEnumType.User).Select(x => x.AssignValue).ToList();
|
||||
|
||||
@@ -616,8 +617,13 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
if (assignType == AssignTypeEnumType.Department)
|
||||
{
|
||||
//递归向上获取 assignValue = department.No
|
||||
var departmentNos = new List<string> { assignValue };
|
||||
DepartmentRecursionGetPNo(assignValue, departments, departmentNos);
|
||||
var arr = assignValue.Split(":");
|
||||
var tenantId = arr.First();
|
||||
var currentDepartmentNo = arr.Last();
|
||||
var departmentNos = new List<string> { currentDepartmentNo };
|
||||
DepartmentRecursionGetPNo(currentDepartmentNo, departments, departmentNos);
|
||||
|
||||
departmentNos = departmentNos.Select(x => tenantId + ":" + x).ToList();
|
||||
|
||||
tenantDevicePermissions = devicePermissions
|
||||
.Where(x => x.UniqueType == uniqueType)
|
||||
@@ -656,13 +662,11 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
void DepartmentRecursionGetPNo(string current, List<DepartmentEntity> data, List<string> result)
|
||||
{
|
||||
var p = data.FirstOrDefault(x => x.No == current)?.PNo;
|
||||
if (!p.IsPresent())
|
||||
if (p.IsPresent())
|
||||
{
|
||||
return;
|
||||
result.Add(p);
|
||||
DepartmentRecursionGetPNo(p, data, result);
|
||||
}
|
||||
|
||||
result.Add(p);
|
||||
DepartmentRecursionGetPNo(p, data, result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user