From 0ac2c8c62a4ba1b92bcae9f11f7f4d9c6f54875b Mon Sep 17 00:00:00 2001
From: 付煜 <fuyu3103346691@163.com>
Date: 星期四, 24 三月 2022 16:22:29 +0800
Subject: [PATCH] 删除关联关系

---
 force-app/main/default/classes/TenderDeleteLwcController.cls |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/force-app/main/default/classes/TenderDeleteLwcController.cls b/force-app/main/default/classes/TenderDeleteLwcController.cls
index f54b859..02acd5a 100644
--- a/force-app/main/default/classes/TenderDeleteLwcController.cls
+++ b/force-app/main/default/classes/TenderDeleteLwcController.cls
@@ -34,25 +34,27 @@
 			// 鍒犻櫎椤圭洰鍏宠仈浣嗕笉涓庝繚鐣欓」鐩叧鑱旂殑璇环鍏宠仈淇℃伅
 			List<Tender_Opportunity_Link__c> linksList = [select id, Opportunity__c, Tender_information__c
 			        from Tender_Opportunity_Link__c
-			        where Tender_information__c = :TenInfo.Id and Opportunity__c
-			                                      not in : BlinkOppId];
+			        where Tender_information__c = :TenInfo.Id ];
+			                                    //  and Opportunity__c not in : BlinkOppId];
 			// 鎶婂垹闄ゆ嫑鎶曟爣 鍏宠仈鐨勮浠� 璧嬬粰 淇濈暀鎷涙姇鏍囦笂
 			List<Tender_Opportunity_Link__c> addlinksList = new List<Tender_Opportunity_Link__c>();
 			// 鍒犻櫎鎷涙姇鏍囧叧鑱旂殑璇环
 			// 澧炲姞涓�涓垽鏂� 鐪嬬湅鏄惁杩樹細鍐欑┖杩涘幓
 			if (linksList != null && linksList.size() > 0) {
 				for (Tender_Opportunity_Link__c link : linksList) {
-					Tender_Opportunity_Link__c linkinfo =  new Tender_Opportunity_Link__c();
-					linkinfo.Tender_information__c = BTen.Id;
-					linkinfo.Opportunity__c = link.Opportunity__c;
-					linkinfo.Tender_Opportunity_Uniq__c = BTen.Id + '' + link.Opportunity__c;
-					linkinfo.IsRelated__c = true;
-					// if (BlinksList.contains(linkinfo)) {
-					addlinksList.add(linkinfo);
-					// }
+					if(!BlinkOppId.contains(link.Opportunity__c)){
+						Tender_Opportunity_Link__c linkinfo =  new Tender_Opportunity_Link__c();
+						linkinfo.Tender_information__c = BTen.Id;
+						linkinfo.Opportunity__c = link.Opportunity__c;
+						linkinfo.Tender_Opportunity_Uniq__c = BTen.Id + '' + link.Opportunity__c;
+						linkinfo.IsRelated__c = true;
+						// if (BlinksList.contains(linkinfo)) {
+						addlinksList.add(linkinfo);
+						// }
+					}
 				}
 				// 鍒犻櫎椤圭洰鍒犳帀鍏宠仈璇环
-				// delete linksList;
+				delete linksList;
 				// 淇濈暀椤圭洰鏂板鍏宠仈璇环
 				if (addlinksList.size() > 0) {
 					insert addlinksList;

--
Gitblit v1.9.1