fix 白名单设置

This commit is contained in:
2024-08-06 21:48:30 +08:00
parent 62d5917695
commit 908a2ddb4e

View File

@@ -241,13 +241,20 @@ public class GainfoService : IGainfoService
{
var gainfo = await _gainfoStore.Queryable().Where(x => x.Code == userCode).SingleAsync();
gainfo.ThrowIfNull("档案信息不存在");
gainfo.Type = GainfoUserTypeEnumType.SecurityWhite;
gainfo.Type = gainfo.Type switch
{
GainfoUserTypeEnumType.Normal => GainfoUserTypeEnumType.SecurityWhite,
GainfoUserTypeEnumType.SecurityWhite => GainfoUserTypeEnumType.Normal,
_ => gainfo.Type
};
await _dbContext.UpdateAsync(gainfo);
var deviceCodes = await _devicePermissionService.GetAssignDeviceCodesAsync(gainfo.No);
var dhDevices = await _dbContext.Queryable<DeviceEntity>().LeftJoin<DeviceTemplateEntity>((x, xt) => x.TemplateCode == xt.Code)
.Where((x, xt) => xt.Brand == "大华")
.Where((x, xt) => xt.Name == "大华人脸机")
.Where(x => deviceCodes.Contains(x.Code))
.ToListAsync();