java 删除所有未绑定的联系人

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java 删除所有未绑定的联系人相关的知识,希望对你有一定的参考价值。

List<Contact> cont = new List<Contact>();
Map<String, inscor__Customer_Quote__c> cqMap = new Map<String, inscor__Customer_Quote__c>();
Map<String, inscor__Sales_Order__c> soMap = new Map<String, inscor__Sales_Order__c>();
Map<String, inscor__RFQ__c> rfqMap = new Map<String, inscor__RFQ__c>();
Map<String, inscor__Purchase_Order__c> poMap = new Map<String, inscor__Purchase_Order__c>();
Map<String, inscor__Repair_Order__c> roMap = new Map<String, inscor__Repair_Order__c>();
for (inscor__Customer_Quote__c cq : [SELECT Id, inscor__Contact__c FROM inscor__Customer_Quote__c]) {
    cqMap.put(cq.inscor__Contact__c, cq);
}

for (inscor__Sales_Order__c so : [SELECT Id, inscor__Contact__c FROM inscor__Sales_Order__c]) {
    soMap.put(so.inscor__Contact__c, so);
}
 
for (inscor__RFQ__c rfq : [SELECT Id, inscor__Contact__c FROM inscor__RFQ__c]) {
    rfqMap.put(rfq.inscor__Contact__c, rfq);
}
 
for (inscor__Purchase_Order__c po : [SELECT Id, inscor__Contact__c FROM inscor__Purchase_Order__c]) {
    poMap.put(po.inscor__Contact__c, po);
}
 
for (inscor__Repair_Order__c ro : [SELECT Id, inscor__Contact__c FROM inscor__Repair_Order__c]) {
    roMap.put(ro.inscor__Contact__c, ro);
}
 
for (Contact c : [SELECT Id FROM Contact WHERE inscor__External_Reference_ID__c = null]) {
    if (!cqMap.containsKey(c.Id) && !soMap.containsKey(c.Id) && !rfqMap.containsKey(c.Id) &&
        !poMap.containsKey(c.Id) && !roMap.containsKey(c.Id)) {
        cont.add(c);
    }
}
 
delete cont;

以上是关于java 删除所有未绑定的联系人的主要内容,如果未能解决你的问题,请参考以下文章

java 删除所有未绑定的帐户

未生成 Java 绑定抽象类

循环没有捕获重复项并在 Android(Java) 中删除它们

从 wordpress 中删除未使用的样式

React Native Swipeable(滑动删除)未关闭

有没有办法在 SwiftUI 中“取消绑定”变量/对象