fix 电子围栏增加部署方向

This commit is contained in:
2025-10-10 11:26:15 +08:00
parent eab455aef6
commit 1268105507
5 changed files with 42 additions and 8 deletions

View File

@@ -49,6 +49,7 @@ public class EFenceService : IEFenceService
Code = x.Code,
Name = x.Name,
Description = x.Description,
DirectionType = x.DirectionType,
DeviceCount = SqlFunc.Subqueryable<EFenceDeviceRelationEntity>().Where(p => p.EFenceCode == x.Code).Count(),
})
.ToPageListAsync(request);
@@ -81,9 +82,8 @@ public class EFenceService : IEFenceService
//查询设备
var devices = await _dbContext.Queryable<DeviceEntity>()
.Where(d => deviceCodes.Contains(d.Code))
.Where(d => d.DeployDirection.HasValue)
.Where(d => SqlFunc.Subqueryable<EFenceDeviceRelationEntity>()
.Where(p => p.EFenceCode == fence.Code && p.DeviceCode == d.Code)
.Where(p => p.DeviceCode == d.Code)
.NotAny() //不可重复分配
)
.ToListAsync();