码迷,mamicode.com
首页 > 其他好文 > 详细

假分页

时间:2019-06-06 14:07:31      阅读:78      评论:0      收藏:0      [点我收藏+]

标签:post   gen   min   value   type   ret   data   prope   class   

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;
	}

  

假分页

标签:post   gen   min   value   type   ret   data   prope   class   

原文地址:https://www.cnblogs.com/charkey/p/10984438.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!