/** * 导出当前列表的数据(EXCEL、PDF、CSV) 如果须要导出其它数据,只须将数据集和导出的列做一定量调整及可 * * @throws ActionException */ @SuppressWarnings("deprecation") public String report() throws Exception { jxInInventoryModels = jxInInventoryService.getCollection(jxInInventoryModel); TableFacade tableFacade = new TableFacade("jxInInventoryModel", request); tableFacade.setExportTypes(response, ExportType.EXCEL, ExportType.PDF, ExportType.CSV); String[] columns = { "jiCode", "jiLastCode", "jiOcode", "jiCodemark", "jiDept", "jiSupplier", "jiUser", "jiDate", "jiCheckuser", "jiWarehouse", "jiRemark", }; tableFacade.setColumnProperties(columns); tableFacade.setItems(jxInInventoryModels); Limit limit = tableFacade.getLimit(); if (limit.isExported()) { tableFacade.render(); } return NONE; }
/** * 导出当前列表的数据(EXCEL、PDF、CSV) 如果须要导出其它数据,只须将数据集和导出的列做一定量调整及可 * * @throws ActionException */ @SuppressWarnings("deprecation") public String report() throws Exception { jxUnitModels = jxUnitService.getCollection(jxUnitModel); TableFacade tableFacade = new TableFacade("jxUnitModel", request); tableFacade.setExportTypes(response, ExportType.EXCEL, ExportType.PDF, ExportType.CSV); String[] columns = { "juCode", "juName", "juMemo", }; tableFacade.setColumnProperties(columns); tableFacade.setItems(jxUnitModels); Limit limit = tableFacade.getLimit(); if (limit.isExported()) { tableFacade.render(); } return NONE; }
@SuppressWarnings("unchecked") public Collection<?> sortItems(Collection<?> items, Limit limit) { ComparatorChain chain = new ComparatorChain(); SortSet sortSet = limit.getSortSet(); for (Sort sort : sortSet.getSorts()) { if (sort.getOrder() == Order.ASC) { chain.addComparator(new BeanComparator(sort.getProperty(), new NullComparator())); } else if (sort.getOrder() == Order.DESC) { chain.addComparator(new BeanComparator(sort.getProperty(), new NullComparator()), true); } } if (chain.size() > 0) { Collections.sort((List<?>) items, chain); } return items; }