public without sharing class FixtureSetHandler extends Oly_TriggerHandler {
    private Map<Id, Fixture_Set__c> newMap;
    private Map<Id, Fixture_Set__c> oldMap;
    private List<Fixture_Set__c> newList;
    private List<Fixture_Set__c> oldList;

    public FixtureSetHandler() {
        this.newMap = (Map<Id, Fixture_Set__c>) Trigger.newMap;
        this.oldMap = (Map<Id, Fixture_Set__c>) Trigger.oldMap;
        this.newList = (List<Fixture_Set__c>) Trigger.new;
        this.oldList = (List<Fixture_Set__c>) Trigger.old;
    }

    protected override void beforeInsert() {
        beforeSetValue();
        //add by rentx 20210730 新品收货_集中备品_建立数据逻辑限制 start
        // setSpareuseaccessories();
        //add by rentx 20210730 新品收货_集中备品_建立数据逻辑限制 end
    }
    protected override void beforeUpdate() {
        beforeSetValue();
        //add by rentx 20210730 新品收货_集中备品_建立数据逻辑限制 start
        // setSpareuseaccessories();
        //add by rentx 20210730 新品收货_集中备品_建立数据逻辑限制 end
    }

    private void beforeSetValue() {
        for (Fixture_Set__c nObj : newList) {
            nObj.Loaner_code__c = nObj.Name;
        }
    }

    //add by rentx 20210730 新品收货_集中备品_建立数据逻辑限制 start
    /*private void setSpareuseaccessories(){
        // List<Fixture_Set_Detail__c> detailList = new List<Fixture_Set_Detail__c>();
        List<Fixture_Set_Detail__c> detailList = [select id,Is_Body__c,Fixture_Set__c,Fixture_Model_No_F__c from Fixture_Set_Detail__c where Fixture_Set__c in :newMap.keySet()];
        if (detailList != null && detailList.size() > 0) {
            Map<Id,Map<String,Boolean>> spareMap = new Map<Id,Map<String,Boolean>>();
            for (Fixture_Set_Detail__c detail : detailList) {
                if (!spareMap.containsKey(detail.Fixture_Set__c)) {
                    Map<String,Boolean> tempMap = new Map<String,Boolean>();
                    spareMap.put(detail.Fixture_Set__c, tempMap);
                }
                Map<String,Boolean> tempMap = spareMap.get(detail.Fixture_Set__c);
                tempMap.put(detail.Fixture_Model_No_F__c, detail.Is_Body__c);
                spareMap.put(detail.Fixture_Set__c, tempMap);
            }
            for (Fixture_Set__c nObj : newList) {
                // if (nObj.Spareuseaccessories__c == null) {
                    Map<String,Boolean> tempMap = spareMap.get(nObj.Id);
                    // if (tempMap != null && tempMap.get(nObj.Name) != null) {
                        nObj.Spareuseaccessories__c = tempMap.get(nObj.Name);
                    // }
                // }
            }
        }
        
    }*/
    //add by rentx 20210730 新品收货_集中备品_建立数据逻辑限制 end

}