/*** 需求: 实现商品分页查询* @param pageResult* @return*/@Overridepublic PageResult getItemList(PageResult pageResult) {IPage page = new Page(pageResult.getPageNum(),pageResult.getPageSize());QueryWrapper<Item> queryWrapper = new QueryWrapper<>();//判断条件: 用户传递query 则添加where条件String query = pageResult.getQuery();boolean flag = StringUtils.hasLength(query);queryWrapper.like(flag,"title",query);//page接口原来只有2个,经过分页查询之后,有四个结果page = itemMapper.selectPage(page,queryWrapper);long total = page.getTotal();List<Item> rows = page.getRecords();return pageResult.setTotal(total).setRows(rows);}