From a67ac1b4d9f9261a7464ec639ad2e56a8b57bfe4 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Tue, 3 Dec 2024 22:42:57 +0800 Subject: [PATCH] =?UTF-8?q?fix=20department=E5=80=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/DevicePermissionService.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs index 40c04983..330090d3 100644 --- a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs +++ b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs @@ -116,11 +116,11 @@ public class DevicePermissionService : IDevicePermissionService public async Task AssignDeviceToDepartmentAsync(string currentTenantId, bool isAll, List deviceCodes, DevicePermissionSaveRequest request) { - request.AssignValue = request.TenantId + ":" + request.AssignValue; + var departmentValue = request.TenantId + ":" + request.AssignValue; var p = await _dbContext.Queryable() .Where(x => x.AssignType == AssignTypeEnumType.Department) - .Where(x => x.AssignValue == request.AssignValue) + .Where(x => x.AssignValue == departmentValue) .Where(x => x.UniqueType == request.UniqueType) .WhereIF(!isAll, x => deviceCodes.Contains(x.UniqueValue)) .Where(x => x.Type == request.Type) @@ -209,7 +209,7 @@ public class DevicePermissionService : IDevicePermissionService }).ToList()); } - foreach (var items in tasks.Chunk(500)) + foreach (var items in tasks.Where(x => x.Type == DeviceTaskEnumType.Add).Chunk(500)) { await _dbContext.InsertAsync(items.ToList()); } @@ -224,11 +224,11 @@ public class DevicePermissionService : IDevicePermissionService public async Task AssignDeviceGroupToDepartmentAsync(string currentTenantId, DevicePermissionSaveRequest request) { - request.AssignValue = request.TenantId + ":" + request.AssignValue; + var departmentValue = request.TenantId + ":" + request.AssignValue; var groupData = await _dbContext.Queryable() .Where(x => x.AssignType == AssignTypeEnumType.Department) - .Where(x => x.AssignValue == request.AssignValue) + .Where(x => x.AssignValue == departmentValue) .Where(x => x.UniqueType == request.UniqueType) .Where(x => x.Type == request.Type) .Where(x => x.TenantId == currentTenantId) @@ -307,7 +307,7 @@ public class DevicePermissionService : IDevicePermissionService }).ToList()); } - foreach (var items in tasks.Chunk(500)) + foreach (var items in tasks.Where(x => x.Type == DeviceTaskEnumType.Add).Chunk(500)) { await _dbContext.InsertAsync(items.ToList()); } @@ -423,7 +423,7 @@ public class DevicePermissionService : IDevicePermissionService }).ToList()); } - foreach (var items in tasks.Chunk(500)) + foreach (var items in tasks.Where(x => x.Type == DeviceTaskEnumType.Add).Chunk(500)) { await _dbContext.InsertAsync(items.ToList()); } @@ -512,7 +512,7 @@ public class DevicePermissionService : IDevicePermissionService }).ToList()); } - foreach (var items in tasks.Chunk(500)) + foreach (var items in tasks.Where(x => x.Type == DeviceTaskEnumType.Add).Chunk(500)) { await _dbContext.InsertAsync(items.ToList()); }