public with sharing class RepairQuoteTrigger { public static void ChangeRepair(List newList, Map newMap, List oldList, Map oldMap) { System.debug('===========> start'); List rqIds = new List(); Map RqMap = new Map(); if (Trigger.isUpdate) { Boolean flag = false; for(Repair_Quotation__c rq : newList){ if(Trigger.isUpdate && rq.ListPrice__c != oldMap.get(rq.id).ListPrice__c){ //rqIds.add(rq.id); flag = true; } } if(flag == false){ return; } for(Repair_Quotation__c rq : newList){ if(Trigger.isUpdate && rq.ListPrice__c != oldMap.get(rq.id).ListPrice__c){ rqIds.add(rq.id); RqMap.put(rq.id, rq); } } }else if(Trigger.isInsert){ for(Repair_Quotation__c rq : newList){ rqIds.add(rq.id); RqMap.put(rq.id, rq); } } List RepairUpdateList = new List(); if(rqIds.size() > 0){ //修理的同期中的修理报价de报价金额改变的修理 List RpList = [select id,Repair_Quotation_Id__c from Repair__c where Repair_Quotation_Id__c in :rqIds]; if(RpList.size() > 0){ for(Repair__c rp : RpList){ Repair_Quotation__c Rqa = RqMap.get(rp.Repair_Quotation_Id__c); rp.Repair_Quotation_Price__c = Rqa.ListPrice__c; RepairUpdateList.add(rp); } update RepairUpdateList; } } System.debug('===========> end'); } }