Mercurial > dive4elements > river
changeset 8604:958342db7a15
(issue1750) Check for stations according to measurement station range logic
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Fri, 20 Mar 2015 17:31:06 +0100 |
parents | eed4e31ca1b3 |
children | b0e5a2ce0b09 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/StaticSQFactory.java |
diffstat | 1 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/StaticSQFactory.java Fri Mar 20 16:36:37 2015 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/StaticSQFactory.java Fri Mar 20 17:31:06 2015 +0100 @@ -35,9 +35,19 @@ "JOIN ranges ra ON ra.id = ms.range_id " + "JOIN rivers r ON r.id = ra.river_id " + "WHERE r.name = :river AND " + - "ms.range_id = (SELECT range_id " + - "FROM measurement_station " + - "WHERE id = :ms_id)"; + "CASE WHEN r.km_up = 1 AND ra.b IS NOT NULL " + + "THEN ra.b " + + "ELSE ra.a " + + "END = (SELECT " + + "CASE WHEN r.km_up = 1 AND ra.b IS NOT NULL " + + "THEN ra.b " + + "ELSE ra.a " + + "END " + + "FROM measurement_station ms " + + "JOIN ranges ra ON ra.id = ms.range_id " + + "JOIN rivers r ON r.id = ra.river_id " + + "WHERE r.name = :river AND " + + "ms.id = :ms_id)"; public static final String SQL_SQ = "SELECT " + @@ -93,6 +103,8 @@ List<Integer> list = query.list(); if (list == null || list.isEmpty()) { log.error("Did not even find one measurement station. Broken Query?"); + log.debug("River: " + river); + log.debug("Mesurement station id: " + measurementStation); return retval; }