dorado导出excel的一些问题

来源:互联网 发布:java hashcode 源码 编辑:程序博客网 时间:2024/05/19 15:42

dorado的导出excel功能如果设置为server-all模式(导出查询结果的所有数据)时,执行导出功能会在listener里执行一次查询,而如果页面有分页功能的话,导出功能执行的查询会无法识别sql的分页语句,造成导出结果的错误或者数据不全,所以当执行导出功能时在listener里执行一次判断,导出功能执行的查询不进行分页处理,问题解决!

示例代码:

String flag = dataset.parameters().getString("flag");
   GjPgLs gjPgLs = new GjPgLs();
   List infoList = new ArrayList();
   if (flag == null || flag.equals("")) {
    int pageSize = dataset.getPageSize();
    int rowCount = gjEuitySearchService.getGjZkListTotalSize(
      gjPgLs, rqStart, rqEnd, bktype);
    PagingHelper helper = new PagingHelper(pageSize, dataset
      .getPageIndex(), rowCount);

    infoList = gjEuitySearchService
      .getGjZkListByConditions(gjPgLs, rqStart, rqEnd,
        bktype, helper.getFromIndex(), pageSize);
    dataset.setPageCount(helper.getPageCount());
   } else {
    infoList = gjEuitySearchService.getGjZkListByConditions(gjPgLs,
      rqStart, rqEnd, bktype, 0, 0);
   }
   if (null != infoList && !infoList.isEmpty()) {
    dataset.fromDO(infoList);
   }