refactor:删除不必要的方法

This commit is contained in:
2025-10-21 13:01:27 +08:00
parent 6872631933
commit 3116e4ce92
27 changed files with 105 additions and 608 deletions

View File

@@ -73,37 +73,8 @@ 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(new List<DbDevice> { _mapper.Map<DbDevice>(model) });
public async Task<int> DeleteAsync(Device model) => await base.DeleteAsync(new List<DbDevice> { _mapper.Map<DbDevice>(model) });
/// <summary>
/// 异步根据ID删除设备。
/// </summary>
/// <param name="id">要删除设备的唯一标识符。</param>
/// <returns>受影响的行数。</returns>
public async Task<int> DeleteByIdAsync(int id)
{
var stopwatch = new Stopwatch();
stopwatch.Start();
var result = await _dbContext.GetInstance().Deleteable(new DbDevice() { Id = id })
.ExecuteCommandAsync();
stopwatch.Stop();
_logger.LogInformation($"Delete {typeof(DbDevice)},ID={id},耗时:{stopwatch.ElapsedMilliseconds}ms");
return result;
}
/// <summary>
/// 异步获取指定数量的设备。
/// </summary>
/// <param name="number">要获取的设备数量。</param>
/// <returns>包含指定数量设备实体的列表。</returns>
public new async Task<List<Core.Models.Device>> TakeAsync(int number)
{
var dbList = await base.TakeAsync(number);
return _mapper.Map<List<Core.Models.Device>>(dbList);
}
public async Task<List<Device>> AddBatchAsync(List<Device> entities)
{