fix 设备人员详情过滤

This commit is contained in:
2025-03-21 10:13:24 +08:00
parent 5a7938c966
commit e3cc31ec6a

View File

@@ -285,8 +285,15 @@ public class DevicePermissionService : IDevicePermissionService
ids = ids.Distinct().ToList();
var enableOutsourceDown = await _dbContext.Queryable<FactorySettingEntity>()
.Where(x => x.TenantId == device.TenantId)
.Select(x => SqlFunc.IsNullOrEmpty(x.EnableOutsourceDown) ? true : x.EnableOutsourceDown)
.SingleAsync();
var page = await _dbContext.Queryable<GainfoEntity>()
.Where(x => ids.Contains(x.Id))
.Where(x => x.Type != GainfoUserTypeEnumType.External)
.WhereIF(enableOutsourceDown == false, x => x.Type != GainfoUserTypeEnumType.Outsource)
.WhereIF(device.Type == DeviceTypeEnumType.Meal, x => x.Type != GainfoUserTypeEnumType.External && x.Type != GainfoUserTypeEnumType.Outsource)
.WhereIF(request.Search.IsPresent(), x => x.Code == request.Search || x.Name.Contains(request.Search))
.Select<DeviceGainfoResponse>()