//按grpID,priority從小到大排序
Comparator TotalOrderMoneyComparator = new Comparator() {
public int compare(Object o1, Object o2) {
PdbMcmCpnoDO co1 = (PdbMcmCpnoDO) o2;
PdbMcmCpnoDO co2 = (PdbMcmCpnoDO) o1;
int flg = -1;
flg = co1.getGrpId().compareTo(co2.getGrpId());
if (flg == 0) {
flg = co1.getPriority().compareTo(co2.getPriority());
}
return flg;
}
};
CompoundComparator cc = new CompoundComparator();
// 添加比较器
cc.addComparator(TotalOrderMoneyComparator, false);
// 实现排序
Collections.sort(allCpnoDOs, cc);