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:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user