• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java QuerydslPredicate类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.data.querydsl.binding.QuerydslPredicate的典型用法代码示例。如果您正苦于以下问题:Java QuerydslPredicate类的具体用法?Java QuerydslPredicate怎么用?Java QuerydslPredicate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



QuerydslPredicate类属于org.springframework.data.querydsl.binding包,在下文中一共展示了QuerydslPredicate类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: extractTypeInfo

import org.springframework.data.querydsl.binding.QuerydslPredicate; //导入依赖的package包/类
/**
 * Obtains the domain type information from the given method parameter. Will
 * favor an explicitly registered on through
 * {@link QuerydslPredicate#root()} but use the actual type of the method's
 * return type as fallback.
 * 
 * @param parameter
 *            must not be {@literal null}.
 * @return
 */
static TypeInformation<?> extractTypeInfo(MethodParameter parameter) {

	QuerydslPredicate annotation = parameter.getParameterAnnotation(QuerydslPredicate.class);

	if (annotation != null && !Object.class.equals(annotation.root())) {
		return ClassTypeInformation.from(annotation.root());
	}

	Class<?> containingClass = parameter.getContainingClass();
	if (ClassUtils.isAssignable(EntityController.class, containingClass)) {
		ResolvableType resolvableType = ResolvableType.forClass(containingClass);
		return ClassTypeInformation.from(resolvableType.as(EntityController.class).getGeneric(0).resolve());
	}

	return detectDomainType(ClassTypeInformation.fromReturnTypeOf(parameter.getMethod()));
}
 
开发者ID:xiangxik,项目名称:java-platform,代码行数:27,代码来源:DefaultPredicateArgumentResolver.java


示例2: index

import org.springframework.data.querydsl.binding.QuerydslPredicate; //导入依赖的package包/类
@RequestMapping(value = "/", method = RequestMethod.GET)
String index(Model model, //
		@QuerydslPredicate(root = User.class) Predicate predicate, //
		@PageableDefault(sort = { "lastname", "firstname" }) Pageable pageable, //
		@RequestParam MultiValueMap<String, String> parameters) {

	ServletUriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentRequest();
	builder.replaceQueryParam("page", new Object[0]);

	model.addAttribute("baseUri", builder.build().toUri());
	model.addAttribute("users", repository.findAll(predicate, pageable));

	return "index";
}
 
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:15,代码来源:UserController.java


示例3: findDishes

import org.springframework.data.querydsl.binding.QuerydslPredicate; //导入依赖的package包/类
@RequestMapping(value = "search", method = RequestMethod.GET)
  public ModelAndView findDishes(@QuerydslPredicate(root = Dish.class) Predicate predicate, @PageableDefault(sort = {"date"}, direction = Sort.Direction.DESC) Pageable pageable, ModelAndView modelAndView) {
Sort realSort = pageable.getSort().and(new Sort(Sort.Direction.ASC, "id"));
PageRequest pageRequest = new PageRequest(pageable.getPageNumber(), pageable.getPageSize(), realSort);
Page<Dish> page = dishRepo.findAll(predicate, pageRequest);
List<DishWebDTO> dishes = page.getContent().stream().map(dishDtoFactory::create).collect(Collectors.toList());
modelAndView.addObject("page", page);
modelAndView.addObject("dishes", dishes);
modelAndView.addObject("labels", getLabelsFromDishes());
modelAndView.addObject("categories", getCategoriesFromDishes());
modelAndView.addObject("mensas", mensaRepo.findAllByOrderByName());
      modelAndView.setViewName("search");
      return modelAndView;
  }
 
开发者ID:xabgesagtx,项目名称:mensa-api,代码行数:15,代码来源:MensaWebController.java


示例4: getPatientsByPredicate

import org.springframework.data.querydsl.binding.QuerydslPredicate; //导入依赖的package包/类
/**
 * Another alternative to QBE via QueryDsl Predicates.
 *
 * @param predicate the Predicate to use to query with
 * @param pageable a Pageable to restrict results
 * @return A paged result of matching Patients
 */
@GetMapping("/search/predicate")
public Page<Patient> getPatientsByPredicate(
		@QuerydslPredicate(root = Patient.class) final Predicate predicate,
		@PageableDefault(size = DEFAULT_PAGE_SZ) final Pageable pageable) {
	Page<Patient> pagedResults = this.patientRepository.findAll(predicate, pageable);

	if (!pagedResults.hasContent()) {
		throw new NotFoundException(Patient.RESOURCE_PATH,
				"No Patients found matching predicate " + predicate);
	}

	return pagedResults;
}
 
开发者ID:ssherwood,项目名称:spring-boot-jpa,代码行数:21,代码来源:PatientController.java


示例5: supportsParameter

import org.springframework.data.querydsl.binding.QuerydslPredicate; //导入依赖的package包/类
@Override
public boolean supportsParameter(MethodParameter parameter) {

	if (Predicate.class.equals(parameter.getParameterType())) {
		return true;
	}

	if (parameter.hasParameterAnnotation(QuerydslPredicate.class)) {
		throw new IllegalArgumentException(
				String.format("Parameter at position %s must be of type Predicate but was %s.",
						parameter.getParameterIndex(), parameter.getParameterType()));
	}

	return false;
}
 
开发者ID:xiangxik,项目名称:java-platform,代码行数:16,代码来源:DefaultPredicateArgumentResolver.java


示例6: find

import org.springframework.data.querydsl.binding.QuerydslPredicate; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.GET, value = "/cust")
public Iterable<Customer> find(@QuerydslPredicate(root = Customer.class) Predicate predicate, Pageable pageable,
		@RequestParam MultiValueMap<String, String> parameters) {

	System.out.println();
	System.out.println(predicate);
	System.out.println();

	return customerRepository.findAll(predicate, pageable);
}
 
开发者ID:Nandtel,项目名称:spring-data-jpa-querydsl-gradle-starter,代码行数:11,代码来源:Application.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PluginDisableException类代码示例发布时间:2022-05-23
下一篇:
Java PathOverlay类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap