按照软件设计文档开始重构代码01

This commit is contained in:
2025-07-21 14:35:17 +08:00
parent a7b0a5d108
commit 29a2d44319
127 changed files with 12265 additions and 1586 deletions

View File

@@ -1,58 +1,15 @@
using DMS.Core.Enums;
using SqlSugar;
using SqlSugar.DbConvert;
using SqlSugar;
namespace DMS.Infrastructure.Entities;
/// <summary>
/// 表示数据库中的变量表实体。
/// </summary>
[SugarTable("VariableTable")]
[SugarTable("VariableTables")]
public class DbVariableTable
{
/// <summary>
/// 变量表中包含的数据变量列表。
/// </summary>
[Navigate(NavigateType.OneToMany, nameof(DbVariable.VariableTableId))]
public List<DbVariable>? Variables { get; set; }
/// <summary>
/// 变量表关联的设备。
/// </summary>
[Navigate(NavigateType.ManyToOne, nameof(DeviceId))]
public DbDevice? Device { get; set; }
/// <summary>
/// 变量表关联的设备ID。
/// </summary>
[SugarColumn(IsNullable = true)]
public int? DeviceId { get; set; }
/// <summary>
/// 变量表描述。
/// </summary>
[SugarColumn(IsNullable = true)]
public string? Description { get; set; }
/// <summary>
/// 变量表的唯一标识符。
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)] //数据库是自增才配自增
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
/// <summary>
/// 表示变量表是否处于活动状态。
/// </summary>
public bool IsActive { get; set; }
/// <summary>
/// 变量表名称。
/// </summary>
public string Name { get; set; }
/// <summary>
/// 变量表使用的协议类型。
/// </summary>
[SugarColumn(ColumnDataType = "varchar(20)", SqlParameterDbType = typeof(EnumToStringConvert))]
public ProtocolType ProtocolType { get; set; }
public string Description { get; set; }
public bool IsActive { get; set; }
public int DeviceId { get; set; }
public int Protocol { get; set; } // 对应 ProtocolType 枚举
}