public without sharing class Morethan7daysController { // 订单 ID private String orderId = ''; public List MorethansevendaysIifo { get; set; } public String type { get; set; } public Morethan7daysController() { orderId = ApexPages.currentPage().getParameters().get('Id'); MorethansevendaysIifo = new List(); type = ApexPages.currentPage().getParameters().get('type'); } // 画面初始化 public void init() { List Morethan7daysList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c WHERE Consumable_order_minor__c != null AND Dealer_Shipment__c = false AND Dealer_Arrive__c = false AND Dealer_Saled__c = false AND Consumable_order_minor__r.showFalseNotshowTrue__c = false AND Deliver_date__c < LAST_N_DAYS:7 AND Consumable_order_minor__c = :orderId GROUP BY Asset_Model_No__c]; for(Integer i = 0 ; i< Morethan7daysList.size() ; i++){ MorethansevendaysIifo.add(new showRecords(Morethan7daysList[i])); } } // Data Bean class showRecords implements Comparable { public Decimal recordCount { get; set; } public String prodModel { get; set; } public showRecords(AggregateResult e) { recordCount =Integer.valueOf(e.get('recordCount')); prodModel = String.valueOf(e.get('prodModel')); } //排序 public Integer compareTo(Object compareTo) { return null; } } }