fix department值问题
This commit is contained in:
@@ -116,11 +116,11 @@ public class DevicePermissionService : IDevicePermissionService
|
||||
|
||||
public async Task<DevicePermissionAssignResponse> AssignDeviceToDepartmentAsync(string currentTenantId, bool isAll, List<Guid> deviceCodes, DevicePermissionSaveRequest request)
|
||||
{
|
||||
request.AssignValue = request.TenantId + ":" + request.AssignValue;
|
||||
var departmentValue = request.TenantId + ":" + request.AssignValue;
|
||||
|
||||
var p = await _dbContext.Queryable<DevicePermissionEntity>()
|
||||
.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<DevicePermissionAssignResponse> AssignDeviceGroupToDepartmentAsync(string currentTenantId, DevicePermissionSaveRequest request)
|
||||
{
|
||||
request.AssignValue = request.TenantId + ":" + request.AssignValue;
|
||||
var departmentValue = request.TenantId + ":" + request.AssignValue;
|
||||
|
||||
var groupData = await _dbContext.Queryable<DevicePermissionEntity>()
|
||||
.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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user