fix 处理数据写入索引约束问题

This commit is contained in:
2024-04-15 18:03:30 +08:00
parent 6695ad5100
commit 8443dd7446

View File

@@ -237,7 +237,10 @@ public class GainfoUpdateService : IGainfoUpdateService
} }
else else
{ {
await _dbContext.Client.Insertable(info).AS("GainfoLeave").ExecuteCommandAsync(); if (!await _dbContext.Queryable<GainfoLeaveEntity>().AnyAsync(x => x.Code == item.ename))
{
await _dbContext.Client.Insertable(info).AS("GainfoLeave").ExecuteCommandAsync();
}
return null; return null;
} }
} }
@@ -371,7 +374,10 @@ public class GainfoUpdateService : IGainfoUpdateService
else else
{ {
var info = GainfoSapToGainfo(item); var info = GainfoSapToGainfo(item);
await _dbContext.Client.Insertable(info).AS("GainfoLeave").ExecuteCommandAsync(); if (!await _dbContext.Queryable<GainfoLeaveEntity>().AnyAsync(x => x.Code == item.ename))
{
await _dbContext.Client.Insertable(info).AS("GainfoLeave").ExecuteCommandAsync();
}
} }
} }