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


Java SelectQuery.fetch方法代码示例

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


在下文中一共展示了SelectQuery.fetch方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

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

示例4: list

import org.jooq.SelectQuery; //导入方法依赖的package包/类
public Object list(SchemaFactory schemaFactory, String type, Map<Object, Object> criteria, ListOptions options) {
    Class<?> clz = getClass(schemaFactory, type, criteria, true);
    if (clz == null) {
        return null;
    }

    /* Use core schema, parent may not be authorized */
    type = objectManager.getSchemaFactory().getSchemaName(clz);
    Table<?> table = JooqUtils.getTableFromRecordClass(clz);
    Sort sort = options == null ? null : options.getSort();
    Pagination pagination = options == null ? null : options.getPagination();

    if (table == null)
        return null;

    SelectQuery<?> query = create().selectQuery();
    query.addFrom(table);
    addSort(schemaFactory, type, sort, query);

    addConditions(schemaFactory, query, type, table, criteria);
    addLimit(schemaFactory, type, pagination, query);

    List<?> result = query.fetch();
    processPaginationResult(result, pagination);

    return result;
}
 
开发者ID:rancher,项目名称:cattle,代码行数:28,代码来源:JooqResourceListSupport.java

示例5: listInternal

import org.jooq.SelectQuery; //导入方法依赖的package包/类
protected Object listInternal(SchemaFactory schemaFactory, String type, Map<Object, Object> criteria, ListOptions options,
        Map<Table<?>,Condition> joins) {
    Class<?> clz = getClass(schemaFactory, type, criteria, true);
    if ( clz == null ) {
        return null;
    }

    /* Use core schema, parent may not be authorized */
    type = getObjectManager().getSchemaFactory().getSchemaName(clz);
    Table<?> table = JooqUtils.getTableFromRecordClass(clz);
    Sort sort = options == null ? null : options.getSort();
    Pagination pagination = options == null ? null : options.getPagination();
    Include include = options ==null ? null : options.getInclude();

    if ( table == null )
        return null;

    SelectQuery<?> query = create().selectQuery();
    MultiTableMapper mapper = addTables(schemaFactory, query, type, table, criteria, include, pagination, joins);
    addJoins(query, joins);
    addConditions(schemaFactory, query, type, table, criteria);
    addSort(schemaFactory, type, sort, query);
    addLimit(schemaFactory, type, pagination, query);

    List<?> result = mapper == null ? query.fetch() : query.fetchInto(mapper);

    processPaginationResult(result, pagination, mapper);

    return result;
}
 
开发者ID:cloudnautique,项目名称:cloud-cattle,代码行数:31,代码来源:AbstractJooqResourceManager.java

示例6: listInternal

import org.jooq.SelectQuery; //导入方法依赖的package包/类
protected Object listInternal(SchemaFactory schemaFactory, String type, Map<Object, Object> criteria, ListOptions options,
        Map<Table<?>,Condition> joins) {
    Class<?> clz = getClass(schemaFactory, type, criteria, true);
    if ( clz == null ) {
        return null;
    }

    type = schemaFactory.getSchemaName(clz);
    Table<?> table = JooqUtils.getTableFromRecordClass(clz);
    Sort sort = options == null ? null : options.getSort();
    Pagination pagination = options == null ? null : options.getPagination();
    Include include = options ==null ? null : options.getInclude();

    if ( table == null )
        return null;

    SelectQuery<?> query = create().selectQuery();
    MultiTableMapper mapper = addTables(schemaFactory, query, type, table, criteria, include, pagination, joins);
    addJoins(query, joins);
    addConditions(schemaFactory, query, type, table, criteria);
    addSort(schemaFactory, type, sort, query);
    addLimit(schemaFactory, type, pagination, query);

    List<?> result = mapper == null ? query.fetch() : query.fetchInto(mapper);

    processPaginationResult(result, pagination, mapper);

    return result;
}
 
开发者ID:ibuildthecloud,项目名称:dstack,代码行数:30,代码来源:AbstractJooqResourceManager.java

示例7: getOverviewInternal

import org.jooq.SelectQuery; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private Result<Record5<Integer, String, String, String, DateTime>> getOverviewInternal(ChargePointQueryForm form) {
    SelectQuery selectQuery = ctx.selectQuery();
    selectQuery.addFrom(CHARGE_BOX);
    selectQuery.addSelect(
            CHARGE_BOX.CHARGE_BOX_PK,
            CHARGE_BOX.CHARGE_BOX_ID,
            CHARGE_BOX.DESCRIPTION,
            CHARGE_BOX.OCPP_PROTOCOL,
            CHARGE_BOX.LAST_HEARTBEAT_TIMESTAMP
    );

    if (form.isSetOcppVersion()) {

        // http://dev.mysql.com/doc/refman/5.7/en/pattern-matching.html
        selectQuery.addConditions(CHARGE_BOX.OCPP_PROTOCOL.like(form.getOcppVersion().getValue() + "_"));
    }

    if (form.isSetDescription()) {
        selectQuery.addConditions(includes(CHARGE_BOX.DESCRIPTION, form.getDescription()));
    }

    if (form.isSetChargeBoxId()) {
        selectQuery.addConditions(includes(CHARGE_BOX.CHARGE_BOX_ID, form.getChargeBoxId()));
    }

    switch (form.getHeartbeatPeriod()) {
        case ALL:
            break;

        case TODAY:
            selectQuery.addConditions(
                    date(CHARGE_BOX.LAST_HEARTBEAT_TIMESTAMP).eq(date(DateTime.now()))
            );
            break;

        case YESTERDAY:
            selectQuery.addConditions(
                    date(CHARGE_BOX.LAST_HEARTBEAT_TIMESTAMP).eq(date(DateTime.now().minusDays(1)))
            );
            break;

        case EARLIER:
            selectQuery.addConditions(
                    date(CHARGE_BOX.LAST_HEARTBEAT_TIMESTAMP).lessThan(date(DateTime.now().minusDays(1)))
            );
            break;

        default:
            throw new SteveException("Unknown enum type");
    }

    // Default order
    selectQuery.addOrderBy(CHARGE_BOX.CHARGE_BOX_PK.asc());

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


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