分页工具类
/** * 分页查询 */ @RequestMapping("queryPageList") @ResponseBody public PageResult queryPageList(Integer page,Integer rows, User user) { return userService.queryPageList(page,rows,user); } service 实现类 public PageResult queryPageList(Integer page, Integer rows, User user) { PageResult pageResult = new PageResu lt(); HashMap hashMap = new HashMap(); hashMap.put("userBean", user); //查询条数 int count=userMapper.querygetCount(hashMap); pageResult.setTotal(count); PageUtil pageUtil = new PageUtil(count, page, rows); hashMap.put("startIndex", pageUtil.getStartIndex()); hashMap.put("endIndex", pageUtil.getEndIndex()); List list = userMapper.queryPageList(hashMap); pageResult.setRows(list); return pageResult; } lt(); HashMap hashMap = new HashMap(); hashMap.put("userBean", user); //查询条数 int count=userMapper.querygetCount(hashMap); pageResult.setTotal(count); PageUtil pageUtil = new PageUtil(count, page, rows); hashMap.put("startIndex", pageUtil.getStartIndex()); hashMap.put("endIndex", pageUtil.getEndIndex()); List list = userMapper.queryPageList(hashMap); pageResult.setRows(list); return pageResult; }
用户评论