fix SequenceContainsNoMatchingElement-1

This commit is contained in:
2024-12-26 15:33:43 +08:00
parent adb9b3a981
commit fa1d46b197

View File

@@ -115,20 +115,14 @@ public class GainfoPermissionService : IGainfoPermissionService
: deviceGroups.First(p => p.Code == x.OriginalCodes.First()).Name; : deviceGroups.First(p => p.Code == x.OriginalCodes.First()).Name;
var currentAssignValue = x.AssignValue; var currentAssignValue = x.AssignValue;
if (x.AssignType == AssignTypeEnumType.Department)
currentAssignValue = x.AssignType switch
{ {
currentAssignValue = departments.First(p => p.No == x.AssignValue.Split(":")[1]).Name; AssignTypeEnumType.Department => departments.FirstOrDefault(p => p.No == x.AssignValue.Split(":")[1])?.Name,
} AssignTypeEnumType.Group => userGroups.FirstOrDefault(p => p.Code == Guid.Parse(currentAssignValue))?.Name,
AssignTypeEnumType.User => "自己",
if (x.AssignType == AssignTypeEnumType.Group) _ => currentAssignValue
{ };
currentAssignValue = userGroups.First(p => p.Code == Guid.Parse(currentAssignValue)).Name;
}
if (x.AssignType == AssignTypeEnumType.User)
{
currentAssignValue = "自己";
}
var r = new DevicePermissionSourceTypeDto var r = new DevicePermissionSourceTypeDto
{ {