Browse Source

Merge branch 'master' of http://code.qiyue666.com/pengcong001/bbwy

AddValidOverTime
sanji 2 years ago
parent
commit
7a9ddc9e87
  1. 24
      BBWY.Server.Business/Sync/StoreHouseSyncBusiness.cs

24
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<Storehouse>(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<Storehouse>(storeHouseIds).ToList(s => s.Id);
var exceptIds = storeHouseIds.Except(dbStoreIds);
if (exceptIds.Count() > 0)
{
fsql.Delete<Storehouse>().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<Storehouse>().Where(s => 1 == 1).ExecuteAffrows();
// fsql.Insert(storeHouseList).ExecuteAffrows();
//});
}

Loading…
Cancel
Save