From 6fd758e19542fe3879ac182ce30c0cd39af87237 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期三, 18 十二月 2024 15:06:01 +0800
Subject: [PATCH] 11
---
MES.Service/service/BasicData/SysDepartmentManager.cs | 18 ++++--------------
1 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/MES.Service/service/BasicData/SysDepartmentManager.cs b/MES.Service/service/BasicData/SysDepartmentManager.cs
index 81d2e93..ca70322 100644
--- a/MES.Service/service/BasicData/SysDepartmentManager.cs
+++ b/MES.Service/service/BasicData/SysDepartmentManager.cs
@@ -27,14 +27,11 @@
if (UpdateDepartmentStatus(db, entity.Id, "B")) // 绂佺敤閮ㄩ棬
return 1;
break;
- case "2":
- if (InsertDepartment(db, entity)) // 鎻掑叆鏂伴儴闂�
- return 1;
- break;
case "3":
if (DeleteDepartment(db, entity.Id)) // 鍒犻櫎閮ㄩ棬
return 1;
break;
+ case "2":
case "4":
if (InsertOrUpdateDepartment(db, entity)) // 鎻掑叆鎴栨洿鏂伴儴闂�
return 1;
@@ -146,16 +143,12 @@
departmentGroup.Value, "B")) // 鎵归噺绂佺敤閮ㄩ棬
throw new NotImplementedException("绂佺敤澶辫触");
break;
- case "2":
- if (!InsertDepartmentBatch(db,
- departmentGroup.Value)) // 鎵归噺鎻掑叆閮ㄩ棬
- throw new NotImplementedException("鎻掑叆澶辫触");
- break;
case "3":
if (!DeleteDepartmentBatch(db,
departmentGroup.Value)) // 鎵归噺鍒犻櫎閮ㄩ棬
throw new NotImplementedException("鍒犻櫎澶辫触");
break;
+ case "2":
case "4":
if (!InsertOrUpdateDepartmentBatch(db,
departmentGroup.Value)) // 鎵归噺鎻掑叆鎴栨洿鏂伴儴闂�
@@ -215,10 +208,7 @@
private bool InsertOrUpdateDepartmentBatch(SqlSugarScope db,
List<SysDepartment> departmentList)
{
- foreach (var entity in departmentList)
- if (!InsertOrUpdateDepartment(db, entity))
- return false;
-
- return true;
+ return departmentList.All(
+ entity => InsertOrUpdateDepartment(db, entity));
}
}
\ No newline at end of file
--
Gitblit v1.9.3