Compare commits

...

2 Commits

  1. 5
      et --hard d9ef1cb
  2. 28
      src/X1.Domain/Entities/Device/CellularDeviceRuntime.cs
  3. 2
      src/X1.Domain/Repositories/Device/ICellularDeviceRuntimeRepository.cs
  4. 13
      src/X1.Infrastructure/Repositories/Device/CellularDeviceRuntimeRepository.cs
  5. 3
      tatus

5
et --hard d9ef1cb

@ -0,0 +1,5 @@
6de45ae (HEAD -> feature/x1-web-request, origin/feature/x1-web-request) 修复GetDeviceRuntimesAsync类型不匹配问题,使用DeviceRuntimeDto简化类型转换
43135fb 简化GetRuntimesByDeviceCodesAsync方法,只返回需要的四个字段
d9ef1cb 修复Swagger schemaId冲突:提取共享的BatchOperationSummary类
18dbe0d 修复前端StopDevices功能:添加批量停止设备支持、状态管理和UI优化
d8d02f9 feat: 添加运行时状态数组参数支持从前端传入过滤条件

28
src/X1.Domain/Entities/Device/CellularDeviceRuntime.cs

@ -63,34 +63,6 @@ public class CellularDeviceRuntime : BaseEntity
return runtime; return runtime;
} }
/// <summary>
/// 从SQL查询结果创建设备运行时状态(用于批量查询)
/// </summary>
public static CellularDeviceRuntime CreateFromQueryResult(
string id,
string deviceCode,
int runtimeStatus,
string? runtimeCode,
string? networkStackCode,
DateTime createdAt,
DateTime updatedAt,
bool isDeleted = false)
{
var runtime = new CellularDeviceRuntime
{
Id = id,
DeviceCode = deviceCode,
RuntimeStatus = (DeviceRuntimeStatus)runtimeStatus,
RuntimeCode = runtimeCode,
NetworkStackCode = networkStackCode,
CreatedAt = createdAt,
UpdatedAt = updatedAt,
IsDeleted = isDeleted
};
return runtime;
}
/// <summary> /// <summary>
/// 启动设备 /// 启动设备
/// </summary> /// </summary>

2
src/X1.Domain/Repositories/Device/ICellularDeviceRuntimeRepository.cs

@ -114,7 +114,7 @@ public interface ICellularDeviceRuntimeRepository : IBaseRepository<CellularDevi
/// <summary> /// <summary>
/// 根据设备编号列表批量获取运行时状态(每个设备只返回最新的一条记录,支持多种状态过滤) /// 根据设备编号列表批量获取运行时状态(每个设备只返回最新的一条记录,支持多种状态过滤)
/// </summary> /// </summary>
Task<IList<DeviceRuntimeDto>> GetRuntimesByDeviceCodesAsync(IEnumerable<string> deviceCodes, IEnumerable<DeviceRuntimeStatus>? runtimeStatuses = null, CancellationToken cancellationToken = default); Task<IList<CellularDeviceRuntime>> GetRuntimesByDeviceCodesAsync(IEnumerable<string> deviceCodes, IEnumerable<DeviceRuntimeStatus>? runtimeStatuses = null, CancellationToken cancellationToken = default);
/// <summary> /// <summary>
/// 批量更新设备运行时状态 /// 批量更新设备运行时状态

13
src/X1.Infrastructure/Repositories/Device/CellularDeviceRuntimeRepository.cs

@ -11,7 +11,6 @@ using CellularManagement.Domain.Entities.Device;
using CellularManagement.Domain.Repositories.Device; using CellularManagement.Domain.Repositories.Device;
using CellularManagement.Domain.Repositories.Base; using CellularManagement.Domain.Repositories.Base;
using CellularManagement.Infrastructure.Repositories.Base; using CellularManagement.Infrastructure.Repositories.Base;
using CellularManagement.Domain.Models;
namespace CellularManagement.Infrastructure.Repositories.Device; namespace CellularManagement.Infrastructure.Repositories.Device;
@ -251,18 +250,17 @@ public class CellularDeviceRuntimeRepository : BaseRepository<CellularDeviceRunt
/// <summary> /// <summary>
/// 根据设备编号列表批量获取运行时状态(每个设备只返回最新的一条记录,支持多种状态过滤) /// 根据设备编号列表批量获取运行时状态(每个设备只返回最新的一条记录,支持多种状态过滤)
/// </summary> /// </summary>
public async Task<IList<DeviceRuntimeDto>> GetRuntimesByDeviceCodesAsync(IEnumerable<string> deviceCodes, IEnumerable<DeviceRuntimeStatus>? runtimeStatuses = null, CancellationToken cancellationToken = default) public async Task<IList<CellularDeviceRuntime>> GetRuntimesByDeviceCodesAsync(IEnumerable<string> deviceCodes, IEnumerable<DeviceRuntimeStatus>? runtimeStatuses = null, CancellationToken cancellationToken = default)
{ {
var deviceCodeList = deviceCodes.ToList(); var deviceCodeList = deviceCodes.ToList();
if (!deviceCodeList.Any()) if (!deviceCodeList.Any())
{ {
return new List<DeviceRuntimeDto>(); return new List<CellularDeviceRuntime>();
} }
// 构建SQL查询,只返回需要的字段 // 构建SQL查询,支持多种状态过滤
var sql = @" var sql = @"
SELECT DISTINCT ON (""DeviceCode"") SELECT DISTINCT ON (""DeviceCode"") *
""DeviceCode"", ""RuntimeStatus"", ""RuntimeCode"", ""NetworkStackCode""
FROM ""tb_cellular_device_runtimes"" FROM ""tb_cellular_device_runtimes""
WHERE ""DeviceCode"" = ANY(@deviceCodes)"; WHERE ""DeviceCode"" = ANY(@deviceCodes)";
@ -278,8 +276,7 @@ public class CellularDeviceRuntimeRepository : BaseRepository<CellularDeviceRunt
sql += @" ORDER BY ""DeviceCode"", ""CreatedAt"" DESC"; sql += @" ORDER BY ""DeviceCode"", ""CreatedAt"" DESC";
// 使用DeviceRuntimeDto来接收SQL查询结果 var result = await ExecuteSqlQueryAsync<CellularDeviceRuntime>(sql, parameters.ToArray(), cancellationToken);
var result = await ExecuteSqlQueryAsync<DeviceRuntimeDto>(sql, parameters.ToArray(), cancellationToken);
var statusFilterText = runtimeStatuses != null && runtimeStatuses.Any() var statusFilterText = runtimeStatuses != null && runtimeStatuses.Any()
? string.Join(",", runtimeStatuses.Select(s => s.ToString())) ? string.Join(",", runtimeStatuses.Select(s => s.ToString()))

3
tatus

@ -0,0 +1,3 @@
43135fb (HEAD -> feature/x1-web-request) 简化GetRuntimesByDeviceCodesAsync方法,只返回需要的四个字段
d9ef1cb 修复Swagger schemaId冲突:提取共享的BatchOperationSummary类
18dbe0d 修复前端StopDevices功能:添加批量停止设备支持、状态管理和UI优化
Loading…
Cancel
Save