fix 子查询补充过滤

This commit is contained in:
2025-12-17 11:04:56 +08:00
parent b409f6f375
commit 4bca8859ef
4 changed files with 55 additions and 44 deletions

View File

@@ -50,7 +50,7 @@ public class EFenceService : IEFenceService
Name = x.Name,
Description = x.Description,
DirectionType = x.DirectionType,
DeviceCount = SqlFunc.Subqueryable<EFenceDeviceRelationEntity>().Where(p => p.EFenceCode == x.Code).Count(),
DeviceCount = SqlFunc.Subqueryable<EFenceDeviceRelationEntity>().Where(p => p.EFenceCode == x.Code).Where(p => p.IsDeleted == false).Count(),
})
.ToPageListAsync(request);
@@ -84,6 +84,7 @@ public class EFenceService : IEFenceService
.Where(d => deviceCodes.Contains(d.Code))
.Where(d => SqlFunc.Subqueryable<EFenceDeviceRelationEntity>()
.Where(p => p.DeviceCode == d.Code)
.Where(p => p.IsDeleted == false)
.NotAny() //不可重复分配
)
.ToListAsync();