临时提交2
This commit is contained in:
@@ -5,5 +5,7 @@ namespace DMS.Core.Enums;
|
||||
public enum DeviceType
|
||||
{
|
||||
[Description("西门子PLC")] SiemensPLC,
|
||||
[Description("OpcUa设备")] OpcUa,
|
||||
[Description("Modbus TCP设备")] ModbusTCP,
|
||||
[Description("三菱PLC")] MelsecPLC
|
||||
}
|
||||
8
DMS.Core/Interfaces/IDatabaseService.cs
Normal file
8
DMS.Core/Interfaces/IDatabaseService.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace DMS.Core.Interfaces
|
||||
{
|
||||
public interface IDatabaseService
|
||||
{
|
||||
void InitializeDataBase();
|
||||
Task InitializeMenu();
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using DMS.Core.Models;
|
||||
|
||||
namespace DMS.Core.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// 继承自IBaseRepository,提供设备相关的特定数据查询功能。
|
||||
/// </summary>
|
||||
public interface IDeviceRepository : IBaseRepository<Device>
|
||||
{
|
||||
/// <summary>
|
||||
/// 异步获取所有激活的设备,并级联加载其下的变量表和变量。
|
||||
/// 这是后台轮询服务需要的主要数据。
|
||||
/// </summary>
|
||||
/// <returns>包含完整层级结构的激活设备列表。</returns>
|
||||
Task<List<Device>> GetActiveDevicesWithDetailsAsync(ProtocolType protocol);
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据设备ID获取设备及其所有详细信息(变量表、变量、MQTT别名等)。
|
||||
/// </summary>
|
||||
/// <param name="deviceId">设备ID。</param>
|
||||
/// <returns>包含详细信息的设备对象。</returns>
|
||||
Task<Device> GetDeviceWithDetailsAsync(int deviceId);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using DMS.Core.Models;
|
||||
|
||||
namespace DMS.Core.Interfaces;
|
||||
|
||||
public interface IMenuRepository : IBaseRepository<MenuBean>
|
||||
{
|
||||
// 可以添加特定于菜单的查询方法,例如获取所有菜单项
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using DMS.Core.Models;
|
||||
|
||||
namespace DMS.Core.Interfaces;
|
||||
|
||||
public interface IMqttServerRepository : IBaseRepository<MqttServer>
|
||||
{
|
||||
/// <summary>
|
||||
/// 异步获取一个MQTT服务器及其关联的所有变量别名。
|
||||
/// </summary>
|
||||
/// <param name="serverId">MQTT服务器ID。</param>
|
||||
/// <returns>包含变量别名信息的MQTT服务器对象。</returns>
|
||||
Task<MqttServer> GetMqttServerWithVariableAliasesAsync(int serverId);
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
using DMS.Core.Interfaces.Repositories;
|
||||
|
||||
namespace DMS.Core.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
@@ -10,47 +12,47 @@ public interface IRepositoryManager : IDisposable
|
||||
/// 获取设备仓储的实例。
|
||||
/// 所有通过此管理器获取的仓储都共享同一个数据库上下文和事务。
|
||||
/// </summary>
|
||||
IDeviceRepository Devices { get; }
|
||||
IDeviceRepository Devices { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取变量表仓储的实例。
|
||||
/// </summary>
|
||||
IVariableTableRepository VariableTables { get; }
|
||||
IVariableTableRepository VariableTables { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取变量仓储的实例。
|
||||
/// </summary>
|
||||
IVariableRepository Variables { get; }
|
||||
IVariableRepository Variables { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取MQTT服务器仓储的实例。
|
||||
/// </summary>
|
||||
IMqttServerRepository MqttServers { get; }
|
||||
IMqttServerRepository MqttServers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取变量MQTT别名仓储的实例。
|
||||
/// </summary>
|
||||
IVariableMqttAliasRepository VariableMqttAliases { get; }
|
||||
IVariableMqttAliasRepository VariableMqttAliases { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取菜单仓储的实例。
|
||||
/// </summary>
|
||||
IMenuRepository Menus { get; }
|
||||
IMenuRepository Menus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取变量历史仓储的实例。
|
||||
/// </summary>
|
||||
IVariableHistoryRepository VariableHistories { get; }
|
||||
IVariableHistoryRepository VariableHistories { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户仓储的实例。
|
||||
/// </summary>
|
||||
IUserRepository Users { get; }
|
||||
IUserRepository Users { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开始一个新的数据库事务。
|
||||
/// </summary>
|
||||
void BeginTransaction();
|
||||
Task BeginTranAsync();
|
||||
|
||||
/// <summary>
|
||||
/// 异步提交当前事务中的所有变更。
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
using DMS.Core.Models;
|
||||
|
||||
namespace DMS.Core.Interfaces;
|
||||
|
||||
public interface IUserRepository : IBaseRepository<User>
|
||||
{
|
||||
/// <summary>
|
||||
/// 异步根据用户名获取用户。
|
||||
/// </summary>
|
||||
/// <param name="username">用户名。</param>
|
||||
/// <returns>用户对象,如果不存在则为null。</returns>
|
||||
Task<User> GetByUsernameAsync(string username);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using DMS.Core.Models;
|
||||
|
||||
namespace DMS.Core.Interfaces;
|
||||
|
||||
public interface IVariableHistoryRepository : IBaseRepository<VariableHistory>
|
||||
{
|
||||
// 可以添加特定于VariableHistory的查询方法
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using DMS.Core.Models;
|
||||
|
||||
namespace DMS.Core.Interfaces;
|
||||
|
||||
public interface IVariableMqttAliasRepository : IBaseRepository<VariableMqttAlias>
|
||||
{
|
||||
/// <summary>
|
||||
/// 异步获取指定变量的所有MQTT别名关联,并加载关联的MQTT服务器信息。
|
||||
/// </summary>
|
||||
/// <param name="variableId">变量ID。</param>
|
||||
/// <returns>指定变量的所有MQTT别名关联列表。</returns>
|
||||
Task<List<VariableMqttAlias>> GetAliasesForVariableAsync(int variableId);
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据变量ID和MQTT服务器ID获取特定的MQTT别名关联。
|
||||
/// </summary>
|
||||
/// <param name="variableId">变量ID。</param>
|
||||
/// <param name="mqttServerId">MQTT服务器ID。</param>
|
||||
/// <returns>匹配的VariableMqttAlias对象,如果不存在则为null。</returns>
|
||||
Task<VariableMqttAlias> GetByVariableAndServerAsync(int variableId, int mqttServerId);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using DMS.Core.Models;
|
||||
|
||||
namespace DMS.Core.Interfaces;
|
||||
|
||||
public interface IVariableRepository : IBaseRepository<Variable>
|
||||
{
|
||||
/// <summary>
|
||||
/// 异步获取一个变量及其关联的所有MQTT别名和对应的MQTT服务器信息。
|
||||
/// </summary>
|
||||
/// <param name="variableId">变量ID。</param>
|
||||
/// <returns>包含别名和服务器信息的变量对象。</returns>
|
||||
Task<Variable> GetVariableWithMqttAliasesAsync(int variableId);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using DMS.Core.Models;
|
||||
|
||||
namespace DMS.Core.Interfaces;
|
||||
|
||||
public interface IVariableTableRepository : IBaseRepository<VariableTable>
|
||||
{
|
||||
// 可以添加特定于VariableTable的查询方法
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace DMS.Core.Interfaces;
|
||||
namespace DMS.Core.Interfaces.Repositories;
|
||||
|
||||
/// <summary>
|
||||
/// 提供泛型数据访问操作的基础仓储接口。
|
||||
@@ -23,17 +23,17 @@ public interface IBaseRepository<T> where T : class
|
||||
/// 异步添加一个新实体。
|
||||
/// </summary>
|
||||
/// <param name="entity">要添加的实体。</param>
|
||||
Task AddAsync(T entity);
|
||||
Task<T> AddAsync(T entity);
|
||||
|
||||
/// <summary>
|
||||
/// 异步更新一个已存在的实体。
|
||||
/// </summary>
|
||||
/// <param name="entity">要更新的实体。</param>
|
||||
Task UpdateAsync(T entity);
|
||||
Task<int> UpdateAsync(T entity);
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据ID删除一个实体。
|
||||
/// </summary>
|
||||
/// <param name="id">要删除的实体的主键ID。</param>
|
||||
Task DeleteAsync(int id);
|
||||
Task<int> DeleteAsync(T entity);
|
||||
}
|
||||
10
DMS.Core/Interfaces/Repositories/IDeviceRepository.cs
Normal file
10
DMS.Core/Interfaces/Repositories/IDeviceRepository.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
using DMS.Core.Models;
|
||||
|
||||
namespace DMS.Core.Interfaces.Repositories
|
||||
{
|
||||
public interface IDeviceRepository:IBaseRepository<Device>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
10
DMS.Core/Interfaces/Repositories/IMenuRepository.cs
Normal file
10
DMS.Core/Interfaces/Repositories/IMenuRepository.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
using DMS.Core.Models;
|
||||
|
||||
namespace DMS.Core.Interfaces.Repositories
|
||||
{
|
||||
public interface IMenuRepository:IBaseRepository<MenuBean>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
DMS.Core/Interfaces/Repositories/IMqttServerRepository.cs
Normal file
11
DMS.Core/Interfaces/Repositories/IMqttServerRepository.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
using DMS.Core.Models;
|
||||
|
||||
namespace DMS.Core.Interfaces.Repositories
|
||||
{
|
||||
public interface IMqttServerRepository:IBaseRepository<MqttServer>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
9
DMS.Core/Interfaces/Repositories/IUserRepository.cs
Normal file
9
DMS.Core/Interfaces/Repositories/IUserRepository.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using DMS.Core.Models;
|
||||
|
||||
namespace DMS.Core.Interfaces.Repositories
|
||||
{
|
||||
public interface IUserRepository:IBaseRepository<User>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using DMS.Core.Models;
|
||||
|
||||
namespace DMS.Core.Interfaces.Repositories;
|
||||
|
||||
public interface IVariableHistoryRepository:IBaseRepository<VariableHistory>
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
namespace DMS.Core.Interfaces.Repositories
|
||||
{
|
||||
public interface IVariableMqttAliasRepository:IBaseRepository<VariableMqttAlias>
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
10
DMS.Core/Interfaces/Repositories/IVariableRepository.cs
Normal file
10
DMS.Core/Interfaces/Repositories/IVariableRepository.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
using DMS.Core.Models;
|
||||
|
||||
namespace DMS.Core.Interfaces.Repositories
|
||||
{
|
||||
public interface IVariableRepository:IBaseRepository<Variable>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
DMS.Core/Interfaces/Repositories/IVariableTableRepository.cs
Normal file
11
DMS.Core/Interfaces/Repositories/IVariableTableRepository.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
using DMS.Core.Models;
|
||||
|
||||
namespace DMS.Core.Interfaces.Repositories
|
||||
{
|
||||
public interface IVariableTableRepository:IBaseRepository<VariableTable>
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user