--- dao/DaoAdresseService/src/dk/daoas/daoadresseservice/db/DatabaseLayer.java 2015/02/22 20:17:55 2336 +++ dao/DaoAdresseService/src/dk/daoas/daoadresseservice/db/DatabaseLayer.java 2015/02/23 12:30:41 2337 @@ -18,12 +18,15 @@ public class DatabaseLayer { + static boolean DEBUG = false; + public static List
getAllAdresses() throws SQLException { + String debugFilter = DatabaseLayer.DEBUG ? " AND postnr = 8700 " : ""; String sql = "SELECT id,vejnavn,husnr,husnrbogstav,kommunekode,vejkode,postnr,gadeid,upper(distributor) AS distributor,dbkbane,koreliste,rute " + "FROM fulddaekning.adressetabel " + "WHERE gadeid IS NOT NULL " - //+ "AND postnr = 8700" //DEBUG only + + debugFilter ; Connection conn = DBConnection.getConnection(); @@ -76,18 +79,23 @@ } public static List getExtendedAdresslist() throws SQLException { + String debugFilter1 = DatabaseLayer.DEBUG ? " WHERE orgPostnr = 8700 " : ""; + String debugFilter2 = DatabaseLayer.DEBUG ? " AND orgPostnr = 8700 " : ""; + String sql = "select orgid, a.id as targetid, afstand, LOWER(type) as type from fulddaekning.afstand_anden_rute a " + "join odbc.transporttype t " + "on t.Art = 'Transpost' " + "and ( (t.Type = 'Cykel' and a.Afstand < 1.001) or (t.Type = 'Scooter' and a.Afstand < 1.201) or (t.Type = 'Bil' and a.Afstand < 2.601) ) " + "and t.Rute = a.Rute " + + debugFilter1 + "UNION ALL " + "SELECT orgid, a.id as targetid, afstand,'' as type FROM fulddaekning.afstand_anden_rute_bk a " + "left join bogleveringer.postnummerdistributor d on d.PostNr = a.orgPostnr " + - "WHERE d.Distributor <> 10057" + "WHERE d.Distributor <> 10057 " + + debugFilter2 ; Connection conn = DBConnection.getConnection();