fix 调整代码位置处理

This commit is contained in:
2024-10-24 15:55:50 +08:00
parent 3dbd8f3e35
commit b2a949cf7a
2 changed files with 37 additions and 78 deletions

View File

@@ -295,9 +295,9 @@ public class DevicePermissionService : IDevicePermissionService
foreach (var userNo in userNos)
{
before.TryGetValue(userNo, out var beforeTenantDeviceCodes);
beforeTenantDeviceCodes ??= new();
beforeTenantDeviceCodes ??= new List<UserTenantDeviceCodeDto>();
current.TryGetValue(userNo, out var currentTenantDeviceCodes);
currentTenantDeviceCodes ??= new();
currentTenantDeviceCodes ??= new List<UserTenantDeviceCodeDto>();
var tenants = new HashSet<string>();
foreach (var item in beforeTenantDeviceCodes)
@@ -307,8 +307,8 @@ public class DevicePermissionService : IDevicePermissionService
foreach (var tenant in tenants)
{
var currentCodes = currentTenantDeviceCodes.FirstOrDefault(x => x.Tenant == tenant)?.Codes ?? new();
var beforeCodes = beforeTenantDeviceCodes.FirstOrDefault(x => x.Tenant == tenant)?.Codes ?? new();
var currentCodes = currentTenantDeviceCodes.FirstOrDefault(x => x.Tenant == tenant)?.Codes ?? new List<Guid>();
var beforeCodes = beforeTenantDeviceCodes.FirstOrDefault(x => x.Tenant == tenant)?.Codes ?? new List<Guid>();
//被删除
var deletedItems = beforeCodes.Where(x => !currentCodes.Contains(x)).ToList();