|
|
|
|
@ -32,8 +32,8 @@ class ScheduleSearchQueryBuilder {
|
|
|
|
|
private boolean strictMode = false; |
|
|
|
|
private String[] platforms; |
|
|
|
|
private boolean stopOnly = false; |
|
|
|
|
private String prevLocation; |
|
|
|
|
private String nextLocation; |
|
|
|
|
private String[] prevLocation; |
|
|
|
|
private String[] nextLocation; |
|
|
|
|
|
|
|
|
|
public ScheduleSearchQueryBuilder setTableGroup(TableGroup tableGroup) { |
|
|
|
|
this.tableGroup = tableGroup; |
|
|
|
|
@ -76,12 +76,12 @@ class ScheduleSearchQueryBuilder {
|
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ScheduleSearchQueryBuilder setPrevLocation(String prevLocation) { |
|
|
|
|
public ScheduleSearchQueryBuilder setPrevLocation(String... prevLocation) { |
|
|
|
|
this.prevLocation = prevLocation; |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ScheduleSearchQueryBuilder setNextLocation(String nextLocation) { |
|
|
|
|
public ScheduleSearchQueryBuilder setNextLocation(String... nextLocation) { |
|
|
|
|
this.nextLocation = nextLocation; |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
@ -98,10 +98,10 @@ class ScheduleSearchQueryBuilder {
|
|
|
|
|
sql.append("origin_time, get_tiploc_name(destination), destination_time, mt.signal_id, mt.atoc_code "); |
|
|
|
|
sql.append(" from ").append(tableGroup.getMainTable()).append(" mt ") |
|
|
|
|
.append(" JOIN ").append(tableGroup.getDetailTable()).append(" dt ON mt.suid=dt.suid "); |
|
|
|
|
if(prevLocation!=null&&prevLocation.length()!=0){ |
|
|
|
|
if(prevLocation!=null){ |
|
|
|
|
sql.append(" JOIN ").append(tableGroup.getDetailTable()).append(" pt ON mt.suid=pt.suid AND dt.seq > pt.seq"); |
|
|
|
|
} |
|
|
|
|
if(nextLocation!=null&&nextLocation.length()!=0){ |
|
|
|
|
if(nextLocation!=null){ |
|
|
|
|
sql.append(" JOIN ").append(tableGroup.getDetailTable()).append(" nt ON mt.suid=nt.suid AND dt.seq < nt.seq"); |
|
|
|
|
} |
|
|
|
|
sql.append(" where dt.tiploc_code IN ("); |
|
|
|
|
@ -136,14 +136,22 @@ class ScheduleSearchQueryBuilder {
|
|
|
|
|
} |
|
|
|
|
sql.append(")"); |
|
|
|
|
} |
|
|
|
|
if(prevLocation!=null&&prevLocation.length()!=0){ |
|
|
|
|
sql.append(" AND pt.tiploc_code IN ("); |
|
|
|
|
appendLocationSearch(sql, params, prevLocation); |
|
|
|
|
if(prevLocation!=null){ |
|
|
|
|
sql.append(" AND ( 1=0 "); |
|
|
|
|
for(String prev:prevLocation){ |
|
|
|
|
sql.append(" OR pt.tiploc_code IN ("); |
|
|
|
|
appendLocationSearch(sql, params, prev); |
|
|
|
|
sql.append(")"); |
|
|
|
|
} |
|
|
|
|
sql.append(")"); |
|
|
|
|
} |
|
|
|
|
if(nextLocation!=null){ |
|
|
|
|
sql.append(" AND ( 1=0 "); |
|
|
|
|
for(String next:nextLocation){ |
|
|
|
|
sql.append(" OR nt.tiploc_code IN ("); |
|
|
|
|
appendLocationSearch(sql, params, next); |
|
|
|
|
sql.append(")"); |
|
|
|
|
} |
|
|
|
|
if(nextLocation!=null&&nextLocation.length()!=0){ |
|
|
|
|
sql.append(" AND nt.tiploc_code IN ("); |
|
|
|
|
appendLocationSearch(sql, params, nextLocation); |
|
|
|
|
sql.append(")"); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|