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


Java BooleanBuilder.or方法代码示例

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


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

示例1: read

import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
@ExtDirectMethod(STORE_READ)
@Transactional(readOnly = true)
public ExtDirectStoreResult<User> read(ExtDirectStoreReadRequest request) {

	JPQLQuery<User> query = this.jpaQueryFactory.selectFrom(QUser.user);
	if (!request.getFilters().isEmpty()) {
		StringFilter filter = (StringFilter) request.getFilters().iterator().next();

		BooleanBuilder bb = new BooleanBuilder();
		bb.or(QUser.user.loginName.containsIgnoreCase(filter.getValue()));
		bb.or(QUser.user.lastName.containsIgnoreCase(filter.getValue()));
		bb.or(QUser.user.firstName.containsIgnoreCase(filter.getValue()));
		bb.or(QUser.user.email.containsIgnoreCase(filter.getValue()));

		query.where(bb);
	}
	query.where(QUser.user.deleted.isFalse());

	QuerydslUtil.addPagingAndSorting(query, request, User.class, QUser.user);
	QueryResults<User> searchResult = query.fetchResults();

	return new ExtDirectStoreResult<>(searchResult.getTotal(),
			searchResult.getResults());
}
 
开发者ID:ralscha,项目名称:eds-starter6-jpa,代码行数:25,代码来源:UserService.java

示例2: extend

import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
@Override
public void extend(@Nonnull RequirementSearchContext context) {
    QVariableInstanceEntity variableEntity = new QVariableInstanceEntity(variableName);
    RequirementSearchQuery query = context.getQuery();
    RequirementSearchAliases $ = context.getAliases();

    createSelect(variableEntity, context);

    query.leftJoin($.flowInstance.variables, variableEntity).on(variableEntity.name.eq(variableName));

    QuickFilter quickFilter = context.getQuickFilter();
    if (context.getQuickFilter().hasFilter()) {
        BooleanBuilder filterBooleanBuilder = new BooleanBuilder();
        for (FilterToken token : quickFilter.listFilterTokens()) {
            BooleanBuilder tokenBooleanBuilder = new BooleanBuilder();
            for (String filter : token.getAllPossibleMatches()) {
                tokenBooleanBuilder.or(toChar(variableEntity).likeIgnoreCase(filter));
            }
            filterBooleanBuilder.and(tokenBooleanBuilder);
        }
        query.getQuickFilterWhereClause().or(filterBooleanBuilder);
    }
}
 
开发者ID:opensingular,项目名称:singular-server,代码行数:24,代码来源:FlowVariableRequirementSearchExtender.java

示例3: applyGlobalSearch

import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
/**
 * Adds a global contains text filter on the provided attributes.
 * WARNING: this creates a very inefficient query. If you have many entity
 * instances to query, use instead an indexed text search solution for better
 * performance.
 * @param text the text to look for
 * @param query
 * @param globalSearchAttributes the list of attributes to perform the
 *        filter on
 * @return the updated query
 */
protected JPQLQuery<T> applyGlobalSearch(String text, JPQLQuery<T> query,
    Path<?>... globalSearchAttributes) {
  if (text != null && !StringUtils.isEmpty(text) && globalSearchAttributes.length > 0) {
    BooleanBuilder searchCondition = new BooleanBuilder();
    for (int i = 0; i < globalSearchAttributes.length; i++) {
      Path<?> path = globalSearchAttributes[i];
      if (path instanceof StringPath) {
        StringPath stringPath = (StringPath) path;
        searchCondition.or(stringPath.containsIgnoreCase(text));
      } else if (path instanceof NumberExpression) {
        searchCondition.or(((NumberExpression<?>) path).like("%".concat(text).concat("%")));
      }
    }
    return query.where(searchCondition);
  }
  return query;
}
 
开发者ID:DISID,项目名称:springlets,代码行数:29,代码来源:QueryDslRepositorySupportExt.java

示例4: appendFilterByQuickFilter

import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
private void appendFilterByQuickFilter() {
    if (ctx.getQuickFilter().hasFilter()) {
        BooleanBuilder filterBooleanBuilder = new BooleanBuilder();
        for (FilterToken token : quickFilter.listFilterTokens()) {
            BooleanBuilder tokenBooleanBuilder = new BooleanBuilder();
            for (String filter : token.getAllPossibleMatches()) {
                tokenBooleanBuilder.or(buildQuickFilterBooleanExpression($, filter));
            }
            filterBooleanBuilder.and(tokenBooleanBuilder);
        }
        query.getQuickFilterWhereClause().or(filterBooleanBuilder);
    }
}
 
开发者ID:opensingular,项目名称:singular-server,代码行数:14,代码来源:RequirementSearchQueryFactory.java

示例5: isLastAdmin

import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
private boolean isLastAdmin(Long id) {
	JPAQuery<Integer> query = this.jpaQueryFactory.select(Expressions.ONE)
			.from(QUser.user);
	BooleanBuilder bb = new BooleanBuilder();
	bb.or(QUser.user.authorities.eq(Authority.ADMIN.name()));
	bb.or(QUser.user.authorities.endsWith("," + Authority.ADMIN.name()));
	bb.or(QUser.user.authorities.contains("," + Authority.ADMIN.name() + ","));
	bb.or(QUser.user.authorities.startsWith(Authority.ADMIN.name() + ","));

	query.where(QUser.user.id.ne(id).and(QUser.user.deleted.isFalse())
			.and(QUser.user.enabled.isTrue()).and(bb));
	return query.fetchFirst() == null;
}
 
开发者ID:ralscha,项目名称:eds-starter6-jpa,代码行数:14,代码来源:UserService.java


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