) A WHERE ROWNUM <= 1 ) EMP WHERE RN > 0
将查询结果封装成bean:
String sql = "SELECT * FROM (SELECT A.*, ROWNUM RN FROM ( SELECT T.CONTENT as content,E.EMP_NAME AS blesser,O.NAME as blesserDepartment FROM T_ECM_BIRTH_BLESS T " + "LEFT JOIN M_EMPLOYEE E ON E.USER_ID=T.TO_USER LEFT JOIN M_ORGANIZATION O ON O.ORG_ID=E.DEPT_ID WHERE T.TO_USER=? ) A WHERE ROWNUM <= ? ) EMP WHERE RN > ?";
Integer firstPage = pageNo * pageSize - pageSize;
Integer endPage = firstPage + pageSize;
List<BirthBlessBean> list=commonDao.getListBySpringJDBC(sql, BirthBlessBean.class, toUser,endPage,firstPage);
return list;
封装pagedata:
int totalCount = birthBlessService.getTotalNums(birthBlessBean.getBirthEmp());
PgInfo pageInfo = new PgInfo();
pageInfo.setPageNo(totalCount == 0 ? 0 : currentPage);
pageInfo.setPageSize(pageSize);
pageInfo.setTotalCount(totalCount);
pageInfo.setSumPage(totalCount % pageSize == 0 ? totalCount / pageSize : (totalCount / pageSize + 1));
pageData = new TbData();
pageData.setList(birthBlessList);
pageData.setPageInfo(pageInfo);
pageData = pageData.fillTbData("showBirthBless.action", birthBlessBean,"birthBlessBean");
request.setAttribute("tbData", pageData);