java 删除所有未绑定的帐户

Posted

tags:

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

List<Account> acct = new List<Account>();
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>();
Map<String, inscor__Inventory_Line__c> invMap = new Map<String, inscor__Inventory_Line__c>();

for (inscor__Customer_Quote__c cq : [SELECT Id, inscor__Customer__c FROM inscor__Customer_Quote__c]) {
    cqMap.put(cq.inscor__Customer__c, cq);
}

for (inscor__Sales_Order__c so : [SELECT Id, inscor__Customer__c FROM inscor__Sales_Order__c]) {
    soMap.put(so.inscor__Customer__c, so);
}

for (inscor__RFQ__c rfq : [SELECT Id, inscor__Vendor__c FROM inscor__RFQ__c]) {
    rfqMap.put(rfq.inscor__Vendor__c, rfq);
}

for (inscor__Purchase_Order__c po : [SELECT Id, inscor__Vendor__c FROM inscor__Purchase_Order__c]) {
    poMap.put(po.inscor__Vendor__c, po);
}

for (inscor__Repair_Order__c ro : [SELECT Id, inscor__Vendor__c FROM inscor__Repair_Order__c]) {
    roMap.put(ro.inscor__Vendor__c, ro);
}

for (inscor__Inventory_Line__c inv : [SELECT Id, inscor__Tag_Agency__c, inscor__Tag_Agency_2__c,
                                      inscor__Source__c, inscor__Source_2__c
                                      FROM inscor__Inventory_Line__c]) {
    invMap.put(inv.inscor__Tag_Agency__c, inv);
    invMap.put(inv.inscor__Tag_Agency_2__c, inv);
    invMap.put(inv.inscor__Source__c, inv);
    invMap.put(inv.inscor__Source_2__c, inv);
}

for (Account a : [SELECT Id,Name FROM Account WHERE inscor__External_Reference_ID__c = null]) {

    if (!cqMap.containsKey(a.Id) && !soMap.containsKey(a.Id) && !rfqMap.containsKey(a.Id) &&
        !poMap.containsKey(a.Id) && !roMap.containsKey(a.Id) && !invMap.containsKey(a.Id)) {
        System.debug(LoggingLevel.ERROR, a.Name);
        acct.add(a);
    }
}

delete acct;

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

如何从帐户中删除 IOS 团队配置文件?

如何从 Google Play 控制台帐户中删除未发布的 apk

XMPPFramework - 删除注册用户帐户时出现“未授权”错误

未生成 Java 绑定抽象类

iOS 非消耗性购买是不是与使用帐户或设备绑定?

java 删除没有外部标识但未分配给报价的所有联系人