临时提交3

This commit is contained in:
2025-07-19 11:11:01 +08:00
parent 01fe2e14ef
commit ca67d2e6df
117 changed files with 476 additions and 910 deletions

View File

@@ -1,10 +0,0 @@
using System.Threading.Tasks;
namespace DMS.Core.Interfaces
{
public interface IDatabaseService
{
void InitializeDataBase();
Task InitializeMenu();
}
}

View File

@@ -1,18 +0,0 @@
using System.Threading.Tasks;
namespace DMS.Core.Interfaces
{
public interface IDbContext
{
// Define common database operations here, e.g.,
// Task<TEntity> GetByIdAsync<TEntity>(int id) where TEntity : class;
// Task AddAsync<TEntity>(TEntity entity) where TEntity : class;
// Task UpdateAsync<TEntity>(TEntity entity) where TEntity : class;
// Task DeleteAsync<TEntity>(TEntity entity) where TEntity : class;
// SqlSugarClient GetClient(); // This should NOT be here if you want to hide SqlSugar
// For now, we'll just keep it empty or add methods as needed.
// The primary goal is to abstract away SqlSugarClient.
// The IUnitOfWork already handles transactions.
}
}

View File

@@ -1,18 +0,0 @@
using DMS.Core.Models;
using DMS.Core.Enums;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace DMS.Core.Interfaces
{
public interface IDeviceRepository
{
Task<int> UpdateAsync(Device device);
Task<List<Device>> GetAllAsync();
Task<Device> GetByIdAsync(int id);
Task<int> DeleteAsync(Device device, List<MenuBean> menus);
Task AddAsync(Device device);
}
}

View File

@@ -1,23 +0,0 @@
using DMS.Core.Models;
using DMS.Core.Enums;
using SqlSugar;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace DMS.Core.Interfaces
{
public interface IMenuRepository
{
Task<int> DeleteAsync(MenuBean menu);
Task<int> DeleteAsync(MenuBean menu, SqlSugarClient db);
Task<List<MenuBean>> GetMenuTreesAsync();
Task<int> AddAsync(MenuBean menu);
Task<int> AddAsync(MenuBean menu, SqlSugarClient db);
Task<int> AddVarTableMenuAsync(Device dbDevice, int parentMenuId, SqlSugarClient db);
Task<int> AddAsync(Device device, SqlSugarClient db);
Task<int> UpdateAsync(MenuBean menu);
Task<MenuBean?> GetMenuByDataIdAsync(int dataId, MenuType menuType);
Task<MenuBean> GetMainMenuByNameAsync(string name);
}
}

View File

@@ -1,15 +0,0 @@
using DMS.Core.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace DMS.Core.Interfaces
{
public interface IMqttRepository
{
Task<Mqtt> GetByIdAsync(int id);
Task<List<Mqtt>> GetAllAsync();
Task<int> AddAsync(Mqtt mqtt);
Task<int> UpdateAsync(Mqtt mqtt);
Task<int> DeleteAsync(Mqtt mqtt);
}
}

View File

@@ -1,11 +0,0 @@
using System.Threading.Tasks;
namespace DMS.Core.Interfaces
{
public interface IUnitOfWork
{
Task BeginTranAsync();
Task CommitTranAsync();
Task RollbackTranAsync();
}
}

View File

@@ -1,15 +0,0 @@
using DMS.Core.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace DMS.Core.Interfaces
{
public interface IUserRepository
{
Task<User> GetByIdAsync(int id);
Task<List<User>> GetAllAsync();
Task<int> AddAsync(User user);
Task<int> UpdateAsync(User user);
Task<int> DeleteAsync(int id);
}
}

View File

@@ -1,30 +0,0 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using DMS.Core.Models;
using SqlSugar;
namespace DMS.Core.Interfaces
{
public interface IVarDataRepository
{
Task<Variable> GetByIdAsync(int id);
Task<Variable> GetByIdAsync(int id, SqlSugarClient db);
Task<List<Variable>> GetAllAsync();
Task<List<Variable>> GetAllAsync(SqlSugarClient db);
Task<List<Variable>> GetByVariableTableIdAsync(int varTableId);
Task<List<Variable>> GetByVariableTableIdAsync(int varTableId, SqlSugarClient db);
Task<Variable> AddAsync(Variable variable);
Task<Variable> AddAsync(Variable variable, SqlSugarClient db);
Task<int> AddAsync(IEnumerable<Variable> variableDatas);
Task<int> AddAsync(IEnumerable<Variable> variableDatas, SqlSugarClient db);
Task<int> UpdateAsync(Variable variable);
Task<int> UpdateAsync(Variable variable, SqlSugarClient db);
Task<int> UpdateAsync(List<Variable> variableDatas);
Task<int> UpdateAsync(List<Variable> variableDatas, SqlSugarClient db);
Task<int> DeleteAsync(Variable variable);
Task<int> DeleteAsync(Variable variable, SqlSugarClient db);
Task<int> DeleteAsync(IEnumerable<Variable> variableDatas);
Task<int> AddMqttToVariablesAsync(IEnumerable<VariableMqtt> variableMqttList);
}
}

View File

@@ -1,17 +0,0 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using DMS.Core.Models;
namespace DMS.Core.Interfaces
{
public interface IVarTableRepository
{
Task<VariableTable> AddAsync(VariableTable varTable);
Task<VariableTable> AddAsync(VariableTable variableTable, SqlSugarClient db);
Task<int> UpdateAsync(VariableTable variableTable);
Task<int> UpdateAsync(VariableTable variableTable, SqlSugarClient db);
Task<int> DeleteAsync(VariableTable variableTable);
Task<int> DeleteAsync(VariableTable varTable, SqlSugarClient db);
}
}

View File

@@ -1,18 +0,0 @@
using DMS.Core.Models;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace DMS.Core.Interfaces
{
public interface IVariableMqttAliasRepository
{
Task<VariableMqtt?> GetAliasByVariableAndMqtt(int variableDataId, int mqttId);
Task<VariableMqtt?> GetAliasByVariableAndMqtt(int variableDataId, int mqttId, SqlSugarClient db);
Task<int> AddManyAsync(IEnumerable<VariableMqtt> entities);
Task<int> AddManyAsync(IEnumerable<VariableMqtt> entities, SqlSugarClient db);
Task<int> UpdateAliasAsync(int variableDataId, int mqttId, string newAlias);
Task<int> UpdateAliasAsync(int variableDataId, int mqttId, string newAlias, SqlSugarClient db);
Task<int> DeleteAsync(int variableDataId, int mqttId);
}
}