本文整理汇总了Java中com.querydsl.core.types.dsl.SimpleExpression类的典型用法代码示例。如果您正苦于以下问题:Java SimpleExpression类的具体用法?Java SimpleExpression怎么用?Java SimpleExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleExpression类属于com.querydsl.core.types.dsl包,在下文中一共展示了SimpleExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: idEqIfGiven
import com.querydsl.core.types.dsl.SimpleExpression; //导入依赖的package包/类
public static <K extends Serializable & Comparable<K>, T extends GenericEntity<K, ?>> BooleanExpression idEqIfGiven(SimpleExpression<K> path, T value) {
if (value != null) {
return path.eq(value.getId());
} else {
return null;
}
}
示例2: inIfGiven
import com.querydsl.core.types.dsl.SimpleExpression; //导入依赖的package包/类
public static <T> BooleanExpression inIfGiven(SimpleExpression<T> path, Collection<? extends T> subset) {
if (subset != null && !subset.isEmpty()) {
return path.in(subset);
} else {
return null;
}
}
示例3: matchAllIfGiven
import com.querydsl.core.types.dsl.SimpleExpression; //导入依赖的package包/类
protected <P extends Comparable<?>> BooleanExpression matchAllIfGiven(SimpleExpression<P> simpleExpression, Collection<? extends P> possibleValues) {
if (possibleValues != null && !possibleValues.isEmpty()) {
BooleanExpression rootExpression = null;
for (P possibleValue : possibleValues) {
if (rootExpression == null) {
rootExpression = simpleExpression.eq(possibleValue);
} else {
rootExpression = rootExpression.and(simpleExpression.eq(possibleValue));
}
}
return rootExpression;
}
return null;
}
示例4: append
import com.querydsl.core.types.dsl.SimpleExpression; //导入依赖的package包/类
@SafeVarargs
public static <T extends SimpleExpression<?>, V> void append(BooleanBuilder builder,
V value,
BiFunction<T, V, BooleanExpression> operation,
T path,
T... paths) {
checkNotNull(builder);
checkNotNull(operation);
checkNotNull(path);
builder.and(Stream.concat(Stream.of(path), Stream.of(paths))
.filter(e -> value != null && e != null)
.map(e -> operation.apply(e, value))
.collect(toBooleanBuilder()));
}
示例5: testAppendNullWithOperationAndTwoArguments
import com.querydsl.core.types.dsl.SimpleExpression; //导入依赖的package包/类
@Test
public void testAppendNullWithOperationAndTwoArguments() throws Exception {
BooleanBuilder builder = new BooleanBuilder();
Arguments.<SimpleExpression, CustomNumberType>append(builder, null, SimpleExpression::eq, QPerson.person.oneCustomNumberType, QPerson.person.anotherCustomNumberType);
List<Person> result = new JPAQuery<Void>(entityManager).select(QPerson.person).from(QPerson.person).where(builder).fetch();
assertThat(result.size()).isEqualTo(1);
}
示例6: findForeignHolder
import com.querydsl.core.types.dsl.SimpleExpression; //导入依赖的package包/类
public <T extends CatalogItem, P extends CatalogItem> List<P> findForeignHolder(EntityPath<P> hp,
ListPath<T, ? extends SimpleExpression<T>> h, T c) {
return new JPAQueryFactory(entityManager)
.selectFrom(hp)
.where(h.contains(c))
.fetch();
}
示例7: addParentPredicate
import com.querydsl.core.types.dsl.SimpleExpression; //导入依赖的package包/类
@Override
public void addParentPredicate(MetaAttribute primaryKeyAttr) {
List<?> parentIds = queryImpl.getParentIds();
SimpleExpression<?> parentIdPath = (SimpleExpression<?>) QuerydslUtils.get(parentFrom, primaryKeyAttr.getName());
addPredicate(parentIdPath.in((List) parentIds));
}
示例8: eqIfGiven
import com.querydsl.core.types.dsl.SimpleExpression; //导入依赖的package包/类
public static <T> BooleanExpression eqIfGiven(SimpleExpression<T> path, T value) {
return value == null ? null : path.eq(value);
}
示例9: getByField
import com.querydsl.core.types.dsl.SimpleExpression; //导入依赖的package包/类
protected <T extends E, V extends Comparable<?>> T getByField(EntityPath<T> entityPath, SimpleExpression<V> field, V fieldValue) {
return queryByPredicate(entityPath, eqOrIsNull(field, fieldValue)).fetchOne();
}
示例10: listByField
import com.querydsl.core.types.dsl.SimpleExpression; //导入依赖的package包/类
protected <T extends E, V extends Comparable<?>> List<T> listByField(EntityPath<T> entityPath, SimpleExpression<V> field, V fieldValue, OrderSpecifier<?>... orderSpecifiers) {
return queryByPredicateOrdered(entityPath, eqOrIsNull(field, fieldValue), orderSpecifiers).fetch();
}
示例11: countByField
import com.querydsl.core.types.dsl.SimpleExpression; //导入依赖的package包/类
protected <V extends Comparable<?>> Long countByField(EntityPath<? extends E> entityPath, SimpleExpression<V> field, V fieldValue) {
return queryByPredicate(entityPath, eqOrIsNull(field, fieldValue)).distinct().fetchCount();
}
示例12: eqOrIsNull
import com.querydsl.core.types.dsl.SimpleExpression; //导入依赖的package包/类
private static <V extends Comparable<?>> Predicate eqOrIsNull(SimpleExpression<V> field, V fieldValue) {
return fieldValue != null ? field.eq(fieldValue) : field.isNull() ;
}
示例13: getByField
import com.querydsl.core.types.dsl.SimpleExpression; //导入依赖的package包/类
@Override
public <T extends Person, V extends Comparable<?>> T getByField(EntityPath<T> entityPath,
SimpleExpression<V> field, V fieldValue) {
return super.getByField(entityPath, field, fieldValue);
}
示例14: listByField
import com.querydsl.core.types.dsl.SimpleExpression; //导入依赖的package包/类
@Override
public <T extends Person, V extends Comparable<?>> List<T> listByField(EntityPath<T> entityPath,
SimpleExpression<V> field, V fieldValue, OrderSpecifier<?> orderSpecifier) {
return super.listByField(entityPath, field, fieldValue, orderSpecifier);
}
示例15: countByField
import com.querydsl.core.types.dsl.SimpleExpression; //导入依赖的package包/类
@Override
public <V extends Comparable<?>> Long countByField(EntityPath<? extends Person> entityPath,
SimpleExpression<V> field, V fieldValue) {
return super.countByField(entityPath, field, fieldValue);
}