public without sharing class ConsumableNotArrDetController { // 订单 ID private String orderId = ''; public List notArrDetIifo { get; set; } public ConsumableNotArrDetController() { orderId = ApexPages.currentPage().getParameters().get('Id'); notArrDetIifo = new List(); } // 画面初始化 public void init() { List notArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId GROUP BY Asset_Model_No__c]; for(Integer i = 0 ; i< notArrDetList.size();i++){ notArrDetIifo.add(new showRecords(notArrDetList[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; } } }