本文整理汇总了Java中com.querydsl.core.BooleanBuilder.and方法的典型用法代码示例。如果您正苦于以下问题:Java BooleanBuilder.and方法的具体用法?Java BooleanBuilder.and怎么用?Java BooleanBuilder.and使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.querydsl.core.BooleanBuilder
的用法示例。
在下文中一共展示了BooleanBuilder.and方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildMapQuery
import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
private Predicate buildMapQuery(MapQuery query, MapPath<String, Object, SimplePath<Object>> properties) {
if (query.isEmpty()) {
return null;
}
BooleanBuilder predicate = new BooleanBuilder();
if (query.getContainsKey() != null) {
predicate.and(properties.containsKey(query.getContainsKey()));
}
if (query.getContainsValue() != null) {
predicate.and(properties.containsValue(query.getContainsValue()));
}
if (!query.getHas().isEmpty()) {
for (Iterator<String> iterator = query.getHas().keySet().iterator(); iterator.hasNext();) {
String key = iterator.next();
predicate.and(properties.contains(key, query.getHas().get(key)));
}
}
return predicate;
}
示例2: buildTextQuery
import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
private Predicate buildTextQuery(TextQuery txt, StringPath txtfield) {
if (txt.isEmpty()) {
return null;
}
BooleanBuilder predicate = new BooleanBuilder();
if (txt.getContains() != null) {
predicate.and(txtfield.contains(txt.getContains()));
}
if (txt.getStartWith() != null) {
predicate.and(txtfield.startsWith(txt.getStartWith()));
}
if (txt.getEndWith() != null) {
predicate.and(txtfield.endsWith(txt.getEndWith()));
}
if (txt.getEquals() != null) {
predicate.and(txtfield.endsWith(txt.getEquals()));
}
return predicate;
}
示例3: buildAppUserListQuery
import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
private Predicate buildAppUserListQuery(StringListQuery query, ListPath<AppUser, QAppUser> list) {
if (query.isEmpty()) {
return null;
}
BooleanBuilder predicate = new BooleanBuilder();
if (query.getIn() != null) {
predicate.and(list.any().id.in(query.getIn()));
}
return predicate;
}
示例4: getDevices
import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
@RequestMapping(method = RequestMethod.GET)
@ApiOperation(value = "Return the user devices", notes = "", response = Device.class, nickname = "getDevices")
@PreAuthorize("@raptorSecurity.list(principal, 'device')")
public ResponseEntity<?> getDevices(
@AuthenticationPrincipal User currentUser,
Pageable pageable
) {
String userId = currentUser.getId();
if (currentUser.isAdmin()) {
userId = null;
}
QDevice device = new QDevice("device");
BooleanBuilder predicate = new BooleanBuilder();
if (userId != null) {
predicate.and(device.userId.eq(userId));
}
Page<Device> result = deviceService.search(predicate, pageable);
return ResponseEntity.ok(result);
}
示例5: 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);
}
}
示例6: listByClub
import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
@Transactional(readOnly = true)
public List<HarvestPermitAreaDTO> listByClub(final long clubId, final Integer huntingYear) {
final HuntingClub huntingClub = requireClubWithReadPermission(clubId);
final BooleanBuilder builder = new BooleanBuilder(QHarvestPermitArea.harvestPermitArea.club.eq(huntingClub));
if (huntingYear != null) {
builder.and(QHarvestPermitArea.harvestPermitArea.huntingYear.eq(huntingYear));
}
return harvestPermitAreaDTOTransformer.transform(harvestPermitAreaRepository.findAllAsList(builder.getValue()));
}
示例7: buildTextQuery
import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
private Predicate buildTextQuery(TextQuery txt, StringPath txtfield) {
if (txt.isEmpty()) {
return null;
}
BooleanBuilder predicate = new BooleanBuilder();
if (txt.getContains() != null) {
predicate.and(txtfield.contains(txt.getContains()));
}
if (txt.getStartWith() != null) {
predicate.and(txtfield.startsWith(txt.getStartWith()));
}
if (txt.getEndWith() != null) {
predicate.and(txtfield.endsWith(txt.getEndWith()));
}
if (txt.getEquals() != null) {
predicate.and(txtfield.endsWith(txt.getEquals()));
}
if (!txt.getIn().isEmpty()) {
predicate.and(txtfield.in(txt.getIn()));
}
return predicate;
}
示例8: getPredicate
import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
public Predicate getPredicate() {
QApp app = new QApp("app");
BooleanBuilder predicate = new BooleanBuilder();
if (query.getUserId() != null) {
predicate.and(app.userId.eq(query.getUserId()));
}
// id
Predicate pid = buildTextQuery(query.id, app.id);
if (pid != null) {
predicate.and(pid);
}
// name
Predicate pname = buildTextQuery(query.name, app.name);
if (pname != null) {
predicate.and(pname);
}
// description
Predicate pdesc = buildTextQuery(query.description, app.description);
if (pdesc != null) {
predicate.and(pdesc);
}
//users (id)
Predicate users = buildAppUserListQuery(query.users, app.users);
if (users != null) {
predicate.and(users);
}
return predicate;
}
示例9: buildListQuery
import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
private Predicate buildListQuery(StringListQuery query, ListPath<String, StringPath> list) {
if (query.isEmpty()) {
return null;
}
BooleanBuilder predicate = new BooleanBuilder();
if (query.getIn() != null && query.getIn().isEmpty()) {
predicate.and(list.any().in(query.getIn()));
}
return predicate;
}
示例10: getNumberOfActiveAccomodationsForRoom
import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
@Override
public Long getNumberOfActiveAccomodationsForRoom(Long allocationEntityId) {
QAccomodation accomodation = QAccomodation.accomodation;
JPAQueryFactory queryFactory = new JPAQueryFactory(entityManager);
BooleanBuilder builder = new BooleanBuilder();
builder.and(accomodation.residence.state.eq(State.CURRENT));
builder.and(accomodation.allocationEntity.id.eq(allocationEntityId));
return queryFactory.from(accomodation).select(accomodation).where(builder)
.fetchCount();
}
示例11: 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);
}
}
示例12: listOrderedByDateTypeStatus
import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
@Override
public List<E> listOrderedByDateTypeStatus(Date startDate, Date endDate, IExecutionType executionType, ExecutionStatus executionStatus,
Integer limit, Integer offset) {
Path<E> path = new EntityPathBase<E>(getObjectClass(), QAbstractExecution.abstractExecution.getMetadata());
QAbstractExecution qAbstractExecution = new QAbstractExecution(path);
BooleanBuilder builder = new BooleanBuilder();
if (startDate != null) {
builder.and(qAbstractExecution.startDate.gt(startDate));
}
if (endDate != null) {
builder.and(qAbstractExecution.endDate.lt(endDate));
}
if (executionType != null) {
builder.and(qAbstractExecution.executionType.eq(executionType));
}
if (executionStatus != null) {
builder.and(qAbstractExecution.executionStatus.eq(executionStatus));
}
JPAQuery<E> jpaQuery = new JPAQuery<>(getEntityManager())
.select(path)
.from(qAbstractExecution)
.orderBy(qAbstractExecution.startDate.desc());
if (limit != null) {
jpaQuery.limit(limit);
}
if (offset != null) {
jpaQuery.offset(offset);
}
return jpaQuery.fetch();
}
示例13: isEmailUnique
import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
public static boolean isEmailUnique(JPAQueryFactory jpaQueryFactory, Long userId,
String email) {
if (StringUtils.hasText(email)) {
BooleanBuilder bb = new BooleanBuilder(
QUser.user.email.equalsIgnoreCase(email));
if (userId != null) {
bb.and(QUser.user.id.ne(userId));
}
return jpaQueryFactory.select(Expressions.ONE).from(QUser.user).where(bb)
.fetchFirst() == null;
}
return true;
}
示例14: isLoginNameUnique
import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
public static boolean isLoginNameUnique(JPAQueryFactory jpaQueryFactory, Long userId,
String loginName) {
if (StringUtils.hasText(loginName)) {
BooleanBuilder bb = new BooleanBuilder(
QUser.user.loginName.equalsIgnoreCase(loginName));
if (userId != null) {
bb.and(QUser.user.id.ne(userId));
}
return jpaQueryFactory.select(Expressions.ONE).from(QUser.user).where(bb)
.fetchFirst() == null;
}
return true;
}
示例15: createFinalPredicate
import com.querydsl.core.BooleanBuilder; //导入方法依赖的package包/类
private Predicate createFinalPredicate() {
BooleanBuilder predicate = new BooleanBuilder();
for (Predicate columnPredicate : columnPredicates) {
predicate = predicate.and(columnPredicate);
}
if (!globalPredicates.isEmpty()) {
predicate = predicate.andAnyOf(globalPredicates.toArray(new Predicate[0]));
}
return predicate;
}