fix 部门分配问题

This commit is contained in:
2024-10-10 18:29:09 +08:00
parent 8535d7deda
commit 0c249a8e04
2 changed files with 7 additions and 6 deletions

View File

@@ -560,10 +560,12 @@ public class DevicePermissionService : IDevicePermissionService
var gainfoByDeptWhere = LinqExpressionExtensions.False<GainfoEntity>();
foreach ((string factory, List<string> departmentNos) in tenantDepartmentNos)
{
var matchDepartments = departmentNos.ToHashSet();
departmentNos.ForEach(x => RecursionGetNextAllDepartment(x, departments, matchDepartments));
var departmentNosToSearch = matchDepartments.ToList();
var departmentNosToSearch = new List<string>();
foreach (var d in departmentNos)
{
departmentNosToSearch.Add(d);
RecursionGetNextAllDepartment(d, departments, departmentNosToSearch);
}
gainfoByDeptWhere = gainfoByDeptWhere.Or(x => x.Factory == factory && departmentNosToSearch.Contains(x.DepartmentNo));
}
@@ -580,7 +582,7 @@ public class DevicePermissionService : IDevicePermissionService
return userNos.Concat(userNosByGroup).Concat(userNosByDepartment).Concat(userNosByWerk).Distinct().ToList();
void RecursionGetNextAllDepartment(string current, List<DepartmentEntity> data, HashSet<string> result)
void RecursionGetNextAllDepartment(string current, List<DepartmentEntity> data, List<string> result)
{
var next = data.Where(x => x.PNo == current);
foreach (var item in next.Select(x => x.No))

View File

@@ -1,7 +1,6 @@
using Dlhis.Basic.Organization.Request;
using Dlhis.Basic.Organization.Response;
using Dlhis.Basic.Organization.Services;
using Kurisu.AspNetCore.DataAccess.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;