设备类添加产品字段、添加物模型类,新增产品CRUD方法

This commit is contained in:
2026-09-03 17:16:28 +08:00
parent cfa8e78d33
commit bcd6484f45
29 changed files with 1611 additions and 23 deletions
+64
View File
@@ -0,0 +1,64 @@
using SqlSugar;
namespace Model.Entity.Config
{
/// <summary>
/// 产品(按型号区分;产品给设备归类,产品的物模型/告警等配置与设备相互独立)
/// </summary>
public class ProductEntity : BaseEntity
{
/// <summary>
/// 型号(唯一,如 GT-100
/// </summary>
[SugarColumn(ColumnDescription = "型号", Length = 100)]
public string Model { get; set; }
/// <summary>
/// 产品名称
/// </summary>
[SugarColumn(ColumnDescription = "产品名称", Length = 100, IsNullable = true)]
public string? Name { get; set; }
/// <summary>
/// 产品分类Id(关联 ProductCategoryEntity.Id0 表示未分类)
/// </summary>
[SugarColumn(ColumnDescription = "产品分类Id")]
public long CategoryId { get; set; }
/// <summary>
/// 制造商
/// </summary>
[SugarColumn(ColumnDescription = "制造商", Length = 100, IsNullable = true)]
public string? Manufacturer { get; set; }
/// <summary>
/// 产品描述
/// </summary>
[SugarColumn(ColumnDescription = "产品描述", Length = 500, IsNullable = true)]
public string? Description { get; set; }
/// <summary>
/// 通讯协议(复用 IotDeviceProtocolEnum:决定 DeviceCommand 驱动分支)
/// </summary>
[SugarColumn(ColumnDescription = "通讯协议")]
public IotDeviceProtocolEnum ProtocolType { get; set; } = IotDeviceProtocolEnum.ModbusTcp;
/// <summary>
/// 消息模型(消息协议/报文格式描述,如 JSON / 透传)
/// </summary>
[SugarColumn(ColumnDescription = "消息模型", Length = 64, IsNullable = true)]
public string? MessageModel { get; set; }
/// <summary>
/// 是否启用
/// </summary>
[SugarColumn(ColumnDescription = "是否启用")]
public bool IsEnabled { get; set; } = true;
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDescription = "备注", Length = 500, IsNullable = true)]
public string? Remark { get; set; }
}
}