Java Code Examples for com.baomidou.mybatisplus.plugins.Page#setTotal()
The following examples show how to use
com.baomidou.mybatisplus.plugins.Page#setTotal() .
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: DefaultOrderServiceImpl.java From MeetingFilm with Apache License 2.0 | 6 votes |
@Override public Page<OrderVO> getOrderByUserId(Integer userId, Page<OrderVO> page) { Page<OrderVO> result = new Page<>(); if (userId == null) { log.error("订单查询业务失败,用户编号未传入"); return null; } else { List<OrderVO> ordersByUserId = moocOrderTMapper.getOrdersByUserId(userId, page); if (ordersByUserId == null && ordersByUserId.size() == 0) { result.setTotal(0); result.setRecords(new ArrayList<>()); return result; } else { // 获取订单总数 EntityWrapper<MoocOrderT> entityWrapper = new EntityWrapper<>(); entityWrapper.eq("order_user", userId); Integer counts = moocOrderTMapper.selectCount(entityWrapper); // 将结果放入Page result.setTotal(counts); result.setRecords(ordersByUserId); return result; } } }
Example 2
Source File: RnPackageServiceImpl.java From app-version with Apache License 2.0 | 5 votes |
@Override public ServiceResult listSort(int page, int pageSize, EntityWrapper<RnPackage> wrapper) { wrapper.and().eq("app_id",ThreadLocalUtils.USER_THREAD_LOCAL.get().getAppId()); Page<RnPackage> rnPackagePage = new Page<>(page, pageSize); List<RnPackage> rnPackages = rnPackageMapper.selectList(wrapper); rnPackages.sort((o1, o2) -> VersionCompareUtils.compareVersion(o2.getRnVersion(),o1.getRnVersion())); List<RnPackage> pageList = rnPackages.subList((page - 1) * pageSize, pageSize * page >= rnPackages.size() ? rnPackages.size() : pageSize * page); rnPackagePage.setRecords(pageList); rnPackagePage.setTotal(rnPackages.size()); basicService.formatCreatedBy(rnPackagePage.getRecords()); return ServiceResult.ok(rnPackagePage); }
Example 3
Source File: AndroidVersionServiceImpl.java From app-version with Apache License 2.0 | 5 votes |
@Override public ServiceResult listSort(int page, int pageSize, EntityWrapper<AndroidVersion> wrapper) { Page<AndroidVersion> pageEntity = new Page<>(page, pageSize); List<AndroidVersion> androidVersions = androidVersionMapper.selectList(wrapper); androidVersions.sort((o1, o2) -> VersionCompareUtils.compareVersion(o2.getAppVersion(),o1.getAppVersion())); List<AndroidVersion> pageList = androidVersions.subList((page-1) * pageSize, pageSize * page >= androidVersions.size() ? androidVersions.size() : pageSize * page); pageEntity.setRecords(pageList); pageEntity.setTotal(androidVersions.size()); basicService.formatCreatedBy(pageEntity.getRecords()); return ServiceResult.ok(pageEntity); }
Example 4
Source File: IosVersionServiceImpl.java From app-version with Apache License 2.0 | 5 votes |
@Override public ServiceResult listSort(int page, int pageSize, EntityWrapper<IosVersion> wrapper) { Page<IosVersion> versionPage = new Page<>(page,pageSize); List<IosVersion> iosVersions = iosVersionMapper.selectList(wrapper); iosVersions.sort((o1, o2) -> VersionCompareUtils.compareVersion(o2.getAppVersion(),o1.getAppVersion())); List<IosVersion> pageList = iosVersions.subList((page-1) * pageSize, pageSize * page >= iosVersions.size() ? iosVersions.size() : pageSize * page); versionPage.setRecords(pageList); versionPage.setTotal(iosVersions.size()); basicService.formatCreatedBy(versionPage.getRecords()); return ServiceResult.ok(versionPage); }
Example 5
Source File: SiteController.java From WebStack-Guns with MIT License | 5 votes |
/** * 获取网站列表 */ @RequestMapping(value = "/list") @ResponseBody public Object list(@RequestParam(required = false) String title) { Map map = new HashMap(); map.put("title",title); Page<Site> page = new PageFactory<Site>().defaultPage(); Pager<Site> pages = siteService.getPage(map, page.getOffset(), page.getLimit()); page.setTotal(pages.getTotal()); page.setRecords(pages.getList()); return new PageInfoBT<>(page); }
Example 6
Source File: DefaultCinemaServiceImpl.java From MeetingFilm with Apache License 2.0 | 4 votes |
@Override public Page<CinemaVO> getCinemas(CinemaQueryVO cinemaQueryVO) { // 业务实体集合 List<CinemaVO> cinemas = new ArrayList<>(); Page<MoocCinemaT> page = new Page<>(cinemaQueryVO.getNowPage(), cinemaQueryVO.getPageSize()); // 判断是否传入查询条件 -> brandId,distId,hallType 是否==99 EntityWrapper<MoocCinemaT> entityWrapper = new EntityWrapper<>(); if (cinemaQueryVO.getBrandId() != 99) { entityWrapper.eq("brand_id", cinemaQueryVO.getBrandId()); } if (cinemaQueryVO.getDistrictId() != 99) { entityWrapper.eq("area_id", cinemaQueryVO.getDistrictId()); } if (cinemaQueryVO.getHallType() != 99) { // %#3#% entityWrapper.like("hall_ids", "%#+" + cinemaQueryVO.getHallType() + "+#%"); } // 将数据实体转换为业务实体 List<MoocCinemaT> moocCinemaTS = moocCinemaTMapper.selectPage(page, entityWrapper); for (MoocCinemaT moocCinemaT : moocCinemaTS) { CinemaVO cinemaVO = new CinemaVO(); cinemaVO.setUuid(moocCinemaT.getUuid() + ""); cinemaVO.setMinimumPrice(moocCinemaT.getMinimumPrice() + ""); cinemaVO.setCinemaName(moocCinemaT.getCinemaName()); cinemaVO.setAddress(moocCinemaT.getCinemaAddress()); cinemas.add(cinemaVO); } // 根据条件,判断影院列表总数 long counts = moocCinemaTMapper.selectCount(entityWrapper); // 组织返回值对象 Page<CinemaVO> result = new Page<>(); result.setRecords(cinemas); result.setSize(cinemaQueryVO.getPageSize()); result.setTotal(counts); return result; }