global without sharing class ImportDocTController { public List testList{get; set;} public List initList{get; set;} public List newinitList{get; set;} public Map testMap{get; set;} public List> mapList{get; set;} public List strList{get; set;} public ImportDocTController() { testList = [SELECT Id, Name , code__c from ImportDocT__c]; testList = new List(); initList = new List(); newinitList = new List(); } public void init(){ testMap = new Map(); testList = [SELECT Id, Name , code__c , Num__c from ImportDocT__c order by code__c desc]; // for (ImportDocT__c nObj : testList) { // if (testMap==null) { // testMap.put(nObj.code__c, nObj); // }else{ // testMap.put(nObj.code__c, nObj); // } // if (testMap.size() > 0) { // mapList.add(testMap); // } // } // for (ImportDocT__c mObj : testMap) { // strList.add(testMap.get(mObj.code__c).size()); // } Integer n = 0; // 初始化合并行数 for (Integer i=0;i=0 ; i--) { testInit init = new testInit(); init = initList[i]; newinitList.add(init); } } // 定义内部类,自定义参数 class testInit{ public Boolean check{get; set;} public String Name{get; set;} public String code{get; set;} public Decimal Num{get; set;} public String Id{get; set;} public Integer count{get; set;} } }