Java Code Examples for com.github.pagehelper.PageInfo#setList()
The following examples show how to use
com.github.pagehelper.PageInfo#setList() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OrderServiceImpl.java From mmall-kay-Java with Apache License 2.0 | 6 votes |
/** * fixme 搜索需要扩展,多条件查询 * @param orderNo * @param pageNum *@param pageSize @return */ @Override public ServerResponse<PageInfo> getManageSearch(Long orderNo, int pageNum, int pageSize) { PageHelper.startPage(pageNum, pageSize); Order order = orderMapper.selectByOrderNo(orderNo); if (order!=null) { List<OrderItem> orderItemList = orderItemMapper.selectByOrderNo(orderNo); OrderVo orderVo = this.assembleOrderVo(order, orderItemList); PageInfo pageInfo = new PageInfo(Lists.newArrayList(order)); pageInfo.setList(Lists.newArrayList(orderVo)); return ServerResponse.createBySuccess(pageInfo); } return ServerResponse.createByErrorMessage("订单不存在"); }
Example 2
Source File: TpcMqConsumerController.java From paascloud-master with Apache License 2.0 | 6 votes |
/** * 查询订阅者列表. * * @param tpcMqConsumer the tpc mq consumer * * @return the wrapper */ @PostMapping(value = "/querySubscribeListWithPage") @ApiOperation(httpMethod = "POST", value = "查询订阅者列表") public Wrapper<PageInfo<TpcMqSubscribeVo>> querySubscribeListWithPage(@ApiParam(name = "consumer", value = "Mq消费者") @RequestBody TpcMqConsumer tpcMqConsumer) { logger.info("查询Mq订阅列表tpcMqConsumerQuery={}", tpcMqConsumer); PageHelper.startPage(tpcMqConsumer.getPageNum(), tpcMqConsumer.getPageSize()); tpcMqConsumer.setOrderBy("update_time desc"); List<TpcMqSubscribeVo> list = tpcMqConsumerService.listSubscribeVoWithPage(tpcMqConsumer); PageInfo<TpcMqSubscribeVo> pageInfo = new PageInfo<>(list); if (PublicUtil.isNotEmpty(list)) { Map<Long, TpcMqSubscribeVo> tpcMqSubscribeVoMap = this.trans2Map(list); List<Long> subscribeIdList = new ArrayList<>(tpcMqSubscribeVoMap.keySet()); List<TpcMqSubscribeVo> tagVoList = tpcMqConsumerService.listSubscribeVo(subscribeIdList); for (TpcMqSubscribeVo vo : tagVoList) { Long subscribeId = vo.getId(); if (!tpcMqSubscribeVoMap.containsKey(subscribeId)) { continue; } TpcMqSubscribeVo tpcMqSubscribeVo = tpcMqSubscribeVoMap.get(subscribeId); tpcMqSubscribeVo.setTagVoList(vo.getTagVoList()); } pageInfo.setList(new ArrayList<>(tpcMqSubscribeVoMap.values())); } return WrapMapper.ok(pageInfo); }
Example 3
Source File: SysResourcesServiceImpl.java From springboot-learn with MIT License | 6 votes |
/** * 分页查询 * * @param vo * @return */ @Override public PageInfo<Resources> findPageBreakByCondition(ResourceConditionVO vo) { PageHelper.startPage(vo.getPageNumber(), vo.getPageSize()); List<SysResources> sysResources = resourceMapper.findPageBreakByCondition(vo); if (CollectionUtils.isEmpty(sysResources)) { return null; } List<Resources> resources = new ArrayList<>(); for (SysResources r : sysResources) { resources.add(new Resources(r)); } PageInfo bean = new PageInfo<SysResources>(sysResources); bean.setList(resources); return bean; }
Example 4
Source File: SysTemplateServiceImpl.java From OneBlog with GNU General Public License v3.0 | 6 votes |
/** * 分页查询 * * @param vo * @return */ @Override public PageInfo<Template> findPageBreakByCondition(TemplateConditionVO vo) { PageHelper.startPage(vo.getPageNumber(), vo.getPageSize()); List<SysTemplate> list = sysTemplateMapper.findPageBreakByCondition(vo); if (CollectionUtils.isEmpty(list)) { return null; } List<Template> boList = new ArrayList<>(); for (SysTemplate sysTemplate : list) { boList.add(new Template(sysTemplate)); } PageInfo bean = new PageInfo<SysTemplate>(list); bean.setList(boList); return bean; }
Example 5
Source File: ProductServiceImpl.java From mmall20180107 with Apache License 2.0 | 6 votes |
/** * 搜索产品(后台) * @param productName * @param productId * @param pageNum * @param pageSize * @return */ public ServerResponse<PageInfo> searchProduct(String productName, Integer productId, int pageNum, int pageSize){ PageHelper.startPage(pageNum,pageSize); if(StringUtils.isNotBlank(productName)){ productName = new StringBuilder().append("%").append(productName).append("%").toString(); } List<Product> productList = productMapper.selectByProductNameAndProductId(productName,productId); List<ProductListVo> productListVoList = Lists.newArrayList(); for(Product product:productList){ ProductListVo productListVo = assmbleProductListVo(product); productListVoList.add(productListVo); } PageInfo pageInfo = new PageInfo(productList); pageInfo.setList(productListVoList); return ServerResponse.createBySuccessData(pageInfo); }
Example 6
Source File: ExaminationService.java From spring-microservice-exam with MIT License | 6 votes |
/** * 获取分页数据 * * @param pageNum pageNum * @param pageSize pageSize * @param sort sort * @param order order * @param examination examination * @return PageInfo * @author tangyi * @date 2018/11/10 21:10 */ public PageInfo<ExaminationDto> examinationList(String pageNum, String pageSize, String sort, String order, Examination examination) { examination.setTenantCode(SysUtil.getTenantCode()); PageInfo<Examination> page = findPage(PageUtil.pageInfo(pageNum, pageSize, sort, order), examination); PageInfo<ExaminationDto> examinationDtoPageInfo = new PageInfo<>(); BeanUtils.copyProperties(page, examinationDtoPageInfo); if (CollectionUtils.isNotEmpty(page.getList())) { List<Course> courses = courseService.findListById(page.getList().stream().map(Examination::getCourseId).distinct().toArray(Long[]::new)); List<ExaminationDto> examinationDtos = page.getList().stream().map(exam -> { ExaminationDto examinationDto = new ExaminationDto(); BeanUtils.copyProperties(exam, examinationDto); // 设置考试所属课程 courses.stream().filter(tempCourse -> tempCourse.getId().equals(exam.getCourseId())).findFirst().ifPresent(examinationDto::setCourse); // 初始化封面图片 this.initExaminationLogo(examinationDto); return examinationDto; }).collect(Collectors.toList()); examinationDtoPageInfo.setList(examinationDtos); } return examinationDtoPageInfo; }
Example 7
Source File: SubjectService.java From spring-microservice-exam with MIT License | 6 votes |
/** * 查询分页列表 * * @param pageInfo pageInfo * @param subjectDto subjectDto * @return SubjectDto * @author tangyi * @date 2019/06/16 18:12 */ public PageInfo<SubjectDto> findPage(PageInfo pageInfo, SubjectDto subjectDto) { ExaminationSubject examinationSubject = new ExaminationSubject(); examinationSubject.setCategoryId(subjectDto.getCategoryId()); examinationSubject.setExaminationId(subjectDto.getExaminationId()); PageInfo<ExaminationSubject> examinationSubjectPageInfo = examinationSubjectService.findPage(pageInfo, examinationSubject); List<SubjectDto> subjectDtos = new ArrayList<>(); if (CollectionUtils.isNotEmpty(examinationSubjectPageInfo.getList())) { examinationSubjectPageInfo.getList().forEach(tempExaminationSubject -> { SubjectDto tempSubjectDto = subjectService(tempExaminationSubject.getType()).getSubject(tempExaminationSubject.getSubjectId()); if (tempSubjectDto != null) subjectDtos.add(tempSubjectDto); }); } PageInfo<SubjectDto> subjectDtoPageInfo = new PageInfo<>(); PageUtil.copyProperties(examinationSubjectPageInfo, subjectDtoPageInfo); subjectDtoPageInfo.setList(subjectDtos); return subjectDtoPageInfo; }
Example 8
Source File: CommentService.java From Jantent with MIT License | 6 votes |
@Override public PageInfo<CommentBo> getComments(Integer cid, int page, int limit) { if (null != cid) { PageHelper.startPage(page, limit); CommentVoExample commentVoExample = new CommentVoExample(); commentVoExample.createCriteria().andCidEqualTo(cid).andParentEqualTo(0); commentVoExample.setOrderByClause("coid desc"); List<CommentVo> parents = commentDao.selectByExampleWithBLOBs(commentVoExample); PageInfo<CommentVo> commentPaginator = new PageInfo<>(parents); PageInfo<CommentBo> returnBo = copyPageInfo(commentPaginator); if (parents.size() != 0) { List<CommentBo> comments = new ArrayList<>(parents.size()); parents.forEach(parent -> { CommentBo comment = new CommentBo(parent); comments.add(comment); }); returnBo.setList(comments); } return returnBo; } return null; }
Example 9
Source File: PageInfoHelper.java From uexam with GNU Affero General Public License v3.0 | 6 votes |
public static <T, J> PageInfo<J> copyMap(PageInfo<T> source, Function<? super T, ? extends J> mapper) { PageInfo<J> newPage = new PageInfo<>(); newPage.setPageNum(source.getPageNum()); newPage.setPageSize(source.getPageSize()); newPage.setSize(source.getSize()); newPage.setStartRow(source.getStartRow()); newPage.setEndRow(source.getEndRow()); newPage.setTotal(source.getTotal()); newPage.setPages(source.getPages()); newPage.setList(source.getList().stream().map(mapper).collect(Collectors.toList())); newPage.setPrePage(source.getPrePage()); newPage.setNextPage(source.getNextPage()); newPage.setIsFirstPage(source.isIsFirstPage()); newPage.setIsLastPage(source.isIsLastPage()); newPage.setHasPreviousPage(source.isHasPreviousPage()); newPage.setHasNextPage(source.isHasNextPage()); newPage.setNavigatePages(source.getNavigatePages()); newPage.setNavigatepageNums(source.getNavigatepageNums()); newPage.setNavigateFirstPage(source.getNavigateFirstPage()); newPage.setNavigateLastPage(source.getNavigateLastPage()); return newPage; }
Example 10
Source File: OrderServiceImpl.java From MMall_JAVA with GNU General Public License v3.0 | 5 votes |
public ServerResponse<PageInfo> getOrderList(Integer userId, int pageNum, int pageSize) { PageHelper.startPage(pageNum, pageSize); List<Order> orderList = orderMapper.selectByUserId(userId); List<OrderVo> orderVoList = assembleOrderVoList(orderList, userId); PageInfo pageResult = new PageInfo(orderList); pageResult.setList(orderVoList); return ServerResponse.createBySuccess(pageResult); }
Example 11
Source File: SubjectShortAnswerService.java From spring-microservice-exam with MIT License | 5 votes |
/** * 查询分页列表 * * @param pageInfo pageInfo * @param subjectDto subjectDto * @return PageInfo * @author tangyi * @date 2019/06/16 18:17 */ @Override public PageInfo<SubjectDto> findSubjectPage(PageInfo pageInfo, SubjectDto subjectDto) { SubjectShortAnswer subjectShortAnswer = new SubjectShortAnswer(); BeanUtils.copyProperties(subjectDto, subjectShortAnswer); PageInfo subjectShortAnswerPageInfo = this.findPage(pageInfo, subjectShortAnswer); PageInfo<SubjectDto> subjectDtoPageInfo = new PageInfo<>(); PageUtil.copyProperties(subjectShortAnswerPageInfo, subjectDtoPageInfo); subjectDtoPageInfo.setList(SubjectUtil.subjectShortAnswerToDto(subjectShortAnswerPageInfo.getList(), true)); return subjectDtoPageInfo; }
Example 12
Source File: SysResourcesServiceImpl.java From OneBlog with GNU General Public License v3.0 | 5 votes |
/** * 分页查询 * * @param vo * @return */ @Override public PageInfo<Resources> findPageBreakByCondition(ResourceConditionVO vo) { PageHelper.startPage(vo.getPageNumber(), vo.getPageSize()); List<SysResources> sysResources = resourceMapper.findPageBreakByCondition(vo); if (CollectionUtils.isEmpty(sysResources)) { return null; } List<Resources> resources = this.getResources(sysResources); PageInfo bean = new PageInfo<SysResources>(sysResources); bean.setList(resources); return bean; }
Example 13
Source File: BizTypeServiceImpl.java From OneBlog with GNU General Public License v3.0 | 5 votes |
@Override public PageInfo<Type> findPageBreakByCondition(TypeConditionVO vo) { PageHelper.startPage(vo.getPageNumber(), vo.getPageSize()); List<BizType> list = bizTypeMapper.findPageBreakByCondition(vo); List<Type> boList = getTypes(list); if (boList == null) return null; PageInfo bean = new PageInfo<BizType>(list); bean.setList(boList); return bean; }
Example 14
Source File: BizTagsServiceImpl.java From OneBlog with GNU General Public License v3.0 | 5 votes |
@Override public PageInfo<Tags> findPageBreakByCondition(TagsConditionVO vo) { PageHelper.startPage(vo.getPageNumber(), vo.getPageSize()); List<BizTags> list = bizTagsMapper.findPageBreakByCondition(vo); List<Tags> boList = getTags(list); if (boList == null) return null; PageInfo bean = new PageInfo<BizTags>(list); bean.setList(boList); return bean; }
Example 15
Source File: SysLogServiceImpl.java From OneBlog with GNU General Public License v3.0 | 5 votes |
@Override public PageInfo<Log> findPageBreakByCondition(LogConditionVO vo) { PageHelper.startPage(vo.getPageNumber(), vo.getPageSize()); List<SysLog> list = sysLogMapper.findPageBreakByCondition(vo); if (CollectionUtils.isEmpty(list)) { return null; } List<Log> boList = new ArrayList<>(); for (SysLog sysLog : list) { boList.add(new Log(sysLog)); } PageInfo bean = new PageInfo<SysLog>(list); bean.setList(boList); return bean; }
Example 16
Source File: OrderServiceImpl.java From MMall_JAVA with GNU General Public License v3.0 | 5 votes |
public ServerResponse<PageInfo> manageList(int pageNum, int pageSize) { PageHelper.startPage(pageNum, pageSize); List<Order> orderList = orderMapper.selectAllOrder(); List<OrderVo> orderVoList = this.assembleOrderVoList(orderList, null); PageInfo pageResult = new PageInfo(orderList); pageResult.setList(orderVoList); return ServerResponse.createBySuccess(pageResult); }
Example 17
Source File: SysLinkServiceImpl.java From OneBlog with GNU General Public License v3.0 | 5 votes |
@Override public PageInfo<Link> findPageBreakByCondition(LinkConditionVO vo) { PageHelper.startPage(vo.getPageNumber(), vo.getPageSize()); List<SysLink> list = sysLinkMapper.findPageBreakByCondition(vo); if (CollectionUtils.isEmpty(list)) { return null; } List<Link> boList = new ArrayList<>(); for (SysLink sysLink : list) { boList.add(new Link(sysLink)); } PageInfo bean = new PageInfo<SysLink>(list); bean.setList(boList); return bean; }
Example 18
Source File: SysEnterpriseServiceImpl.java From momo-cloud-permission with Apache License 2.0 | 4 votes |
@Override public SysUserListRes userList(SysEnterpriseUserReq sysEnterpriseUserReq) { UserGroupDO uuid = userGroupMapper.uuid(sysEnterpriseUserReq.getEnterpriseUuid()); if (uuid == null) { throw BizException.fail("用户所在的企业不存在"); } SysUserListRes sysUserListResFianl = new SysUserListRes(); sysUserListResFianl.setSysEnterpriseName(uuid.getUserGroupName()); RedisUser redisUser = this.redisUser(); PageHelper.startPage(sysEnterpriseUserReq.getPageNum(), sysEnterpriseUserReq.getPageSize(), "id desc"); List<SysUserListDO> pageSysUserList = userMapper.pageSysUserList(uuid.getId(), sysEnterpriseUserReq.getSysUserName(), sysEnterpriseUserReq.getDisabledFlag()); PageInfo<SysUserListDO> pageInfo = new PageInfo<>(pageSysUserList); List<SysUserListRes> resList = Lists.newArrayList(); List<SysUserListDO> doList = pageInfo.getList(); PageInfo<SysUserListRes> pageInfoRes = new PageInfo<>(); pageInfoRes.setPageNum(pageInfo.getPageNum()); pageInfoRes.setPageSize(pageInfo.getPageSize()); pageInfoRes.setTotal(pageInfo.getTotal()); if (CollectionUtils.isNotEmpty(doList)) { doList.forEach(sysUserListDO -> { SysUserListRes sysUserListRes = new SysUserListRes(); BeanUtils.copyProperties(sysUserListDO, sysUserListRes); //管理员按钮是否显示 List<RoleDO> roles = sysUserListDO.getRoles(); Set<Integer> rolesSet = roles.stream().map(RoleDO::getSysRoleType).collect(Collectors.toSet()); //角色的类型,0:管理员(老板),1:管理员(员工) 2其他 if (rolesSet.contains(RoleTypeEnum.superAdmin.type)) { sysUserListRes.setEditButtonShow(false); sysUserListRes.setPwdButtonShow(false); sysUserListRes.setDisabledFlagButtonShow(false); sysUserListRes.setRoleButtonShow(false); } if (rolesSet.contains(RoleTypeEnum.admin.type)) { sysUserListRes.setEditButtonShow(false); sysUserListRes.setPwdButtonShow(false); sysUserListRes.setDisabledFlagButtonShow(false); sysUserListRes.setRoleButtonShow(false); } //用户是自己登陆,则显示自己 if (sysUserListDO.getId().equals(redisUser.getBaseId())) { sysUserListRes.setEditButtonShow(true); sysUserListRes.setPwdButtonShow(true); sysUserListRes.setDisabledFlagButtonShow(true); sysUserListRes.setRoleButtonShow(true); } //超级管理员,则显示全部 if (superAdminsService.checkIsSuperAdmin(redisUser.getSysUserPhone())) { sysUserListRes.setEditButtonShow(true); sysUserListRes.setPwdButtonShow(true); sysUserListRes.setDisabledFlagButtonShow(true); sysUserListRes.setRoleButtonShow(true); } UserAccountPwdDO userAccountPwdDO = sysUserListDO.getUserAccountPwdDO(); //密码绑定 if (null != userAccountPwdDO) { sysUserListRes.setPwdBinding(true); sysUserListRes.setPwdBindingName(userAccountPwdDO.getSysUserLoginName()); sysUserListRes.setPwdBindingFlag(userAccountPwdDO.getDisabledFlag()); sysUserListRes.setPwdBindingDate(userAccountPwdDO.getCreateTime()); } resList.add(sysUserListRes); }); pageInfoRes.setList(resList); sysUserListResFianl.setSysUserListResPageInfo(pageInfoRes); return sysUserListResFianl; } sysUserListResFianl.setSysUserListResPageInfo(pageInfoRes); return sysUserListResFianl; }
Example 19
Source File: ProductServiceImpl.java From mmall20180107 with Apache License 2.0 | 4 votes |
/** * 获取产品列表 * @param pageNum * @param pageSize * @return */ public ServerResponse<PageInfo> getProductList(int pageNum,int pageSize){ PageHelper.startPage(pageNum,pageSize); List<Product> productList = productMapper.selectProductList(); List<ProductListVo> productListVoList = Lists.newArrayList(); for(Product product:productList){ ProductListVo productListVo = assmbleProductListVo(product); productListVoList.add(productListVo); } PageInfo pageInfo = new PageInfo(productList); pageInfo.setList(productListVoList); return ServerResponse.createBySuccessData(pageInfo); }
Example 20
Source File: OrderServiceImpl.java From mmall20180107 with Apache License 2.0 | 3 votes |
/** * 获取订单列表 * @param userId * @param pageNum * @param pageSize * @return */ public ServerResponse getOrderList(Integer userId,int pageNum,int pageSize){ PageHelper.startPage(pageNum,pageSize); List<Order> orderList = orderMapper.selectOrderListByUserId(userId); List<OrderVo> orderVoList = this.assmbleOrderVoList(userId,orderList); PageInfo pageInfo = new PageInfo(orderList); pageInfo.setList(orderVoList); return ServerResponse.createBySuccessData(pageInfo); }