当前位置: 首页 > 工具软件 > o2grid > 使用案例 >

ZK grid or list数据多列排序

董飞航
2023-12-01
//按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);

 类似资料: