forked from SteamWar/SteamWar
Refactor EventRelation: Fix query logic for byEvent, adjust insert fields, and update setFrom parameter handling. Update ResponseRelation to align with updated EventRelation structure.
This commit is contained in:
@@ -43,14 +43,14 @@ public class EventRelation {
|
||||
|
||||
private static final SelectStatement<EventRelation> get = new SelectStatement<>(table, "SELECT * FROM EventRelation WHERE FromType = ? AND FromId = ?");
|
||||
private static final SelectStatement<EventRelation> byId = new SelectStatement<>(table, "SELECT * FROM EventRelation WHERE id = ?");
|
||||
private static final SelectStatement<EventRelation> byEvent = new SelectStatement<>(table, "SELECT ER.* FROM EventRelation ER JOIN EventFight EF ON EF.id = ER.fightId WHERE EF.EventID = ?");
|
||||
private static final Statement insert = table.insertAll(true);
|
||||
private static final SelectStatement<EventRelation> byEvent = new SelectStatement<>(table, "SELECT ER.* FROM EventRelation ER JOIN EventFight EF ON EF.fightId = ER.fightId WHERE EF.EventID = ?");
|
||||
private static final Statement insert = table.insertFields(true, "fightId", "fightTeam", "fromType", "fromId", "fromPlace");
|
||||
private static final Statement update = table.update(Table.PRIMARY, "fromType", "fromId", "fromPlace");
|
||||
private static final Statement updateTeam = table.update(Table.PRIMARY, "fightTeam");
|
||||
private static final Statement delete = table.delete(Table.PRIMARY);
|
||||
|
||||
public static List<EventRelation> get(Event event) {
|
||||
return byId.listSelect(event.getEventID());
|
||||
return byEvent.listSelect(event.getEventID());
|
||||
}
|
||||
|
||||
public static EventRelation get(int id) {
|
||||
@@ -125,10 +125,10 @@ public class EventRelation {
|
||||
setFrom(group.getId(), place, FromType.GROUP);
|
||||
}
|
||||
|
||||
private void setFrom(int id, int place, FromType type) {
|
||||
update.update(id, type, id, place);
|
||||
private void setFrom(int fightId, int place, FromType type) {
|
||||
update.update(type, fightId, place, id);
|
||||
this.fromType = type;
|
||||
this.fromId = id;
|
||||
this.fromId = fightId;
|
||||
this.fromPlace = place;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user