List<EcBWaterEngExport> listAll = ecBaseInfoService.manageEngExport(param);
Workbook workbook = null;
Date start = new Date();
ExportParams params = new ExportParams("取水工程导出", "取水工程");
int talpage=(listAll.size()/10000)+1;
workbook = ExcelExportUtil.exportBigExcel(params, EcBWaterEngExport.class, new IExcelExportServer() {
@Override
public List<Object> selectListForExcelExport(Object obj, int page) {
if (((int) obj) == page) {
return null;
}
int start=-1;
if (page==1){
start=0;
}
else {
start=(page-1)*10000;
}
List<Object> list = new ArrayList<Object>();
for (int i = start; i < (start+10000); i++) {
if(i<listAll.size()) {
EcBWaterEngExport client = new EcBWaterEngExport();
client.setLocZoneName(listAll.get(i).getLocZoneName());
client.setLocZone2Name(listAll.get(i).getLocZone2Name());
client.setLocZone1Name(listAll.get(i).getLocZone1Name());
client.setWatEngName(listAll.get(i).getWatEngName());
client.setStatisAmnt(listAll.get(i).getStatisAmnt());
client.setWatEngType(listAll.get(i).getWatEngType());
client.setLocLngi(listAll.get(i).getLocLngi());
client.setWatSouType(listAll.get(i).getWatSouType());
client.setLocLati(listAll.get(i).getLocLati());
client.setIntLocationFull(listAll.get(i).getIntLocationFull());
list.add(client);
} else{
break;
}
}
return list;
}
}, talpage);
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition",
"attachment;filename=" + URLEncoder.encode("fileName", "UTF-8") + ".xlsx");
ServletOutputStream out = response.getOutputStream();
workbook.write(out);
out.close();
easypoi 百万数据导出
最新推荐文章于 2024-04-03 10:09:07 发布