Java 类org.jooq.Record5 实例源码

项目:steve-plugsurfing    文件:ChargePointRepositoryImpl.java   
@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();
}
项目:steve    文件:ChargePointRepositoryImpl.java   
@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();
}