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


Java SelectQuery类代码示例

本文整理汇总了Java中org.jooq.SelectQuery的典型用法代码示例。如果您正苦于以下问题:Java SelectQuery类的具体用法?Java SelectQuery怎么用?Java SelectQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SelectQuery类属于org.jooq包,在下文中一共展示了SelectQuery类的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);
}
 
开发者ID:rumatoest,项目名称:jdblender,代码行数:26,代码来源:RunnerJooq.java

示例2: getInternalCSV

import org.jooq.SelectQuery; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private
SelectQuery<Record8<Integer, String, Integer, String, DateTime, String, DateTime, String>>
getInternalCSV(TransactionQueryForm form) {

    SelectQuery selectQuery = ctx.selectQuery();
    selectQuery.addFrom(TRANSACTION);
    selectQuery.addJoin(CONNECTOR, TRANSACTION.CONNECTOR_PK.eq(CONNECTOR.CONNECTOR_PK));
    selectQuery.addSelect(
            TRANSACTION.TRANSACTION_PK,
            CONNECTOR.CHARGE_BOX_ID,
            CONNECTOR.CONNECTOR_ID,
            TRANSACTION.ID_TAG,
            TRANSACTION.START_TIMESTAMP,
            TRANSACTION.START_VALUE,
            TRANSACTION.STOP_TIMESTAMP,
            TRANSACTION.STOP_VALUE
    );

    return addConditions(selectQuery, form);
}
 
开发者ID:RWTH-i5-IDSG,项目名称:steve-plugsurfing,代码行数:22,代码来源:TransactionRepositoryImpl.java

示例3: getInternal

import org.jooq.SelectQuery; //导入依赖的package包/类
/**
 * Difference from getInternalCSV:
 * Joins with CHARGE_BOX and OCPP_TAG tables, selects CHARGE_BOX_PK and OCPP_TAG_PK additionally
 */
@SuppressWarnings("unchecked")
private
SelectQuery<Record10<Integer, String, Integer, String, DateTime, String, DateTime, String, Integer, Integer>>
getInternal(TransactionQueryForm form) {

    SelectQuery selectQuery = ctx.selectQuery();
    selectQuery.addFrom(TRANSACTION);
    selectQuery.addJoin(CONNECTOR, TRANSACTION.CONNECTOR_PK.eq(CONNECTOR.CONNECTOR_PK));
    selectQuery.addJoin(CHARGE_BOX, CHARGE_BOX.CHARGE_BOX_ID.eq(CONNECTOR.CHARGE_BOX_ID));
    selectQuery.addJoin(OCPP_TAG, OCPP_TAG.ID_TAG.eq(TRANSACTION.ID_TAG));
    selectQuery.addSelect(
            TRANSACTION.TRANSACTION_PK,
            CONNECTOR.CHARGE_BOX_ID,
            CONNECTOR.CONNECTOR_ID,
            TRANSACTION.ID_TAG,
            TRANSACTION.START_TIMESTAMP,
            TRANSACTION.START_VALUE,
            TRANSACTION.STOP_TIMESTAMP,
            TRANSACTION.STOP_VALUE,
            CHARGE_BOX.CHARGE_BOX_PK,
            OCPP_TAG.OCPP_TAG_PK
    );

    return addConditions(selectQuery, form);
}
 
开发者ID:RWTH-i5-IDSG,项目名称:steve-plugsurfing,代码行数:30,代码来源:TransactionRepositoryImpl.java

示例4: 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;
}
 
开发者ID:RWTH-i5-IDSG,项目名称:steve-plugsurfing,代码行数:26,代码来源:TransactionRepositoryImpl.java

示例5: 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");
    }
}
 
开发者ID:RWTH-i5-IDSG,项目名称:steve-plugsurfing,代码行数:18,代码来源:ReservationRepositoryImpl.java

示例6: getQuery

import org.jooq.SelectQuery; //导入依赖的package包/类
private SelectQuery<R> getQuery(Sort sort) {
    SelectQuery<R> query = dsl.selectFrom(table).getQuery();
    // Do not sort if specified sort condition.
    if (sort == null) {
        return query;
    }
    for (Sort.Order order : sort) {
        // It's currently only allowed column name of lowercase.
        Field<?> field = table.field(name(LOWER_CAMEL.to(LOWER_UNDERSCORE, order.getProperty())));
        if (field == null) {
            // TODO Consider later that can't find the field which has sort condition.
            continue;
        }
        SortField<?> sortField;
        if (order.getDirection() == Sort.Direction.ASC) {
            sortField = field.asc();
        } else {
            sortField = field.desc();
        }
        query.addOrderBy(sortField);
    }
    return query;
}
 
开发者ID:yukung,项目名称:daguerreo,代码行数:24,代码来源:BasicJooqRepository.java

示例7: 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);
}
 
开发者ID:square,项目名称:keywhiz,代码行数:21,代码来源:SecretSeriesDAO.java

示例8: getSecretSeriesBatched

import org.jooq.SelectQuery; //导入依赖的package包/类
public ImmutableList<SecretSeries> getSecretSeriesBatched(int idx, int num, boolean newestFirst) {
  SelectQuery<Record> select = dslContext
      .select()
      .from(SECRETS)
      .join(SECRETS_CONTENT)
      .on(SECRETS.CURRENT.equal(SECRETS_CONTENT.ID))
      .where(SECRETS.CURRENT.isNotNull())
      .getQuery();
  if (newestFirst) {
    select.addOrderBy(SECRETS.CREATEDAT.desc());
  } else {
    select.addOrderBy(SECRETS.CREATEDAT.asc());
  }
  select.addLimit(idx, num);

  List<SecretSeries> r = select.fetchInto(SECRETS).map(secretSeriesMapper);
  return ImmutableList.copyOf(r);
}
 
开发者ID:square,项目名称:keywhiz,代码行数:19,代码来源:SecretSeriesDAO.java

示例9: 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));
}
 
开发者ID:kTT,项目名称:adjule,代码行数:20,代码来源:JooqQuestionsDao.java

示例10: 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);
}
 
开发者ID:rancher,项目名称:cattle,代码行数:17,代码来源:AuthDaoImpl.java

示例11: addMappingJoins

import org.jooq.SelectQuery; //导入依赖的package包/类
protected void addMappingJoins(SelectQuery<?> query, Table<?> toTable, SchemaFactory schemaFactory, String fromType, Table<?> from, String asName, MapRelationship rel) {
    Table<?> mappingTable = JooqUtils.getTableFromRecordClass(rel.getMappingType());
    /* We don't required the mapping type to be visible external, that's why we use the schemaFactory
     * from the objectManager, because it is the superset schemaFactory.
     */
    String mappingType = getObjectManager().getSchemaFactory().getSchemaName(rel.getMappingType());

    TableField<?, Object> fieldFrom = JooqUtils.getTableField(getMetaDataManager(), fromType, ObjectMetaDataManager.ID_FIELD);
    TableField<?, Object> fieldTo = JooqUtils.getTableField(getMetaDataManager(), mappingType, rel.getPropertyName());
    TableField<?, Object> fieldRemoved = JooqUtils.getTableField(getMetaDataManager(), mappingType, ObjectMetaDataManager.REMOVED_FIELD);

    org.jooq.Condition cond = fieldFrom.eq(fieldTo.getTable().field(fieldTo.getName())).and(fieldRemoved == null ? DSL.trueCondition() : fieldRemoved.isNull());
    query.addJoin(mappingTable, JoinType.LEFT_OUTER_JOIN, cond);

    fieldFrom = JooqUtils.getTableField(getMetaDataManager(), mappingType, rel.getOtherRelationship().getPropertyName());
    fieldTo = JooqUtils.getTableField(getMetaDataManager(), schemaFactory.getSchemaName(rel.getObjectType()), ObjectMetaDataManager.ID_FIELD);

    cond = fieldFrom.eq(fieldTo.getTable().asTable(asName).field(fieldTo.getName()));
    query.addJoin(toTable, JoinType.LEFT_OUTER_JOIN, cond);
}
 
开发者ID:cloudnautique,项目名称:cloud-cattle,代码行数:21,代码来源:AbstractJooqResourceManager.java

示例12: addSort

import org.jooq.SelectQuery; //导入依赖的package包/类
protected void addSort(SchemaFactory schemaFactory, String type, Sort sort, SelectQuery<?> query) {
    if ( sort == null ) {
        return;
    }

    TableField<?, Object> sortField = JooqUtils.getTableField(getMetaDataManager(), type, sort.getName());
    if ( sortField == null ) {
        return;
    }

    switch (sort.getOrderEnum()) {
    case DESC:
        query.addOrderBy(sortField.desc());
    default:
        query.addOrderBy(sortField.asc());
    }
}
 
开发者ID:cloudnautique,项目名称:cloud-cattle,代码行数:18,代码来源:AbstractJooqResourceManager.java

示例13: getListByRelationshipMap

import org.jooq.SelectQuery; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected <T> List<T> getListByRelationshipMap(Object obj, MapRelationship rel) {
    Class<UpdatableRecord<?>> typeClass = JooqUtils.getRecordClass(schemaFactory, rel.getObjectType());

    String mappingType = schemaFactory.getSchemaName(rel.getMappingType());
    String fromType = schemaFactory.getSchemaName(rel.getObjectType());

    TableField<?, Object> fieldFrom = JooqUtils.getTableField(getMetaDataManager(), fromType, ObjectMetaDataManager.ID_FIELD);
    TableField<?, Object> mappingTo = JooqUtils.getTableField(getMetaDataManager(), mappingType, rel.getOtherRelationship().getPropertyName());
    TableField<?, Object> mappingOther = JooqUtils.getTableField(getMetaDataManager(), mappingType, rel.getPropertyName());
    TableField<?, Object> mappingRemoved = JooqUtils.getTableField(getMetaDataManager(), mappingType, ObjectMetaDataManager.REMOVED_FIELD);

    Table<?> table = JooqUtils.getTable(schemaFactory, typeClass);
    Table<?> mapTable = JooqUtils.getTable(schemaFactory, rel.getMappingType());

    SelectQuery<?> query = create().selectQuery();
    query.addFrom(table);
    query.addSelect(table.fields());
    query.addJoin(mapTable, fieldFrom.eq(mappingTo)
            .and(mappingRemoved == null ? DSL.trueCondition() : mappingRemoved.isNull())
            .and(mappingOther.eq(ObjectUtils.getId(obj))));

    return (List<T>)query.fetchInto(typeClass);
}
 
开发者ID:cloudnautique,项目名称:cloud-cattle,代码行数:26,代码来源:JooqObjectManager.java

示例14: addMappingJoins

import org.jooq.SelectQuery; //导入依赖的package包/类
protected void addMappingJoins(SelectQuery<?> query, Table<?> toTable, SchemaFactory schemaFactory, String fromType, Table<?> from, String asName, MapRelationship rel) {
    Table<?> mappingTable = JooqUtils.getTableFromRecordClass(rel.getMappingType());
    String mappingType = schemaFactory.getSchemaName(rel.getMappingType());

    TableField<?, Object> fieldFrom = JooqUtils.getTableField(getMetaDataManager(), fromType, ObjectMetaDataManager.ID_FIELD);
    TableField<?, Object> fieldTo = JooqUtils.getTableField(getMetaDataManager(), mappingType, rel.getPropertyName());
    TableField<?, Object> fieldRemoved = JooqUtils.getTableField(getMetaDataManager(), mappingType, ObjectMetaDataManager.REMOVED_FIELD);

    org.jooq.Condition cond = fieldFrom.eq(fieldTo.getTable().field(fieldTo.getName())).and(fieldRemoved == null ? DSL.trueCondition() : fieldRemoved.isNull());
    query.addJoin(mappingTable, JoinType.LEFT_OUTER_JOIN, cond);

    fieldFrom = JooqUtils.getTableField(getMetaDataManager(), mappingType, rel.getOtherRelationship().getPropertyName());
    fieldTo = JooqUtils.getTableField(getMetaDataManager(), schemaFactory.getSchemaName(rel.getObjectType()), ObjectMetaDataManager.ID_FIELD);

    cond = fieldFrom.eq(fieldTo.getTable().asTable(asName).field(fieldTo.getName()));
    query.addJoin(toTable, JoinType.LEFT_OUTER_JOIN, cond);
}
 
开发者ID:ibuildthecloud,项目名称:dstack,代码行数:18,代码来源:AbstractJooqResourceManager.java

示例15: 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);
}
 
开发者ID:ChiralBehaviors,项目名称:Ultrastructure,代码行数:27,代码来源:JobModelImpl.java


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