added booking_start comparison

This commit is contained in:
Jottyfan 2024-03-16 21:48:26 +01:00
parent 1ff307b9ed
commit 66f50a6fe9
5 changed files with 48 additions and 5 deletions

View File

@ -22,7 +22,7 @@ apply plugin: 'java'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
group = 'de.jottyfan' group = 'de.jottyfan'
version = '2024.03.16b' version = '2024.03.16c'
description = """COJooq""" description = """COJooq"""

View File

@ -148,6 +148,11 @@ public class VCamp extends TableImpl<VCampRecord> {
*/ */
public final TableField<VCampRecord, LocalDateTime> START_BOOKING = createField(DSL.name("start_booking"), SQLDataType.LOCALDATETIME(6), this, ""); public final TableField<VCampRecord, LocalDateTime> START_BOOKING = createField(DSL.name("start_booking"), SQLDataType.LOCALDATETIME(6), this, "");
/**
* The column <code>public.v_camp.booking_has_started</code>.
*/
public final TableField<VCampRecord, Boolean> BOOKING_HAS_STARTED = createField(DSL.name("booking_has_started"), SQLDataType.BOOLEAN, this, "");
private VCamp(Name alias, Table<VCampRecord> aliased) { private VCamp(Name alias, Table<VCampRecord> aliased) {
this(alias, aliased, (Field<?>[]) null, null); this(alias, aliased, (Field<?>[]) null, null);
} }
@ -186,7 +191,8 @@ public class VCamp extends TableImpl<VCampRecord> {
c.blocked_beds_male, c.blocked_beds_male,
COALESCE(male.used, (0)::bigint) AS used_beds_male, COALESCE(male.used, (0)::bigint) AS used_beds_male,
COALESCE(female.used, (0)::bigint) AS used_beds_female, COALESCE(female.used, (0)::bigint) AS used_beds_female,
c.start_booking c.start_booking,
(c.start_booking < now()) AS booking_has_started
FROM (((t_camp c FROM (((t_camp c
LEFT JOIN t_location l ON ((c.fk_location = l.pk))) LEFT JOIN t_location l ON ((c.fk_location = l.pk)))
LEFT JOIN male ON ((male.fk_camp = c.pk))) LEFT JOIN male ON ((male.fk_camp = c.pk)))

View File

@ -36,6 +36,7 @@ public class VCamp implements Serializable {
private final Long usedBedsMale; private final Long usedBedsMale;
private final Long usedBedsFemale; private final Long usedBedsFemale;
private final LocalDateTime startBooking; private final LocalDateTime startBooking;
private final Boolean bookingHasStarted;
public VCamp(VCamp value) { public VCamp(VCamp value) {
this.pk = value.pk; this.pk = value.pk;
@ -58,6 +59,7 @@ public class VCamp implements Serializable {
this.usedBedsMale = value.usedBedsMale; this.usedBedsMale = value.usedBedsMale;
this.usedBedsFemale = value.usedBedsFemale; this.usedBedsFemale = value.usedBedsFemale;
this.startBooking = value.startBooking; this.startBooking = value.startBooking;
this.bookingHasStarted = value.bookingHasStarted;
} }
public VCamp( public VCamp(
@ -80,7 +82,8 @@ public class VCamp implements Serializable {
Integer blockedBedsMale, Integer blockedBedsMale,
Long usedBedsMale, Long usedBedsMale,
Long usedBedsFemale, Long usedBedsFemale,
LocalDateTime startBooking LocalDateTime startBooking,
Boolean bookingHasStarted
) { ) {
this.pk = pk; this.pk = pk;
this.isOver = isOver; this.isOver = isOver;
@ -102,6 +105,7 @@ public class VCamp implements Serializable {
this.usedBedsMale = usedBedsMale; this.usedBedsMale = usedBedsMale;
this.usedBedsFemale = usedBedsFemale; this.usedBedsFemale = usedBedsFemale;
this.startBooking = startBooking; this.startBooking = startBooking;
this.bookingHasStarted = bookingHasStarted;
} }
/** /**
@ -244,6 +248,13 @@ public class VCamp implements Serializable {
return this.startBooking; return this.startBooking;
} }
/**
* Getter for <code>public.v_camp.booking_has_started</code>.
*/
public Boolean getBookingHasStarted() {
return this.bookingHasStarted;
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj)
@ -373,6 +384,12 @@ public class VCamp implements Serializable {
} }
else if (!this.startBooking.equals(other.startBooking)) else if (!this.startBooking.equals(other.startBooking))
return false; return false;
if (this.bookingHasStarted == null) {
if (other.bookingHasStarted != null)
return false;
}
else if (!this.bookingHasStarted.equals(other.bookingHasStarted))
return false;
return true; return true;
} }
@ -400,6 +417,7 @@ public class VCamp implements Serializable {
result = prime * result + ((this.usedBedsMale == null) ? 0 : this.usedBedsMale.hashCode()); result = prime * result + ((this.usedBedsMale == null) ? 0 : this.usedBedsMale.hashCode());
result = prime * result + ((this.usedBedsFemale == null) ? 0 : this.usedBedsFemale.hashCode()); result = prime * result + ((this.usedBedsFemale == null) ? 0 : this.usedBedsFemale.hashCode());
result = prime * result + ((this.startBooking == null) ? 0 : this.startBooking.hashCode()); result = prime * result + ((this.startBooking == null) ? 0 : this.startBooking.hashCode());
result = prime * result + ((this.bookingHasStarted == null) ? 0 : this.bookingHasStarted.hashCode());
return result; return result;
} }
@ -427,6 +445,7 @@ public class VCamp implements Serializable {
sb.append(", ").append(usedBedsMale); sb.append(", ").append(usedBedsMale);
sb.append(", ").append(usedBedsFemale); sb.append(", ").append(usedBedsFemale);
sb.append(", ").append(startBooking); sb.append(", ").append(startBooking);
sb.append(", ").append(bookingHasStarted);
sb.append(")"); sb.append(")");
return sb.toString(); return sb.toString();

View File

@ -319,6 +319,21 @@ public class VCampRecord extends TableRecordImpl<VCampRecord> {
return (LocalDateTime) get(19); return (LocalDateTime) get(19);
} }
/**
* Setter for <code>public.v_camp.booking_has_started</code>.
*/
public VCampRecord setBookingHasStarted(Boolean value) {
set(20, value);
return this;
}
/**
* Getter for <code>public.v_camp.booking_has_started</code>.
*/
public Boolean getBookingHasStarted() {
return (Boolean) get(20);
}
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// Constructors // Constructors
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@ -333,7 +348,7 @@ public class VCampRecord extends TableRecordImpl<VCampRecord> {
/** /**
* Create a detached, initialised VCampRecord * Create a detached, initialised VCampRecord
*/ */
public VCampRecord(Integer pk, Boolean isOver, String name, LocalDateTime arrive, LocalDateTime depart, Double year, String locationName, Integer minAge, Integer maxAge, String url, String price, String countries, Integer fkDocument, Integer bedsFemale, Integer bedsMale, Integer blockedBedsFemale, Integer blockedBedsMale, Long usedBedsMale, Long usedBedsFemale, LocalDateTime startBooking) { public VCampRecord(Integer pk, Boolean isOver, String name, LocalDateTime arrive, LocalDateTime depart, Double year, String locationName, Integer minAge, Integer maxAge, String url, String price, String countries, Integer fkDocument, Integer bedsFemale, Integer bedsMale, Integer blockedBedsFemale, Integer blockedBedsMale, Long usedBedsMale, Long usedBedsFemale, LocalDateTime startBooking, Boolean bookingHasStarted) {
super(VCamp.V_CAMP); super(VCamp.V_CAMP);
setPk(pk); setPk(pk);
@ -356,6 +371,7 @@ public class VCampRecord extends TableRecordImpl<VCampRecord> {
setUsedBedsMale(usedBedsMale); setUsedBedsMale(usedBedsMale);
setUsedBedsFemale(usedBedsFemale); setUsedBedsFemale(usedBedsFemale);
setStartBooking(startBooking); setStartBooking(startBooking);
setBookingHasStarted(bookingHasStarted);
resetChangedOnNotNull(); resetChangedOnNotNull();
} }
@ -386,6 +402,7 @@ public class VCampRecord extends TableRecordImpl<VCampRecord> {
setUsedBedsMale(value.getUsedBedsMale()); setUsedBedsMale(value.getUsedBedsMale());
setUsedBedsFemale(value.getUsedBedsFemale()); setUsedBedsFemale(value.getUsedBedsFemale());
setStartBooking(value.getStartBooking()); setStartBooking(value.getStartBooking());
setBookingHasStarted(value.getBookingHasStarted());
resetChangedOnNotNull(); resetChangedOnNotNull();
} }
} }

View File

@ -32,7 +32,8 @@ with female(used, fk_camp) as (
c.blocked_beds_male, c.blocked_beds_male,
coalesce(male.used, 0) as used_beds_male, coalesce(male.used, 0) as used_beds_male,
coalesce(female.used, 0) as used_beds_female, coalesce(female.used, 0) as used_beds_female,
c.start_booking c.start_booking,
(c.start_booking < now()) as booking_has_started
from public.t_camp c from public.t_camp c
left join public.t_location l on c.fk_location = l.pk left join public.t_location l on c.fk_location = l.pk
left join male on male.fk_camp = c.pk left join male on male.fk_camp = c.pk