当前位置: 首页>>代码示例>>Java>>正文


Java Page.getTotalElements方法代码示例

本文整理汇总了Java中org.springframework.data.domain.Page.getTotalElements方法的典型用法代码示例。如果您正苦于以下问题:Java Page.getTotalElements方法的具体用法?Java Page.getTotalElements怎么用?Java Page.getTotalElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.data.domain.Page的用法示例。


在下文中一共展示了Page.getTotalElements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: listForSaleByPage

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@Override
@Transactional(readOnly = true)
public Page<EstateItemDTO> listForSaleByPage(Pageable pageable, Map<String, Object> paramMap) throws Exception {
    String cacheKey = CacheKeyGenerator.generate(EstateItemDTO.class, "listForSaleByPage", pageable, paramMap);

    Page<EstateItemDTO> targetItemPage = new PageX();

    // 读取缓存数据
    targetItemPage = byteRedisClient.getByteObj(cacheKey, targetItemPage.getClass());
    if (targetItemPage != null && CollectionUtils.isNotEmpty(targetItemPage.getContent())) {
        return new PageX(targetItemPage.getContent(), pageable, targetItemPage.getTotalElements());
    } else {
        Page<EstateItemModel> sourceItemPage = estateItemRepository.findAll(EstateItemSpecification.getForSaleSpec(paramMap), pageable);
        List<EstateItemModel> sourceItemList = sourceItemPage.getContent();

        if (CollectionUtils.isNotEmpty(sourceItemList)) {
            List<EstateItemDTO> targetItemList = new ArrayList();
            for (EstateItemModel model : sourceItemList) {
                EstateItemDTO dto = new EstateItemDTO();
                CachedBeanCopier.copy(model, dto);
                if (StringUtils.isBlank(dto.getCoverUrl())) dto.setCoverUrl("/3rd-party/porto/img/blank.jpg");
                dto.setDetailHref("/estate/" + dto.getHouseCode() + ".shtml");
                dto.setTotalPriceStr(dto.getTotalPrice() + "万");
                dto.setUnitPriceStr("单价" + dto.getUnitPrice() + "万");
                dto.setDownPayments(dto.getUnitPriceStr() + ", 首付" + BigDecimal.valueOf(0.3d).multiply(dto.getTotalPrice()).setScale(2, BigDecimal.ROUND_HALF_DOWN) + "万");
                dto.setAreaStr(dto.getArea() + "平米");
                dto.setFocusNumStr(dto.getFocusNum() + "人关注");
                dto.setWatchNumStr(dto.getWatchNum() + "次带看");
                dto.setNewEstate(dto.getUpdateTime().isAfter(TimeUtil.nowDateTime().minusDays(3))); // 是当前日期三天前发布的
                targetItemList.add(dto);
            }
            targetItemPage = new PageX(targetItemList, pageable, sourceItemPage.getTotalElements());

            // 数据写入缓存
            byteRedisClient.setByteObj(cacheKey, targetItemPage, 3600);
        }

        return targetItemPage;
    }
}
 
开发者ID:lupindong,项目名称:xq_seckill_microservice,代码行数:41,代码来源:EstateServiceImpl.java

示例2: getAll

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@GetMapping
public PageResult getAll(Reply reply, Integer uid, String draw,
                         @RequestParam(required = false, defaultValue = "1") int start,
                         @RequestParam(required = false, defaultValue = "10") int length) {
    int pageNo = start / length;
    if (uid!=null){
        User user = userService.findOne(uid);
        reply.setUser(user);
    }

    Page<Reply> page = replyService.findByPage(reply, pageNo, length);
    PageResult<List<Reply>> result = new PageResult<>(
            draw,
            page.getTotalElements(),
            page.getTotalElements(),
            page.getContent());
    return result;
}
 
开发者ID:ChinaLHR,项目名称:JavaQuarkBBS,代码行数:19,代码来源:ReplyController.java

示例3: getInstancesByNamespace

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@RequestMapping(value = "/by-namespace", method = RequestMethod.GET)
public PageDTO<InstanceDTO> getInstancesByNamespace(
    @RequestParam("appId") String appId, @RequestParam("clusterName") String clusterName,
    @RequestParam("namespaceName") String namespaceName,
    @RequestParam(value = "instanceAppId", required = false) String instanceAppId,
    Pageable pageable) {
  Page<Instance> instances;
  if (Strings.isNullOrEmpty(instanceAppId)) {
    instances = instanceService.findInstancesByNamespace(appId, clusterName,
        namespaceName, pageable);
  } else {
    instances = instanceService.findInstancesByNamespaceAndInstanceAppId(instanceAppId, appId,
        clusterName, namespaceName, pageable);
  }

  List<InstanceDTO> instanceDTOs = BeanUtils.batchTransform(InstanceDTO.class, instances.getContent());
  return new PageDTO<>(instanceDTOs, pageable, instances.getTotalElements());
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:19,代码来源:InstanceConfigController.java

示例4: list

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@RequestMapping(path="/list")
	public String list(DictionarySearchCriteria criteria
			, Map<String, Object> model) {
		// setting default pageSize and sortFields
		if (criteria.isFirstInitialized()) {
			criteria.setPageSize(10);
			criteria.setSortFields("id:asc");
		}
//		logger.info("----------------------{}-------------------------", DictionaryType.PREDEFINED);
		Page<Dictionary> searchResult = this.dictionaryService.findAll(criteria.getPageable());
		Pagination pagination = new Pagination(criteria.getPageNo(), searchResult.getTotalPages(), searchResult.getTotalElements());
		model.put("searchResult", searchResult);
		model.put("criteria", criteria);
		model.put("pagination", pagination);
		return "tool/dictionary_list";
	}
 
开发者ID:Kevin-Huang-NZ,项目名称:springboot-jsp-generator,代码行数:17,代码来源:DictionaryController.java

示例5: index

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@GetMapping(value = "/blog")
public String index(@RequestParam(value = "page", defaultValue = "0") Integer page,Model model) {
    if(page != 0) page = page -1;

    List<ArticleDto> topArticle = articleService.getArticleRecentPostsTopN(5);
    model.addAttribute("topArticle",topArticle);

    Page<ArticleDto> listArticle = articleService.list(page, ArticleUtils.getIsPublished());
    model.addAttribute("listArticle",listArticle.getContent());

    List<CategoriesDto> categoriesList = categoriesService.getCategoriesArticleCount();
    model.addAttribute("categoriesList",categoriesList);

    PageUtils pageUtils = new PageUtils("/blog?",page,listArticle.getTotalPages(),listArticle.getTotalElements(),itweetProperties.getPagSize());
    model.addAttribute("pb",pageUtils);

    return "front/theme/twts/index";
}
 
开发者ID:realxujiang,项目名称:itweet-boot,代码行数:19,代码来源:TwtsController.java

示例6: findAll

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
public <DTO extends IGenericDTO<PK>> Page<DTO> findAll(Class<DTO> dtoClass, Specification<E> spec,
		Pageable pageable) throws Exception {
	Page<E> sp = findAll(spec, pageable);
	Page<DTO> dp = new PageImpl<DTO>(BeanMapper.map(sp.getContent(), dtoClass), pageable, sp.getTotalElements());
	return dp;
}
 
开发者ID:onsoul,项目名称:os,代码行数:9,代码来源:GenericService.java

示例7: getAll

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@GetMapping
public PageResult getAll(String draw,
                         @RequestParam(required = false, defaultValue = "1") int start,
                         @RequestParam(required = false, defaultValue = "10") int length){
    int pageNo = start/length;
    Page<Permission> page = permissionService.findByPage(pageNo, length);
    PageResult<List<Permission>> result = new PageResult<>(
            draw,
            page.getTotalElements(),
            page.getTotalElements(),
            page.getContent());

    return result;
}
 
开发者ID:ChinaLHR,项目名称:JavaQuarkBBS,代码行数:15,代码来源:PermissionController.java

示例8: getUsersByAppRoleId

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@Override
public Page<UserSummary> getUsersByAppRoleId(String roleId, UserQueryParameter request) {
	Page<User> users = appRoleService.listBindUsers(roleId, request);
	return new PageImpl<>(users.getContent().stream().map(UserSummary::from).collect(Collectors.toList()),
						  new PageRequest(request.getStart(), request.getLimit()),
						  users.getTotalElements());
}
 
开发者ID:melthaw,项目名称:spring-backend-boilerplate,代码行数:8,代码来源:SysRoleRestSupportImpl.java

示例9: listArchivedUsers

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@Override
public Page<UserSummary> listArchivedUsers(UserQueryParameter queryRequest) {
	queryRequest.setEnabled(null);
	Page<User> userPage = accountService.listArchivedUsers(queryRequest);
	return new PageImpl<>(userPage.getContent().stream().map(UserSummary::from).collect(Collectors.toList()),
						  new PageRequest(queryRequest.getStart(), queryRequest.getLimit()),
						  userPage.getTotalElements());
}
 
开发者ID:melthaw,项目名称:spring-backend-boilerplate,代码行数:9,代码来源:ArchivedUserRestSupportImpl.java

示例10: all

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@GetMapping("all")
public String all(@RequestParam(value = "page", defaultValue = "0") int pageNumber, Model model) {
	if (pageNumber < 0) {
		return "redirect:/measurements/all?page=0";
	} else {
		Page<WeightMeasurement> page = measurementsManager.findAsPageDesc(pageNumber, paginationConfig.getPageSize());
		if (pageNumber >= page.getTotalPages() && page.getTotalElements() > 0) {
			return "redirect:/measurements/all?page=0";
		} else {
			model.addAttribute(FatLiningConstants.FIELD_PAGE, pageWrapperFactory.create(page));
			return FatLiningConstants.VIEW_MEASUREMENTS;
		}
	}
}
 
开发者ID:xabgesagtx,项目名称:fat-lining,代码行数:15,代码来源:WeightMeasurementsController.java

示例11: getAppRoles

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@Override
public Page<RoleSummary> getAppRoles(RoleQueryRequest request) {
	Page<AppRole> appRoles = appRoleService.listAppRoles(request);
	return new PageImpl<>(appRoles.getContent().stream().map(RoleSummary::from).collect(Collectors.toList()),
						  new PageRequest(request.getStart(), request.getLimit()),
						  appRoles.getTotalElements());
}
 
开发者ID:melthaw,项目名称:spring-backend-boilerplate,代码行数:8,代码来源:SysRoleRestSupportImpl.java

示例12: listBindUsers

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@Override
public Page<User> listBindUsers(String id, UserQueryRequest request) {
	AppRole appRole = findById(id);
	Page<UserRoleRelationship> relationships = relationshipRepository.findByRole(appRole,
																				 new PageRequest(request.getStart(),
																									request.getLimit()));
	return new PageImpl<>(relationships.getContent()
									   .stream()
									   .map(UserRoleRelationship::getUser)
									   .collect(Collectors.toList()),
						  new PageRequest(request.getStart(), request.getLimit()),
						  relationships.getTotalElements());
}
 
开发者ID:melthaw,项目名称:spring-backend-boilerplate,代码行数:14,代码来源:RoleServiceImpl.java

示例13: list

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
/**
 *文章列表
 * @param page
 * @param pageSize
 * @param model
 * @return
 */
@RequestMapping(value = "/list",method = RequestMethod.GET)
public String list(@RequestParam(value = "page", defaultValue = "0") Integer page, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, Model model) {
    if(page !=0) page = page -1;

    Page<ArticleDto> articleList = articleService.list(page);
    model.addAttribute("articleList",articleList);

    PageUtils pageUtils = new PageUtils("/admin/article/list?",page,articleList.getTotalPages(),articleList.getTotalElements(),pageSize);
    model.addAttribute("pb",pageUtils);

    return "admin/article/a_list";
}
 
开发者ID:realxujiang,项目名称:itweet-boot,代码行数:20,代码来源:ArticleController.java

示例14: findListAll

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@Override
public Page<OrderDTO> findListAll(Pageable pageable) {
    Page<OrderMaster> orderMasterPage = orderMasterRepository.findAll(pageable);
    List<OrderDTO> orderDTOList = OrderMasterToOrderDTOConverter.convert(orderMasterPage.getContent());
    return new PageImpl<OrderDTO>(orderDTOList, pageable, orderMasterPage.getTotalElements());

}
 
开发者ID:ldlood,项目名称:SpringBoot_Wechat_Sell,代码行数:8,代码来源:OrderServiceImpl.java

示例15: tweet

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@GetMapping(value = "/tweet")
public String tweet(@RequestParam(value = "page", defaultValue = "0") Integer page,Model model) {
    if(page != 0) page = page -1;

    model.addAttribute("tweet","selected");
    Page<ArticleDto> listArticle = articleService.list(page, ArticleUtils.getIsPublished(),ArticleUtils.getIsTweet());
    model.addAttribute("listArticle",listArticle);

    PageUtils pageUtils = new PageUtils("/tweet",page,listArticle.getTotalPages(),listArticle.getTotalElements(),itweetProperties.getPagSize());
    model.addAttribute("pb",pageUtils);

    return "front/theme/effe/tweet";
}
 
开发者ID:realxujiang,项目名称:itweet-boot,代码行数:14,代码来源:EffeController.java


注:本文中的org.springframework.data.domain.Page.getTotalElements方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。