global class AssetWhereAbout2Batch implements Database.Batchable<sObject> {
    public String query;
    global AssetWhereAbout2Batch() {
        this.query = query;
    }

    global Database.QueryLocator start(Database.BatchableContext bc) {
        ///多年保修未到期且未签约合同的设备
        query = 'select id,AssetWhereabouts__c from Asset where  IS_Extend_Gurantee_Txt__c  = true and Gurantee_End_day1__c <0 and IF_Renewalrate_Target_Asset_F__c= 0  ';
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, list<Asset> assList) {
        Map<String,Asset> assMap = new Map<String,Asset>();
        for (Asset as1:assList) {
            Asset ass =  new Asset();
            ass.id = as1.id;
            ass.AssetWhereabouts__c = '多年保修期内'; 
            
            if (!assMap.containsKey(ass.id)) {
                assMap.put(ass.id,ass);
            }
        }
        if (assMap.values()!=null && assMap.values().size()!= 0) {
            update assMap.values();
        }
        
    }

    global void finish(Database.BatchableContext BC) {
       
    }
}