|
4 | 4 | import de.rwth.idsg.steve.repository.dto.Reservation;
|
5 | 5 | import de.rwth.idsg.steve.utils.DateTimeUtils;
|
6 | 6 | import de.rwth.idsg.steve.web.dto.ReservationQueryForm;
|
7 |
| -import jooq.steve.db.tables.records.ReservationRecord; |
8 | 7 | import lombok.extern.slf4j.Slf4j;
|
9 | 8 | import org.jooq.Configuration;
|
| 9 | +import org.jooq.Record7; |
10 | 10 | import org.jooq.RecordMapper;
|
11 | 11 | import org.jooq.SelectQuery;
|
12 | 12 | import org.jooq.exception.DataAccessException;
|
@@ -38,7 +38,15 @@ public class ReservationRepositoryImpl implements ReservationRepository {
|
38 | 38 | public List<Reservation> getReservations(ReservationQueryForm form) {
|
39 | 39 | SelectQuery selectQuery = DSL.using(config).selectQuery();
|
40 | 40 | selectQuery.addFrom(RESERVATION);
|
41 |
| - selectQuery.addSelect(RESERVATION.fields()); |
| 41 | + selectQuery.addSelect( |
| 42 | + RESERVATION.RESERVATION_PK, |
| 43 | + RESERVATION.TRANSACTION_PK, |
| 44 | + RESERVATION.IDTAG, |
| 45 | + RESERVATION.CHARGEBOXID, |
| 46 | + RESERVATION.STARTDATETIME, |
| 47 | + RESERVATION.EXPIRYDATETIME, |
| 48 | + RESERVATION.STATUS |
| 49 | + ); |
42 | 50 |
|
43 | 51 | if (form.isChargeBoxIdSet()) {
|
44 | 52 | selectQuery.addConditions(RESERVATION.CHARGEBOXID.eq(form.getChargeBoxId()));
|
@@ -162,18 +170,19 @@ private void internalUpdateReservation(int reservationId, ReservationStatus stat
|
162 | 170 | // Private helpers
|
163 | 171 | // -------------------------------------------------------------------------
|
164 | 172 |
|
165 |
| - private class ReservationMapper implements RecordMapper<ReservationRecord, Reservation> { |
| 173 | + private class ReservationMapper implements |
| 174 | + RecordMapper<Record7<Integer, Integer, String, String, Timestamp, Timestamp, String>, Reservation> { |
166 | 175 | @Override
|
167 |
| - public Reservation map(ReservationRecord r) { |
| 176 | + public Reservation map(Record7<Integer, Integer, String, String, Timestamp, Timestamp, String> r) { |
168 | 177 | return Reservation.builder()
|
169 |
| - .id(r.getReservationPk()) |
170 |
| - .transactionId(r.getTransactionPk()) |
171 |
| - .idTag(r.getIdtag()) |
172 |
| - .chargeBoxId(r.getChargeboxid()) |
173 |
| - .startDatetime(DateTimeUtils.humanize(r.getStartdatetime())) |
174 |
| - .expiryDatetime(DateTimeUtils.humanize(r.getExpirydatetime())) |
175 |
| - .status(r.getStatus()) |
176 |
| - .build(); |
| 178 | + .id(r.value1()) |
| 179 | + .transactionId(r.value2()) |
| 180 | + .idTag(r.value3()) |
| 181 | + .chargeBoxId(r.value4()) |
| 182 | + .startDatetime(DateTimeUtils.humanize(r.value5())) |
| 183 | + .expiryDatetime(DateTimeUtils.humanize(r.value6())) |
| 184 | + .status(r.value7()) |
| 185 | + .build(); |
177 | 186 | }
|
178 | 187 | }
|
179 | 188 |
|
|
0 commit comments