fix func字段处理

This commit is contained in:
2024-01-05 12:29:29 +08:00
parent dcc1f19219
commit ba87dc6c86
3 changed files with 42 additions and 3 deletions

View File

@@ -1,4 +1,6 @@
using Dlhis.Entity.Device.Enums;
using Kurisu.AspNetCore.Utils.Extensions;
using Newtonsoft.Json;
namespace Dlhis.Basic.Device.Response;
@@ -32,9 +34,20 @@ public class DeviceResponse
public string Supplier { get; set; }
/// <summary>
/// 设备功能
/// 设备功能 DeviceFuncEnumType
/// </summary>
public List<DeviceFuncEnumType> Funcs { get; set; }
public List<DeviceFuncEnumType> Funcs
{
get
{
if (FuncsStr.IsEmpty()) FuncsStr = "[]";
return FuncsStr.ToObject<List<DeviceFuncEnumType>>();
}
}
[JsonIgnore]
public string FuncsStr { get; set; }
/// <summary>
/// 部署点

View File

@@ -24,7 +24,11 @@ public class DeviceService : IDeviceService
public async Task<Pagination<DeviceResponse>> GetPageAsync(DevicePageRequest request)
{
var page = await _dbContext.Queryable<DeviceEntity>()
.Select<DeviceResponse>()
.Select(device => new DeviceResponse
{
FuncsStr = device.Funcs.ToString()
}, true)
.ToPageListAsync(request);
return page;