V1.1 Entity Partial: 导航属性+网关字段白名单+AdapterList

This commit is contained in:
2026-05-17 05:27:38 +08:00
parent cfe26997bd
commit 3351dcadf8
2 changed files with 41 additions and 15 deletions

View File

@@ -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)
};
}
}
}