本文整理汇总了Java中org.jooq.SelectQuery.addConditions方法的典型用法代码示例。如果您正苦于以下问题:Java SelectQuery.addConditions方法的具体用法?Java SelectQuery.addConditions怎么用?Java SelectQuery.addConditions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jooq.SelectQuery
的用法示例。
在下文中一共展示了SelectQuery.addConditions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSpares
import org.jooq.SelectQuery; //导入方法依赖的package包/类
@Override
public Collection<SpareWrapper> getSpares(String label, Boolean flag, Integer numFromInclusive, Integer numToInclusive) throws Exception {
SelectQuery<Record> query = jooq.selectQuery();
query.addFrom(Spares.SPARES);
if (label != null) {
query.addConditions(Spares.SPARES.LABEL.eq(label));
}
if (flag != null) {
query.addConditions(Spares.SPARES.FLAG.eq(flag));
}
if (numFromInclusive != null) {
if (numToInclusive == null) {
query.addConditions(Spares.SPARES.NUM.eq(numFromInclusive));
} else {
query.addConditions(Spares.SPARES.NUM.ge(numFromInclusive));
query.addConditions(Spares.SPARES.NUM.le(numToInclusive));
}
}
return query.fetch(SpareWrapper::of);
}
示例2: addConditions
import org.jooq.SelectQuery; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private SelectQuery addConditions(SelectQuery selectQuery, TransactionQueryForm form) {
if (form.isTransactionPkSet()) {
selectQuery.addConditions(TRANSACTION.TRANSACTION_PK.eq(form.getTransactionPk()));
}
if (form.isChargeBoxIdSet()) {
selectQuery.addConditions(CONNECTOR.CHARGE_BOX_ID.eq(form.getChargeBoxId()));
}
if (form.isOcppIdTagSet()) {
selectQuery.addConditions(TRANSACTION.ID_TAG.eq(form.getOcppIdTag()));
}
if (form.getType() == TransactionQueryForm.QueryType.ACTIVE) {
selectQuery.addConditions(TRANSACTION.STOP_TIMESTAMP.isNull());
}
processType(selectQuery, form);
// Default order
selectQuery.addOrderBy(TRANSACTION.TRANSACTION_PK.desc());
return selectQuery;
}
示例3: processType
import org.jooq.SelectQuery; //导入方法依赖的package包/类
private void processType(SelectQuery selectQuery, ReservationQueryForm form) {
switch (form.getPeriodType()) {
case ACTIVE:
selectQuery.addConditions(RESERVATION.EXPIRY_DATETIME.greaterThan(CustomDSL.utcTimestamp()));
break;
case FROM_TO:
selectQuery.addConditions(
RESERVATION.START_DATETIME.greaterOrEqual(form.getFrom().toDateTime()),
RESERVATION.EXPIRY_DATETIME.lessOrEqual(form.getTo().toDateTime())
);
break;
default:
throw new SteveException("Unknown enum type");
}
}
示例4: getSecretSeries
import org.jooq.SelectQuery; //导入方法依赖的package包/类
public ImmutableList<SecretSeries> getSecretSeries(@Nullable Long expireMaxTime, Group group) {
SelectQuery<Record> select = dslContext
.select().from(SECRETS).join(SECRETS_CONTENT).on(SECRETS.CURRENT.equal(SECRETS_CONTENT.ID))
.where(SECRETS.CURRENT.isNotNull()).getQuery();
if (expireMaxTime != null && expireMaxTime > 0) {
select.addOrderBy(SECRETS_CONTENT.EXPIRY.asc().nullsLast());
long now = System.currentTimeMillis() / 1000L;
select.addConditions(SECRETS_CONTENT.EXPIRY.greaterThan(now));
select.addConditions(SECRETS_CONTENT.EXPIRY.lessOrEqual(expireMaxTime));
}
if (group != null) {
select.addJoin(ACCESSGRANTS, SECRETS.ID.eq(ACCESSGRANTS.SECRETID));
select.addJoin(GROUPS, GROUPS.ID.eq(ACCESSGRANTS.GROUPID));
select.addConditions(GROUPS.NAME.eq(group.getName()));
}
List<SecretSeries> r = select.fetchInto(SECRETS).map(secretSeriesMapper);
return ImmutableList.copyOf(r);
}
示例5: getQuestions
import org.jooq.SelectQuery; //导入方法依赖的package包/类
@Override
public List<QuestionView> getQuestions(final QuestionsOptions options) {
final Integer itemsPerPage = SecurityUtils.getItemsPerPage();
final SelectQuery<Record> questionSelect = getQuestionSelect(options);
if (options.isOwnOrPublic()) {
questionSelect.addConditions(
QUESTIONS.PRIVATE.eq(false).or(QUESTIONS.USER_ID.eq(getUserId(options.getCurrentUser())))
);
}
if (StringUtils.isNotEmpty(options.getProblemCode())) {
questionSelect.addConditions(QUESTIONS.TASK_ID.eq(getProblemId(options.getProblemCode())));
}
questionSelect.addOrderBy(QUESTIONS.QUESTION_ID.desc());
questionSelect.addLimit(options.getPage() * itemsPerPage, itemsPerPage);
return questionSelect.fetch(getQuestionMapper(QuestionContent.WITHOUT_CONTENT));
}
示例6: getProjectMembersByIdentity
import org.jooq.SelectQuery; //导入方法依赖的package包/类
@Override
public List<? extends ProjectMember> getProjectMembersByIdentity(long projectId, Set<Identity> identities) {
Condition allMembers = DSL.falseCondition();
for (Identity identity : identities) {
allMembers = allMembers.or(PROJECT_MEMBER.EXTERNAL_ID.eq(identity.getExternalId())
.and(PROJECT_MEMBER.EXTERNAL_ID_TYPE.eq(identity.getExternalIdType()))
.and(PROJECT_MEMBER.REMOVED.isNull())
.and(PROJECT_MEMBER.STATE.eq(CommonStatesConstants.ACTIVE))
.and(PROJECT_MEMBER.PROJECT_ID.eq(projectId)));
}
SelectQuery<Record> query = create().selectQuery();
query.addFrom(PROJECT_MEMBER);
query.addConditions(allMembers);
query.setDistinct(true);
return query.fetchInto(PROJECT_MEMBER);
}
示例7: addMask
import org.jooq.SelectQuery; //导入方法依赖的package包/类
private void addMask(SelectQuery<Record> selectQuery, UUID classifier,
UUID classification, TableField<?, UUID> field,
ExistentialDomain domain) {
if (classifier.equals(WellKnownRelationship.ANY.id())) {
if (log.isTraceEnabled()) {
log.trace("Match ANY {}", field.getName());
}
return;
}
Condition condition;
if (classifier.equals(WellKnownRelationship.SAME.id())) {
condition = field.eq(classification);
if (log.isTraceEnabled()) {
log.trace("Match SAME {}", field.getName());
}
} else {
condition = field.in(inferenceSubQuery(classifier, classification));
if (log.isTraceEnabled()) {
log.trace("Match on inferrred {}", field.getName());
}
}
condition = condition.or(field.equal(getAnyId(domain)))
.or(field.equal(getSameId(domain)))
.or(field.equal(getNotApplicable(domain)));
selectQuery.addConditions(condition);
}
示例8: addServiceMask
import org.jooq.SelectQuery; //导入方法依赖的package包/类
private void addServiceMask(MetaProtocolRecord metaProtocol, JobRecord job,
SelectQuery<Record> selectQuery) {
if (metaProtocol.getServiceType()
.equals(WellKnownRelationship.SAME.id())) {
selectQuery.addConditions(PROTOCOL.SERVICE.equal(job.getService()));
if (log.isTraceEnabled()) {
log.trace("Match SAME service");
}
} else {
selectQuery.addConditions(PROTOCOL.SERVICE.in(inferenceSubQuery(metaProtocol.getServiceType(),
job.getService())));
if (log.isTraceEnabled()) {
log.trace("Match inferred service");
}
}
}
示例9: addStatusMask
import org.jooq.SelectQuery; //导入方法依赖的package包/类
private void addStatusMask(MetaProtocolRecord metaProtocol, JobRecord job,
SelectQuery<Record> selectQuery) {
if (metaProtocol.getStatus()
.equals(WellKnownRelationship.SAME.id())) {
selectQuery.addConditions(PROTOCOL.STATUS.equal(job.getStatus()));
if (log.isTraceEnabled()) {
log.trace("Match on SAME status");
}
} else {
selectQuery.addConditions(PROTOCOL.STATUS.in(inferenceSubQuery(metaProtocol.getStatus(),
job.getService())));
if (log.isTraceEnabled()) {
log.trace("Match on inferred status");
}
}
}
示例10: processType
import org.jooq.SelectQuery; //导入方法依赖的package包/类
private void processType(SelectQuery selectQuery, TransactionQueryForm form) {
switch (form.getPeriodType()) {
case TODAY:
selectQuery.addConditions(
date(TRANSACTION.START_TIMESTAMP).eq(date(CustomDSL.utcTimestamp()))
);
break;
case LAST_10:
case LAST_30:
case LAST_90:
DateTime now = DateTime.now();
selectQuery.addConditions(
date(TRANSACTION.START_TIMESTAMP).between(
date(now.minusDays(form.getPeriodType().getInterval())),
date(now)
)
);
break;
case ALL:
break;
case FROM_TO:
selectQuery.addConditions(
TRANSACTION.START_TIMESTAMP.between(form.getFrom().toDateTime(), form.getTo().toDateTime())
);
break;
default:
throw new SteveException("Unknown enum type");
}
}
示例11: processBooleanType
import org.jooq.SelectQuery; //导入方法依赖的package包/类
private void processBooleanType(SelectQuery selectQuery,
TableField<OcppTagRecord, Boolean> field,
OcppTagQueryForm.BooleanType type) {
switch (type) {
case ALL:
break;
default:
selectQuery.addConditions(field.eq(type.getBoolValue()));
}
}
示例12: getOverviewInternal
import org.jooq.SelectQuery; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private Result<Record7<Integer, Integer, String, String, String, String, String>> getOverviewInternal(UserQueryForm form) {
SelectQuery selectQuery = ctx.selectQuery();
selectQuery.addFrom(USER);
selectQuery.addJoin(OCPP_TAG, JoinType.LEFT_OUTER_JOIN, USER.OCPP_TAG_PK.eq(OCPP_TAG.OCPP_TAG_PK));
selectQuery.addSelect(
USER.USER_PK,
USER.OCPP_TAG_PK,
OCPP_TAG.ID_TAG,
USER.FIRST_NAME,
USER.LAST_NAME,
USER.PHONE,
USER.E_MAIL
);
if (form.isSetUserPk()) {
selectQuery.addConditions(USER.USER_PK.eq(form.getUserPk()));
}
if (form.isSetOcppIdTag()) {
selectQuery.addConditions(includes(OCPP_TAG.ID_TAG, form.getOcppIdTag()));
}
if (form.isSetEmail()) {
selectQuery.addConditions(includes(USER.E_MAIL, form.getEmail()));
}
if (form.isSetName()) {
// Concatenate the two columns and search within the resulting representation
// for flexibility, since the user can search by first or last name, or both.
Field<String> joinedField = DSL.concat(USER.FIRST_NAME, USER.LAST_NAME);
// Find a matching sequence anywhere within the concatenated representation
selectQuery.addConditions(includes(joinedField, form.getName()));
}
return selectQuery.fetch();
}
示例13: getProblems
import org.jooq.SelectQuery; //导入方法依赖的package包/类
@Override
public ProblemListView getProblems(@Nonnull final ProblemsOptions problemsOptions) {
final Integer itemsPerPage = SecurityUtils.getItemsPerPage();
final SelectQuery<Record> query = jooq.selectQuery();
query.addSelect(TASKS.TASK_ID, TASKS.NAME, TASKS.CODE);
query.addFrom(TASKS);
if (!Strings.isNullOrEmpty(problemsOptions.getQuery())) {
final String lowerQuery = problemsOptions.getQuery().toLowerCase();
query.addConditions(TASKS.CODE.lower().contains(lowerQuery)
.or(TASKS.NAME.lower().contains(lowerQuery)));
}
if (!Strings.isNullOrEmpty(problemsOptions.getAvailableForGroup())) {
query.addConditions(TASKS.TASK_ID.notIn(
jooq.select(CONTESTS_TASKS.TASK_ID)
.from(CONTESTS_TASKS)
.join(CONTESTS).on(CONTESTS.CONTEST_ID.eq(CONTESTS_TASKS.CONTEST_ID))
.where(CONTESTS.CODE.eq(problemsOptions.getAvailableForGroup()))
));
}
query.addOrderBy(TASKS.CODE, TASKS.NAME);
query.addLimit(problemsOptions.getPage() * itemsPerPage, itemsPerPage);
List<ProblemView> problems =
query.fetch()
.map(record -> {
final ProblemView problem = new ProblemView();
problem.setCode(record.getValue(TASKS.CODE));
problem.setName(record.getValue(TASKS.NAME));
return problem;
});
return new ProblemListView(problems);
}
示例14: addConditions
import org.jooq.SelectQuery; //导入方法依赖的package包/类
protected void addConditions(SchemaFactory schemaFactory, SelectQuery<?> query, String type, Table<?> table, Map<Object, Object> criteria) {
org.jooq.Condition condition = JooqUtils.toConditions(metaDataManager, type, criteria);
if (condition != null) {
query.addConditions(condition);
}
}
示例15: addConditions
import org.jooq.SelectQuery; //导入方法依赖的package包/类
protected void addConditions(SchemaFactory schemaFactory, SelectQuery<?> query, String type, Table<?> table, Map<Object, Object> criteria) {
org.jooq.Condition condition = JooqUtils.toConditions(getMetaDataManager(), type, criteria);
if ( condition != null ) {
query.addConditions(condition);
}
}