/** * 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); }
@Override public Transaction map(Record10<Integer, String, Integer, String, DateTime, String, DateTime, String, Integer, Integer> r) { return Transaction.builder() .id(r.value1()) .chargeBoxId(r.value2()) .connectorId(r.value3()) .ocppIdTag(r.value4()) .startTimestampDT(r.value5()) .startTimestamp(DateTimeUtils.humanize(r.value5())) .startValue(r.value6()) .stopTimestampDT(r.value7()) .stopTimestamp(DateTimeUtils.humanize(r.value7())) .stopValue(r.value8()) .chargeBoxPk(r.value9()) .ocppTagPk(r.value10()) .build(); }
@Override public Reservation map(Record10<Integer, Integer, Integer, Integer, String, String, DateTime, DateTime, String, Integer> r) { return Reservation.builder() .id(r.value1()) .transactionId(r.value2()) .ocppTagPk(r.value3()) .chargeBoxPk(r.value4()) .ocppIdTag(r.value5()) .chargeBoxId(r.value6()) .startDatetimeDT(r.value7()) .startDatetime(DateTimeUtils.humanize(r.value7())) .expiryDatetimeDT(r.value8()) .expiryDatetime(DateTimeUtils.humanize(r.value8())) .status(r.value9()) .connectorId(r.value10()) .build(); }