V1.1 Entity Partial: 导航属性+网关字段白名单+AdapterList
This commit is contained in:
@@ -4,19 +4,39 @@
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
using VolPro.Entity.SystemModels;
|
||||
|
||||
namespace VolPro.Entity.DomainModels
|
||||
{
|
||||
|
||||
public partial class base_device
|
||||
{
|
||||
//此处配置字段(字段配置见此model的另一个partial),如果表中没有此字段请加上[SugarColumn(IsIgnore = true)]属性,否则会异常
|
||||
/// <summary>导航属性:关联视频通道扩展记录(一对一)</summary>
|
||||
[Navigate(NavigateType.OneToOne, nameof(DeviceId), nameof(video_channel.DeviceId))]
|
||||
public video_channel? VideoChannel { get; set; }
|
||||
|
||||
/// <summary>导航属性:关联告警记录(一对多)</summary>
|
||||
[Navigate(NavigateType.OneToMany, nameof(DeviceId), nameof(iot_alarm.DeviceId))]
|
||||
public List<iot_alarm>? Alarms { get; set; }
|
||||
|
||||
/// <summary>导航属性:关联数据归档(一对多)</summary>
|
||||
[Navigate(NavigateType.OneToMany, nameof(DeviceId), nameof(iot_devicedata.DeviceId))]
|
||||
public List<iot_devicedata>? DeviceData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网关字段白名单。网关同步时,只有此集合中的字段会被覆盖,
|
||||
/// 其他字段(DeviceName/DeviceCategory/DeviceGroup/Location/MapModelId等)
|
||||
/// 由管理员在管理端维护,同步不覆盖。
|
||||
/// </summary>
|
||||
public static readonly HashSet<string> GatewayFields = new()
|
||||
{
|
||||
nameof(IsOnline),
|
||||
nameof(IsParent),
|
||||
nameof(ParentDeviceId),
|
||||
nameof(ExtraData),
|
||||
nameof(IpAddress),
|
||||
nameof(Port),
|
||||
nameof(LastSyncTime)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -4,19 +4,25 @@
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
using VolPro.Entity.SystemModels;
|
||||
|
||||
namespace VolPro.Entity.DomainModels
|
||||
{
|
||||
|
||||
public partial class gateway_nodes
|
||||
{
|
||||
//此处配置字段(字段配置见此model的另一个partial),如果表中没有此字段请加上[SugarColumn(IsIgnore = true)]属性,否则会异常
|
||||
/// <summary>
|
||||
/// 适配器类型列表。从 AdapterTypes(逗号分隔字符串)解析。
|
||||
/// 示例:"Owl:main,MC4:31ku" → ["Owl:main","MC4:31ku"]
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public List<string> AdapterList
|
||||
{
|
||||
get => string.IsNullOrEmpty(AdapterTypes)
|
||||
? new List<string>()
|
||||
: AdapterTypes.Split(',').Select(x => x.Trim()).Where(x => !string.IsNullOrEmpty(x)).ToList();
|
||||
set => AdapterTypes = value != null ? string.Join(",", value) : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user