懒分页
foton中因为hbase没有封装分页的方法,如果前端QUI要支持分页,代码为:
@SysLog(name = "查询列表") @RequestMapping(method = { RequestMethod.POST, RequestMethod.GET }) @JSON(properties = { @JSONProperty(root = "list", property = { "*" }) }) public String listByDay() { HttpServletRequest request = getRequest(); String apiId = request.getParameter("apiId"); String userId = request.getParameter("userId"); Date dataDay = ServletUtils.getDateValue(request, "dataDay", DateUtils.DEFAULT_DATE_FORMAT, null); List<AccountRecord> recordList = accountRecordService.findListByDay(Long.valueOf(userId), Long.valueOf(apiId), dataDay); List<AccountRecord> resultList = new ArrayList<AccountRecord>(); int pageNo = Integer.valueOf(request.getParameter("pager.pageNo")); int pageSize = Integer.valueOf(request.getParameter("pager.pageSize")); int size = 0; if (recordList != null && recordList.size() > 0) { size = recordList.size(); int fromIndex = pageNo == 1 ? 0 : pageSize * (pageNo - 1); int toIndex = pageNo * pageSize <= size ? pageNo * pageSize : size; resultList = recordList.subList(fromIndex, toIndex); } setList(resultList); setTotalCount(size); return ResultType.JSON; }