From cdb8ca3f97ded53176a7b5a967932335ea0ac6e1 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期三, 23 十月 2024 16:26:02 +0800 Subject: [PATCH] 1 --- MES.Service/service/BasicData/MesDepotsManager.cs | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-) diff --git a/MES.Service/service/BasicData/MesDepotsManager.cs b/MES.Service/service/BasicData/MesDepotsManager.cs index f1c7591..c0ba2db 100644 --- a/MES.Service/service/BasicData/MesDepotsManager.cs +++ b/MES.Service/service/BasicData/MesDepotsManager.cs @@ -71,8 +71,8 @@ // 鍒犻櫎浠撳簱鐨勬柟娉� private bool DeleteDepot(SqlSugarScope db, decimal depotId) { - var deleteById = db.Deleteable<MesDepots>().In(depotId) - .ExecuteCommand(); + var deleteById = db.Deleteable<MesDepots>() + .Where(s => s.DepotId == depotId).ExecuteCommand(); if (deleteById > 0) return true; @@ -195,7 +195,8 @@ { var ids = depotList.Select(it => it.DepotId).ToArray(); var deleteByIds = - db.Deleteable<MesDepots>().In(ids).ExecuteCommand(); + db.Deleteable<MesDepots>() + .Where(s => ids.Contains(s.DepotId)).ExecuteCommand(); if (deleteByIds > 0) return true; @@ -206,10 +207,6 @@ private bool InsertOrUpdateBatch(SqlSugarScope db, List<MesDepots> depotList) { - foreach (var entity in depotList) - if (!InsertOrUpdate(db, entity)) - return false; - - return true; + return depotList.All(entity => InsertOrUpdate(db, entity)); } } \ No newline at end of file -- Gitblit v1.9.3