refactor:修复仓储接口和实现中的DeleteAsync方法问题 │
1. 为IBaseRepository接口添加DeleteByIdsAsync方法定义 2. 为所有仓储实现类添加DeleteByIdsAsync方法实现 3. 修复DeviceAppService中deviceId未定义的问题 4. 修复DeviceManagementService中DeleteDeviceByIdAsync方法不存在的问题 5. 修复所有仓储类中DeleteAsync(List<T>)方法实现不正确的问题 6. 修复Email相关仓储类中Deleteable方法参数错误的问题"
This commit is contained in:
@@ -23,5 +23,25 @@ namespace DMS.Infrastructure.Repositories
|
||||
// .Where(a => !a.IsAcknowledged)
|
||||
// .ToListAsync();
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// 异步删除单个报警历史记录。
|
||||
/// </summary>
|
||||
/// <param name="entity">要删除的报警历史实体。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(AlarmHistory entity)
|
||||
{
|
||||
return await base.DeleteAsync(new List<AlarmHistory> { entity });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除报警历史记录。
|
||||
/// </summary>
|
||||
/// <param name="entities">要删除的报警历史实体列表。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(List<AlarmHistory> entities)
|
||||
{
|
||||
return await base.DeleteAsync(entities);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,19 +68,21 @@ public abstract class BaseRepository<TEntity>
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 异步删除一个实体。
|
||||
/// 异步批量删除实体。
|
||||
/// </summary>
|
||||
/// <param name="entity">要删除的实体对象。</param>
|
||||
/// <param name="entities">要删除的实体列表。</param>
|
||||
/// <returns>返回受影响的行数。</returns>
|
||||
public virtual async Task<int> DeleteAsync(TEntity entity)
|
||||
public virtual async Task<int> DeleteAsync(List<TEntity> entities)
|
||||
{
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
var result = await _dbContext.GetInstance().Deleteable(entity)
|
||||
var result = await _dbContext.GetInstance().Deleteable(entities)
|
||||
.ExecuteCommandAsync();
|
||||
stopwatch.Stop();
|
||||
_logger.LogInformation($"Delete {typeof(TEntity).Name}耗时:{stopwatch.ElapsedMilliseconds}ms");
|
||||
_logger.LogInformation($"DeleteAsync Batch {typeof(TEntity).Name}, Count: {entities.Count}, 耗时:{stopwatch.ElapsedMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -136,38 +138,9 @@ public abstract class BaseRepository<TEntity>
|
||||
return entity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据主键 ID 列表批量删除实体。
|
||||
/// </summary>
|
||||
/// <param name="ids">要删除的实体主键 ID 列表。</param>
|
||||
/// <returns>返回受影响的行数。</returns>
|
||||
public virtual async Task<int> DeleteByIdsAsync(List<int> ids)
|
||||
{
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
var result = await _dbContext.GetInstance().Deleteable<TEntity>()
|
||||
.In(ids)
|
||||
.ExecuteCommandAsync();
|
||||
stopwatch.Stop();
|
||||
_logger.LogInformation($"DeleteByIds {typeof(TEntity).Name}, Count: {ids.Count}, 耗时:{stopwatch.ElapsedMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据指定条件获取单个实体。
|
||||
/// </summary>
|
||||
/// <param name="expression">查询条件的 Lambda 表达式。</param>
|
||||
/// <returns>返回满足条件的第一个实体,如果未找到则返回 null。</returns>
|
||||
public virtual async Task<TEntity> GetByConditionAsync(Expression<Func<TEntity, bool>> expression)
|
||||
{
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
var entity = await _dbContext.GetInstance().Queryable<TEntity>()
|
||||
.FirstAsync(expression);
|
||||
stopwatch.Stop();
|
||||
_logger.LogInformation($"GetByCondition {typeof(TEntity).Name}耗时:{stopwatch.ElapsedMilliseconds}ms");
|
||||
return entity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步判断是否存在满足条件的实体。
|
||||
@@ -264,4 +237,21 @@ public abstract class BaseRepository<TEntity>
|
||||
|
||||
return retrunEntities;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据主键 ID 列表批量删除实体。
|
||||
/// </summary>
|
||||
/// <param name="ids">要删除的实体主键 ID 列表。</param>
|
||||
/// <returns>返回受影响的行数。</returns>
|
||||
public virtual async Task<int> DeleteByIdsAsync(List<int> ids)
|
||||
{
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
var result = await _dbContext.GetInstance().Deleteable<TEntity>()
|
||||
.In(ids)
|
||||
.ExecuteCommandAsync();
|
||||
stopwatch.Stop();
|
||||
_logger.LogInformation($"DeleteByIds {typeof(TEntity).Name}, Count: {ids.Count}, 耗时:{stopwatch.ElapsedMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class DeviceRepository : BaseRepository<DbDevice>, IDeviceRepository
|
||||
/// </summary>
|
||||
/// <param name="model">要删除的设备实体。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(Core.Models.Device model) => await base.DeleteAsync(_mapper.Map<DbDevice>(model));
|
||||
public async Task<int> DeleteAsync(Core.Models.Device model) => await base.DeleteAsync(new List<DbDevice> { _mapper.Map<DbDevice>(model) });
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据ID删除设备。
|
||||
@@ -91,6 +91,8 @@ public class DeviceRepository : BaseRepository<DbDevice>, IDeviceRepository
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 异步获取指定数量的设备。
|
||||
/// </summary>
|
||||
@@ -109,4 +111,15 @@ public class DeviceRepository : BaseRepository<DbDevice>, IDeviceRepository
|
||||
var addedEntities = await base.AddBatchAsync(dbEntities);
|
||||
return _mapper.Map<List<Device>>(addedEntities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除设备。
|
||||
/// </summary>
|
||||
/// <param name="entities">要删除的设备实体列表。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(List<Device> entities)
|
||||
{
|
||||
var dbEntities = _mapper.Map<List<DbDevice>>(entities);
|
||||
return await base.DeleteAsync(dbEntities);
|
||||
}
|
||||
}
|
||||
@@ -160,5 +160,15 @@ namespace DMS.Infrastructure.Repositories
|
||||
|
||||
return _mapper.Map<List<EmailAccount>>(insertedEntities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除实体。
|
||||
/// </summary>
|
||||
public async Task<int> DeleteAsync(List<EmailAccount> entities)
|
||||
{
|
||||
var dbEntities = _mapper.Map<List<DbEmailAccount>>(entities);
|
||||
return await Db.Deleteable<DbEmailAccount>(dbEntities)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,5 +160,15 @@ namespace DMS.Infrastructure.Repositories
|
||||
|
||||
return _mapper.Map<List<EmailLog>>(dbEntities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除实体。
|
||||
/// </summary>
|
||||
public async Task<int> DeleteAsync(List<EmailLog> entities)
|
||||
{
|
||||
var dbEntities = _mapper.Map<List<DbEmailLog>>(entities);
|
||||
return await Db.Deleteable<DbEmailLog>(dbEntities)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,5 +160,15 @@ namespace DMS.Infrastructure.Repositories
|
||||
|
||||
return _mapper.Map<List<EmailMessage>>(dbEntities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除实体。
|
||||
/// </summary>
|
||||
public async Task<int> DeleteAsync(List<EmailMessage> entities)
|
||||
{
|
||||
var dbEntities = _mapper.Map<List<DbEmailMessage>>(entities);
|
||||
return await Db.Deleteable<DbEmailMessage>(dbEntities)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,5 +160,15 @@ namespace DMS.Infrastructure.Repositories
|
||||
|
||||
return _mapper.Map<List<EmailTemplate>>(dbEntities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除实体。
|
||||
/// </summary>
|
||||
public async Task<int> DeleteAsync(List<EmailTemplate> entities)
|
||||
{
|
||||
var dbEntities = _mapper.Map<List<DbEmailTemplate>>(entities);
|
||||
return await Db.Deleteable<DbEmailTemplate>(dbEntities)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class MenuRepository : BaseRepository<DbMenu>, IMenuRepository
|
||||
/// </summary>
|
||||
/// <param name="entity">要删除的菜单实体。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(MenuBean entity) => await base.DeleteAsync(_mapper.Map<DbMenu>(entity));
|
||||
public async Task<int> DeleteAsync(MenuBean entity) => await base.DeleteAsync(new List<DbMenu> { _mapper.Map<DbMenu>(entity) });
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据ID删除菜单。
|
||||
@@ -178,4 +178,15 @@ public class MenuRepository : BaseRepository<DbMenu>, IMenuRepository
|
||||
var addedEntities = await base.AddBatchAsync(dbEntities);
|
||||
return _mapper.Map<List<MenuBean>>(addedEntities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除菜单。
|
||||
/// </summary>
|
||||
/// <param name="entities">要删除的菜单实体列表。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(List<MenuBean> entities)
|
||||
{
|
||||
var dbEntities = _mapper.Map<List<DbMenu>>(entities);
|
||||
return await base.DeleteAsync(dbEntities);
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class MqttAliasRepository : BaseRepository<DbMqttAlias>, IMqttAliasReposi
|
||||
/// </summary>
|
||||
/// <param name="entity">要删除的变量与MQTT别名关联实体。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(MqttAlias entity) => await base.DeleteAsync(_mapper.Map<DbMqttAlias>(entity));
|
||||
public async Task<int> DeleteAsync(MqttAlias entity) => await base.DeleteAsync(new List<DbMqttAlias> { _mapper.Map<DbMqttAlias>(entity) });
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据ID删除变量与MQTT别名关联。
|
||||
@@ -111,4 +111,15 @@ public class MqttAliasRepository : BaseRepository<DbMqttAlias>, IMqttAliasReposi
|
||||
var addedEntities = await base.AddBatchAsync(dbEntities);
|
||||
return _mapper.Map<List<MqttAlias>>(addedEntities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除变量与MQTT别名关联。
|
||||
/// </summary>
|
||||
/// <param name="entities">要删除的变量与MQTT别名关联实体列表。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(List<MqttAlias> entities)
|
||||
{
|
||||
var dbEntities = _mapper.Map<List<DbMqttAlias>>(entities);
|
||||
return await base.DeleteAsync(dbEntities);
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class MqttServerRepository : BaseRepository<DbMqttServer>, IMqttServerRep
|
||||
/// </summary>
|
||||
/// <param name="entity">要删除的MQTT服务器实体。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(MqttServer entity) => await base.DeleteAsync(_mapper.Map<DbMqttServer>(entity));
|
||||
public async Task<int> DeleteAsync(MqttServer entity) => await base.DeleteAsync(new List<DbMqttServer> { _mapper.Map<DbMqttServer>(entity) });
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据ID删除MQTT服务器。
|
||||
@@ -108,4 +108,15 @@ public class MqttServerRepository : BaseRepository<DbMqttServer>, IMqttServerRep
|
||||
var addedEntities = await base.AddBatchAsync(dbEntities);
|
||||
return _mapper.Map<List<MqttServer>>(addedEntities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除MQTT服务器。
|
||||
/// </summary>
|
||||
/// <param name="entities">要删除的MQTT服务器实体列表。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(List<MqttServer> entities)
|
||||
{
|
||||
var dbEntities = _mapper.Map<List<DbMqttServer>>(entities);
|
||||
return await base.DeleteAsync(dbEntities);
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class NlogRepository : BaseRepository<DbNlog>, INlogRepository
|
||||
public new async Task<int> DeleteAsync(Core.Models.Nlog entity)
|
||||
{
|
||||
var dbEntity = _mapper.Map<DbNlog>(entity);
|
||||
return await base.DeleteAsync(dbEntity);
|
||||
return await base.DeleteAsync(new List<DbNlog> { dbEntity });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -136,4 +136,15 @@ public class NlogRepository : BaseRepository<DbNlog>, INlogRepository
|
||||
var addedEntities = await base.AddBatchAsync(dbEntities);
|
||||
return _mapper.Map<List<Core.Models.Nlog>>(addedEntities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除Nlog日志条目。
|
||||
/// </summary>
|
||||
/// <param name="entities">要删除的Nlog日志实体列表。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public new async Task<int> DeleteAsync(List<Core.Models.Nlog> entities)
|
||||
{
|
||||
var dbEntities = _mapper.Map<List<DbNlog>>(entities);
|
||||
return await base.DeleteAsync(dbEntities);
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,7 @@ namespace DMS.Infrastructure.Repositories
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(Trigger entity)
|
||||
{
|
||||
return await base.DeleteAsync(_mapper.Map<DbTrigger>(entity));
|
||||
return await base.DeleteAsync(new List<DbTrigger> { _mapper.Map<DbTrigger>(entity) });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -118,5 +118,16 @@ namespace DMS.Infrastructure.Repositories
|
||||
var addedEntities = await base.AddBatchAsync(dbEntities);
|
||||
return _mapper.Map<List<Trigger>>(addedEntities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除触发器定义。
|
||||
/// </summary>
|
||||
/// <param name="entities">要删除的触发器定义实体列表。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(List<Trigger> entities)
|
||||
{
|
||||
var dbEntities = _mapper.Map<List<DbTrigger>>(entities);
|
||||
return await base.DeleteAsync(dbEntities);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class TriggerVariableRepository : BaseRepository<DbTriggerVariable>, ITri
|
||||
/// </summary>
|
||||
/// <param name="entity">要删除的触发器与变量关联实体。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(TriggerVariable entity) => await base.DeleteAsync(_mapper.Map<DbTriggerVariable>(entity));
|
||||
public async Task<int> DeleteAsync(TriggerVariable entity) => await base.DeleteAsync(new List<DbTriggerVariable> { _mapper.Map<DbTriggerVariable>(entity) });
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据ID删除触发器与变量关联。
|
||||
@@ -110,4 +110,15 @@ public class TriggerVariableRepository : BaseRepository<DbTriggerVariable>, ITri
|
||||
var addedEntities = await base.AddBatchAsync(dbEntities);
|
||||
return _mapper.Map<List<TriggerVariable>>(addedEntities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除触发器与变量关联。
|
||||
/// </summary>
|
||||
/// <param name="entities">要删除的触发器与变量关联实体列表。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(List<TriggerVariable> entities)
|
||||
{
|
||||
var dbEntities = _mapper.Map<List<DbTriggerVariable>>(entities);
|
||||
return await base.DeleteAsync(dbEntities);
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class UserRepository : BaseRepository<DbUser>, IUserRepository
|
||||
/// </summary>
|
||||
/// <param name="entity">要删除的用户实体。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(User entity) => await base.DeleteAsync(_mapper.Map<DbUser>(entity));
|
||||
public async Task<int> DeleteAsync(User entity) => await base.DeleteAsync(new List<DbUser> { _mapper.Map<DbUser>(entity) });
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据ID删除用户。
|
||||
@@ -111,4 +111,15 @@ public class UserRepository : BaseRepository<DbUser>, IUserRepository
|
||||
var addedEntities = await base.AddBatchAsync(dbEntities);
|
||||
return _mapper.Map<List<User>>(addedEntities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除用户。
|
||||
/// </summary>
|
||||
/// <param name="entities">要删除的用户实体列表。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(List<User> entities)
|
||||
{
|
||||
var dbEntities = _mapper.Map<List<DbUser>>(entities);
|
||||
return await base.DeleteAsync(dbEntities);
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class VariableHistoryRepository : BaseRepository<DbVariableHistory>, IVar
|
||||
/// </summary>
|
||||
/// <param name="entity">要删除的变量历史实体。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(VariableHistory entity) => await base.DeleteAsync(_mapper.Map<DbVariableHistory>(entity));
|
||||
public async Task<int> DeleteAsync(VariableHistory entity) => await base.DeleteAsync(new List<DbVariableHistory> { _mapper.Map<DbVariableHistory>(entity) });
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据ID删除变量历史记录。
|
||||
@@ -184,4 +184,15 @@ public class VariableHistoryRepository : BaseRepository<DbVariableHistory>, IVar
|
||||
var dbList = await query.ToListAsync();
|
||||
return _mapper.Map<List<VariableHistory>>(dbList);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除变量历史记录。
|
||||
/// </summary>
|
||||
/// <param name="entities">要删除的变量历史实体列表。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(List<VariableHistory> entities)
|
||||
{
|
||||
var dbEntities = _mapper.Map<List<DbVariableHistory>>(entities);
|
||||
return await base.DeleteAsync(dbEntities);
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class VariableRepository : BaseRepository<DbVariable>, IVariableRepositor
|
||||
/// </summary>
|
||||
/// <param name="entity">要删除的变量实体。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(Variable entity) => await base.DeleteAsync(_mapper.Map<DbVariable>(entity));
|
||||
public async Task<int> DeleteAsync(Variable entity) => await base.DeleteAsync(new List<DbVariable> { _mapper.Map<DbVariable>(entity) });
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -186,4 +186,15 @@ public class VariableRepository : BaseRepository<DbVariable>, IVariableRepositor
|
||||
_logger.LogInformation($"Batch update {typeof(DbVariable)}, Count={dbVariables.Count}, 耗时:{stopwatch.ElapsedMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除变量。
|
||||
/// </summary>
|
||||
/// <param name="entities">要删除的变量实体列表。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(List<Variable> entities)
|
||||
{
|
||||
var dbEntities = _mapper.Map<List<DbVariable>>(entities);
|
||||
return await base.DeleteAsync(dbEntities);
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class VariableTableRepository : BaseRepository<DbVariableTable>, IVariabl
|
||||
//删除变量表中的所有变量
|
||||
await _variableRepository.DeleteByVariableTableIdAsync(entity.Id);
|
||||
//删除变量表
|
||||
return await base.DeleteAsync(_mapper.Map<DbVariableTable>(entity));
|
||||
return await base.DeleteAsync(new List<DbVariableTable> { _mapper.Map<DbVariableTable>(entity) });
|
||||
}
|
||||
|
||||
|
||||
@@ -158,4 +158,15 @@ public class VariableTableRepository : BaseRepository<DbVariableTable>, IVariabl
|
||||
_logger.LogInformation($"Delete VariableTable by DeviceId={deviceId}, 耗时:{stopwatch.ElapsedMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异步根据实体列表批量删除变量表。
|
||||
/// </summary>
|
||||
/// <param name="entities">要删除的变量表实体列表。</param>
|
||||
/// <returns>受影响的行数。</returns>
|
||||
public async Task<int> DeleteAsync(List<VariableTable> entities)
|
||||
{
|
||||
var dbEntities = _mapper.Map<List<DbVariableTable>>(entities);
|
||||
return await base.DeleteAsync(dbEntities);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user