30 lines
905 B
C#
30 lines
905 B
C#
using Dlhis.Basic.Organization.Request;
|
|
using Dlhis.Entity.Basic.Entity;
|
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
|
using Mapster;
|
|
|
|
namespace Dlhis.Basic.Organization.Services.Implements;
|
|
|
|
public class OldGainfoService : IOldDeviceGainfoService
|
|
{
|
|
private readonly IDbContext _dbContext;
|
|
|
|
public OldGainfoService(IDbContext dbContext)
|
|
{
|
|
_dbContext = dbContext;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public async Task BatchUploadAsync(List<OldDeviceGainfoUploadRequest> requests)
|
|
{
|
|
var entities = requests.Adapt<List<OldDeviceGainfoEntity>>();
|
|
|
|
foreach (var entity in entities)
|
|
{
|
|
if (!await _dbContext.Queryable<OldDeviceGainfoEntity>().AnyAsync(x => x.No == entity.No && x.Code == entity.Code && x.DeviceUniqueNo == entity.DeviceUniqueNo))
|
|
{
|
|
await _dbContext.InsertAsync(entity);
|
|
}
|
|
}
|
|
}
|
|
} |