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

@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using Dlhis.Entity.Device.Enums;
namespace Dlhis.Basic.WorkGrids.Request;
@@ -10,4 +11,7 @@ public class EFenceSaveRequest
public string Name { get; set; }
public string Description { get; set; }
[EnumDataType(typeof(DeviceDeployDirectionEnumType))]
public DeviceDeployDirectionEnumType DirectionType { get; set; }
}

View File

@@ -1,3 +1,6 @@
using Dlhis.Entity.Device.Enums;
using Kurisu.AspNetCore.Utils.Extensions;
namespace Dlhis.Basic.WorkGrids.Response;
public class EFencePageResponse
@@ -20,4 +23,8 @@ public class EFencePageResponse
/// 设备数量
/// </summary>
public int DeviceCount { get; set; }
public DeviceDeployDirectionEnumType DirectionType { get; set; }
public string DirectionTypeDesc => DirectionType.GetDescription();
}

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();