临时提交
This commit is contained in:
10
DMS.Core/Interfaces/IDatabaseService.cs
Normal file
10
DMS.Core/Interfaces/IDatabaseService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DMS.Core.Interfaces
|
||||
{
|
||||
public interface IDatabaseService
|
||||
{
|
||||
void InitializeDataBase();
|
||||
Task InitializeMenu();
|
||||
}
|
||||
}
|
||||
18
DMS.Core/Interfaces/IDbContext.cs
Normal file
18
DMS.Core/Interfaces/IDbContext.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
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.
|
||||
}
|
||||
}
|
||||
18
DMS.Core/Interfaces/IDeviceRepository.cs
Normal file
18
DMS.Core/Interfaces/IDeviceRepository.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
23
DMS.Core/Interfaces/IMenuRepository.cs
Normal file
23
DMS.Core/Interfaces/IMenuRepository.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
15
DMS.Core/Interfaces/IMqttRepository.cs
Normal file
15
DMS.Core/Interfaces/IMqttRepository.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
11
DMS.Core/Interfaces/IUnitOfWork.cs
Normal file
11
DMS.Core/Interfaces/IUnitOfWork.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DMS.Core.Interfaces
|
||||
{
|
||||
public interface IUnitOfWork
|
||||
{
|
||||
Task BeginTranAsync();
|
||||
Task CommitTranAsync();
|
||||
Task RollbackTranAsync();
|
||||
}
|
||||
}
|
||||
15
DMS.Core/Interfaces/IUserRepository.cs
Normal file
15
DMS.Core/Interfaces/IUserRepository.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
30
DMS.Core/Interfaces/IVarDataRepository.cs
Normal file
30
DMS.Core/Interfaces/IVarDataRepository.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
17
DMS.Core/Interfaces/IVarTableRepository.cs
Normal file
17
DMS.Core/Interfaces/IVarTableRepository.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
18
DMS.Core/Interfaces/IVariableMqttAliasRepository.cs
Normal file
18
DMS.Core/Interfaces/IVariableMqttAliasRepository.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user