From 8207f5a65e01d9f713bf2cb5ced36f288d302ad2 Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Wed, 25 Oct 2023 00:41:52 +0800 Subject: [PATCH] 1 --- .../Sync/StoreHouseSyncBusiness.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/BBWY.Server.Business/Sync/StoreHouseSyncBusiness.cs b/BBWY.Server.Business/Sync/StoreHouseSyncBusiness.cs index f8db1684..a33a7c0d 100644 --- a/BBWY.Server.Business/Sync/StoreHouseSyncBusiness.cs +++ b/BBWY.Server.Business/Sync/StoreHouseSyncBusiness.cs @@ -78,19 +78,19 @@ namespace BBWY.Server.Business.Sync } } - //var storeHouseIds = storeHouseList.Select(s => s.Id).ToArray(); - //var dbStoreIds = fsql.Select(storeHouseIds).ToList(s => s.Id); - //var exceptIds = storeHouseIds.Except(dbStoreIds); - //if (exceptIds.Count() > 0) - //{ - // var insertList = storeHouseList.Where(s => exceptIds.Contains(s.Id)).ToList(); - // fsql.Insert(insertList).ExecuteAffrows(); - //} - fsql.Transaction(() => + var storeHouseIds = storeHouseList.Select(s => s.Id).ToArray(); + var dbStoreIds = fsql.Select(storeHouseIds).ToList(s => s.Id); + var exceptIds = storeHouseIds.Except(dbStoreIds); + if (exceptIds.Count() > 0) { - fsql.Delete().Where(s => 1 == 1).ExecuteAffrows(); - fsql.Insert(storeHouseList).ExecuteAffrows(); - }); + var insertList = storeHouseList.Where(s => exceptIds.Contains(s.Id)).ToList(); + fsql.Insert(insertList).ExecuteAffrows(); + } + //fsql.Transaction(() => + //{ + // fsql.Delete().Where(s => 1 == 1).ExecuteAffrows(); + // fsql.Insert(storeHouseList).ExecuteAffrows(); + //}); }