本文整理汇总了Java中org.jooq.Condition.and方法的典型用法代码示例。如果您正苦于以下问题:Java Condition.and方法的具体用法?Java Condition.and怎么用?Java Condition.and使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jooq.Condition
的用法示例。
在下文中一共展示了Condition.and方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNTrueCondition
import org.jooq.Condition; //导入方法依赖的package包/类
private static Condition createNTrueCondition(final int n) {
if (n < 1)
throw new IllegalArgumentException("Cannot have n < 1");
Condition condition = null;
for (int i = 0; i < n; i++) {
if (condition == null)
condition = DSL.trueCondition();
else
condition = condition.and(DSL.trueCondition());
}
return condition;
}
示例2: getConditionProvider
import org.jooq.Condition; //导入方法依赖的package包/类
@Override
public <T> ConditionProvider<T> getConditionProvider(final Field<T> field) {
return new MultiParamConditionProvider<T>(field) {
@Override
public Condition getCondition(Collection<T> values) {
Iterator<T> iter = values.iterator();
Condition notLikeCondition = field.notLike((String) iter.next(), '!');
while (iter.hasNext()) {
notLikeCondition = notLikeCondition.and(field.notLike((String) iter.next(), '!'));
}
return notLikeCondition;
}
};
}
示例3: handleConnectiveP
import org.jooq.Condition; //导入方法依赖的package包/类
private Condition handleConnectiveP(String key, ConnectiveP predicate) {
List<P> predicates = predicate.getPredicates();
List<Condition> queries = predicates.stream().map(p -> {
if (p instanceof ConnectiveP) return handleConnectiveP(key, (ConnectiveP) p);
Object pValue = p.getValue();
BiPredicate pBiPredicate = p.getBiPredicate();
return predicateToQuery(key, pValue, pBiPredicate);
}).collect(Collectors.toList());
Condition condition = queries.get(0);
if (predicate instanceof AndP){
for (int i = 1; i < queries.size(); i++) {
condition = condition.and(queries.get(i));
}
}
else if (predicate instanceof OrP){
for (int i = 1; i < queries.size(); i++) {
condition = condition.or(queries.get(i));
}
}
else throw new IllegalArgumentException("Connective predicate not supported by unipop");
return condition;
}
示例4: addOnlyLastFilter
import org.jooq.Condition; //导入方法依赖的package包/类
private void addOnlyLastFilter() {
if (filter.isOnlyLastByStatus() || filter.isOnlyLastByProblem() || filter.isOnlyLastByTeam()) {
final Submissions s2 = SUBMISSIONS.as("s2");
Condition condition = SUBMISSIONS.SUBMISSION_ID.lessThan(s2.SUBMISSION_ID);
if (filter.isOnlyLastByTeam()) {
condition = condition.and(s2.TEAM_ID.eq(SUBMISSIONS.TEAM_ID));
}
if (filter.isOnlyLastByProblem()) {
condition = condition.and(s2.TASK_ID.eq(SUBMISSIONS.TASK_ID));
}
if (filter.isOnlyLastByStatus()) {
condition = condition.and(s2.RESULT.eq(SUBMISSIONS.RESULT));
}
step.leftOuterJoin(s2).on(condition);
step.where(s2.SUBMISSION_ID.isNull());
}
}
示例5: getRecordsCount
import org.jooq.Condition; //导入方法依赖的package包/类
/**
* Finds the total number of rows in the table
*
* @return number of records in table
*/
private int getRecordsCount(Object lowerBoundKey) throws SQLException
{
Condition condition = DSL.trueCondition();
if (getWhereCondition() != null) {
condition = condition.and(getWhereCondition());
}
if (isPollerPartition && lowerBoundKey != null) {
condition = andLowerBoundKeyCondition(condition, lowerBoundKey);
}
int recordsCount = dslContext.select(DSL.count()).from(getTableName()).where(condition).fetchOne(0, int.class);
return recordsCount;
}
示例6: buildRangeQuery
import org.jooq.Condition; //导入方法依赖的package包/类
/**
* Helper function returns a range query based on the bounds passed<br>
*/
protected String buildRangeQuery(Object lowerBoundKey, int offset, int limit)
{
Condition condition = DSL.trueCondition();
if (getWhereCondition() != null) {
condition = condition.and(getWhereCondition());
}
if (isPollerPartition && lowerBoundKey != null) {
condition = andLowerBoundKeyCondition(condition, lowerBoundKey);
}
String sqlQuery;
if (getColumnsExpression() != null) {
Collection<Field<?>> columns = new ArrayList<>();
for (String column : getColumnsExpression().split(",")) {
columns.add(field(column));
}
sqlQuery = dslContext.select(columns).from(getTableName()).where(condition)
.orderBy(field(getKey())).limit(limit).offset(offset).getSQL(ParamType.INLINED);
} else {
sqlQuery = dslContext.select().from(getTableName()).where(condition).orderBy(field(getKey())).limit(limit)
.offset(offset).getSQL(ParamType.INLINED);
}
LOG.info("DSL Query: " + sqlQuery);
return sqlQuery;
}
示例7: findAgentsToPing
import org.jooq.Condition; //导入方法依赖的package包/类
@Override
public List<? extends Agent> findAgentsToPing() {
Condition c = AGENT.STATE.eq(CommonStatesConstants.ACTIVE);
for (String prefix : AgentConstants.AGENT_IGNORE_PREFIXES) {
c = c.and(AGENT.URI.notLike(prefix + "%"));
}
return create()
.select(AGENT.fields())
.from(AGENT)
.where(c)
.fetchInto(AgentRecord.class);
}
示例8: append
import org.jooq.Condition; //导入方法依赖的package包/类
protected Condition append(Condition base, Condition next) {
if ( base == null ) {
return next;
} else {
return base.and(next);
}
}
示例9: addCondition
import org.jooq.Condition; //导入方法依赖的package包/类
private Condition addCondition(QueryParams queryParams, Map<String, Object> queryMap) {
List<Condition> ccc = new LinkedList<Condition>();
String queryOperator = null;
for (QueryParam queryParam : queryParams) {
queryOperator = queryParam.getOperator().toString();
switch (queryParam.getOperator()) {
case EQ:
case GT:
case GTE:
case LT:
case LTE:
case NE:
case IN:
case LIKE:
case NIN:
ccc.add(getSimpleCondition(queryParam.getOperator(), DSL.field(queryParam.getKey()),
queryMap.get(queryParam.getKey())));
break;
case OR:
case AND:
QueryParam qp = queryParam.getParams().get(0);
Condition condition = getSimpleCondition(qp.getOperator(), DSL.field(qp.getKey()),
queryMap.get(qp.getKey()));
for (int i = 1; i < queryParam.getParams().size(); i++) {
QueryParam orQueryParam = queryParam.getParams().get(i);
Condition c = getSimpleCondition(orQueryParam.getOperator(), DSL.field(orQueryParam.getKey()),
queryMap.get(orQueryParam.getKey()));
switch (queryParam.getOperator()) {
case OR:
condition = condition.or(c);
break;
case AND:
condition = condition.and(c);
break;
default:
break;
}
}
ccc.add(condition);
break;
default:
break;
}
}
Condition rc = null;
for (Condition xc : ccc) {
if (rc == null) {
rc = xc;
} else {
if (queryOperator.equals("LIKE")) {
rc = rc.and(xc);
} else {
rc = rc.or(xc);
}
}
}
return rc;
}
示例10: andLowerBoundKeyCondition
import org.jooq.Condition; //导入方法依赖的package包/类
protected Condition andLowerBoundKeyCondition(Condition c, Object lowerBoundKey)
{
return c.and(this.key + " > ?", lowerBoundKey);
}