按照软件设计文档开始重构代码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

@@ -12,7 +12,7 @@ namespace DMS.Infrastructure.Repositories;
/// <summary>
/// Mqtt仓储类用于操作DbMqtt实体
/// </summary>
public class MqttRepository : BaseRepository<DbMqtt>
public class MqttRepository : BaseRepository<DbMqttServer>
{
public MqttRepository(SqlSugarDbContext dbContext)
@@ -25,11 +25,11 @@ public class MqttRepository : BaseRepository<DbMqtt>
/// </summary>
/// <param name="id">主键ID</param>
/// <returns></returns>
public override async Task<DbMqtt> GetByIdAsync(int id)
public override async Task<DbMqttServer> GetByIdAsync(int id)
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
var result = await Db.Queryable<DbMqtt>()
var result = await Db.Queryable<DbMqttServer>()
.In(id)
.SingleAsync();
stopwatch.Stop();
@@ -41,13 +41,11 @@ public class MqttRepository : BaseRepository<DbMqtt>
/// 获取所有Mqtt配置
/// </summary>
/// <returns></returns>
public override async Task<List<DbMqtt>> GetAllAsync()
public override async Task<List<DbMqttServer>> GetAllAsync()
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
var result = await Db.Queryable<DbMqtt>()
.Includes(m => m.VariableMqtts, vm => vm.Variable)
.Includes(m => m.VariableMqtts, vm => vm.Mqtt)
var result = await Db.Queryable<DbMqttServer>()
.ToListAsync();
stopwatch.Stop();
NlogHelper.Info($"获取所有Mqtt配置耗时{stopwatch.ElapsedMilliseconds}ms");