1.1 --- a/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dao/SouhrnDAO.java Sat Feb 14 19:31:33 2009 +0100
1.2 +++ b/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dao/SouhrnDAO.java Sat Feb 14 20:17:33 2009 +0100
1.3 @@ -21,10 +21,7 @@
1.4
1.5 DENNI_SOUHRN,
1.6 DENNI_SOUHRN_CIL,
1.7 - SOUHRN_ZA_OBDOBI,
1.8 - SOUHRN_ZA_OBDOBI_CIL
1.9 }
1.10 -
1.11 private static final long DEN = 1000 * 60 * 60 * 24;
1.12
1.13 /**
1.14 @@ -45,28 +42,19 @@
1.15 ResultSet rs = null;
1.16 try {
1.17 if (konec == null) {
1.18 - if (cil == 0) {
1.19 - ps = db.prepareStatement(getSQL(SQL.DENNI_SOUHRN));
1.20 - ps.setDate(1, zacatek);
1.21 - } else {
1.22 - ps = db.prepareStatement(getSQL(SQL.DENNI_SOUHRN_CIL));
1.23 - ps.setDate(1, zacatek);
1.24 - ps.setInt(2, cil);
1.25 - }
1.26 + konec = zacatek;
1.27 + }
1.28 +
1.29 + if (cil == 0) {
1.30 + ps = db.prepareStatement(getSQL(SQL.DENNI_SOUHRN));
1.31 + ps.setDate(1, zacatek);
1.32 + ps.setDate(2, konec);
1.33 } else {
1.34 - if (cil == 0) {
1.35 - ps = db.prepareStatement(getSQL(SQL.SOUHRN_ZA_OBDOBI));
1.36 - ps.setDate(1, zacatek);
1.37 - ps.setDate(2, konec);
1.38 - } else {
1.39 - ps = db.prepareStatement(getSQL(SQL.SOUHRN_ZA_OBDOBI_CIL));
1.40 - ps.setDate(1, zacatek);
1.41 - ps.setDate(2, konec);
1.42 - ps.setInt(3, cil);
1.43 - }
1.44 + ps = db.prepareStatement(getSQL(SQL.DENNI_SOUHRN_CIL));
1.45 + ps.setDate(1, zacatek);
1.46 + ps.setDate(2, konec);
1.47 + ps.setInt(3, cil);
1.48 }
1.49 -
1.50 -
1.51 rs = ps.executeQuery();
1.52 while (rs.next()) {
1.53 Souhrn s = new Souhrn();
2.1 --- a/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dao/SouhrnDAO.sql.xml Sat Feb 14 19:31:33 2009 +0100
2.2 +++ b/java/HrisniciSpameri/src/java/cz/frantovo/hrisniciSpameri/dao/SouhrnDAO.sql.xml Sat Feb 14 20:17:33 2009 +0100
2.3 @@ -6,7 +6,8 @@
2.4 SELECT *
2.5 FROM souhrn
2.6 JOIN cil ON (cil.id = souhrn.cil)
2.7 - WHERE den = ?
2.8 + WHERE den >= date_trunc('day', ?::date)
2.9 + AND den <= date_trunc('day', ?::date)
2.10 ]]>
2.11 </entry>
2.12 <entry key="DENNI_SOUHRN_CIL">
2.13 @@ -14,30 +15,9 @@
2.14 SELECT *
2.15 FROM souhrn
2.16 JOIN cil ON (cil.id = souhrn.cil)
2.17 - WHERE den = ?
2.18 + WHERE den >= date_trunc('day', ?::date)
2.19 + AND den <= date_trunc('day', ?::date)
2.20 AND cil = ?
2.21 ]]>
2.22 </entry>
2.23 - <entry key="SOUHRN_ZA_OBDOBI">
2.24 - <![CDATA[
2.25 - SELECT *
2.26 - FROM souhrn
2.27 - JOIN cil ON (cil.id = souhrn.cil)
2.28 - WHERE den = ?
2.29 -
2.30 - TODO: dopsat
2.31 -
2.32 - ]]>
2.33 - </entry>
2.34 - <entry key="SOUHRN_ZA_OBDOBI_CIL">
2.35 - <![CDATA[
2.36 - SELECT *
2.37 - FROM souhrn
2.38 - JOIN cil ON (cil.id = souhrn.cil)
2.39 - WHERE den = ?
2.40 -
2.41 - TODO: dopsat
2.42 -
2.43 - ]]>
2.44 - </entry>
2.45 </properties>
2.46 \ No newline at end of file