eye candy
This commit is contained in:
@@ -13,7 +13,7 @@ import de.jottyfan.camporganizer.db.jooq.enums.EnumSex;
|
||||
*
|
||||
*/
|
||||
public class BookingBean implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 2L;
|
||||
|
||||
private Integer pk;
|
||||
private String forename;
|
||||
@@ -38,6 +38,7 @@ public class BookingBean implements Serializable {
|
||||
private String url;
|
||||
private Boolean isOver;
|
||||
private String campName;
|
||||
private String registrator;
|
||||
|
||||
/**
|
||||
* @return the forename
|
||||
@@ -349,4 +350,12 @@ public class BookingBean implements Serializable {
|
||||
this.campName = campName;
|
||||
}
|
||||
|
||||
public String getRegistrator() {
|
||||
return registrator;
|
||||
}
|
||||
|
||||
public void setRegistrator(String registrator) {
|
||||
this.registrator = registrator;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,10 +14,12 @@ import org.jooq.Condition;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.SelectConditionStep;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import de.jottyfan.camporganizer.db.jooq.tables.TProfile;
|
||||
import de.jottyfan.camporganizer.db.jooq.tables.records.VCampRecord;
|
||||
|
||||
/**
|
||||
@@ -40,6 +42,7 @@ public class IndexGateway {
|
||||
}
|
||||
|
||||
public List<BookingBean> getAllBookings(String username) {
|
||||
TProfile REGISTRATOR = TProfile.T_PROFILE.as("registrator");
|
||||
SelectConditionStep<Record> sql = jooq
|
||||
// @formatter:off
|
||||
.select(T_PERSON.PK,
|
||||
@@ -56,6 +59,8 @@ public class IndexGateway {
|
||||
T_PERSON.CREATED,
|
||||
T_PERSON.EMAIL,
|
||||
T_PERSON.SEX,
|
||||
REGISTRATOR.FORENAME,
|
||||
REGISTRATOR.SURNAME,
|
||||
V_CAMP.NAME,
|
||||
V_CAMP.LOCATION_NAME,
|
||||
V_CAMP.PRICE,
|
||||
@@ -67,6 +72,7 @@ public class IndexGateway {
|
||||
V_CAMP.IS_OVER)
|
||||
.from(T_PROFILE)
|
||||
.leftJoin(T_PERSON).on(T_PERSON.FK_PROFILE.eq(T_PROFILE.PK))
|
||||
.leftJoin(REGISTRATOR).on(REGISTRATOR.PK.eq(T_PERSON.FK_REGISTRATOR))
|
||||
.leftJoin(V_CAMP).on(V_CAMP.PK.eq(T_PERSON.FK_CAMP))
|
||||
.where(T_PROFILE.USERNAME.eq(username));
|
||||
// @formatter:on
|
||||
@@ -97,6 +103,14 @@ public class IndexGateway {
|
||||
bean.setUrl(r.get(V_CAMP.URL));
|
||||
bean.setIsOver(r.get(V_CAMP.IS_OVER));
|
||||
bean.setCampName(r.get(V_CAMP.NAME));
|
||||
StringBuilder buf = new StringBuilder();
|
||||
String forename = r.get(REGISTRATOR.FORENAME);
|
||||
String surname = r.get(REGISTRATOR.SURNAME);
|
||||
if (forename != null) {
|
||||
buf.append(forename).append(" ");
|
||||
}
|
||||
buf.append(surname != null ? surname : "");
|
||||
bean.setRegistrator(buf.toString());
|
||||
list.add(bean);
|
||||
}
|
||||
return list;
|
||||
|
||||
Reference in New Issue
Block a user