添加了后台的数据处理服务。并判断如果值发生了变化则更新数据库

This commit is contained in:
2025-07-16 15:08:56 +08:00
parent 53f904e0ce
commit 77363efcf6
11 changed files with 222 additions and 147 deletions

View File

@@ -166,14 +166,13 @@ public class VarDataRepository
/// </summary>
/// <param name="variableData">VariableData实体</param>
/// <returns></returns>
public async Task<bool> UpdateAsync(VariableData variableData)
public async Task<int> UpdateAsync(VariableData variableData)
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
using (var _db = DbContext.GetInstance())
{
var result = await _db.UpdateNav(_mapper.Map<DbVariableData>(variableData))
.Include(d => d.Mqtts)
var result = await _db.Updateable<DbVariableData>(_mapper.Map<DbVariableData>(variableData))
.ExecuteCommandAsync();
stopwatch.Stop();
NlogHelper.Info($"更新VariableData '{variableData.Name}' 耗时:{stopwatch.ElapsedMilliseconds}ms");