Skip to content

Instantly share code, notes, and snippets.

@fabioebner
Last active July 14, 2016 11:46
Show Gist options
  • Save fabioebner/ed0981b8b7c1b27cd14df399c44eee4b to your computer and use it in GitHub Desktop.
Save fabioebner/ed0981b8b7c1b27cd14df399c44eee4b to your computer and use it in GitHub Desktop.
@Query(value = "SELECT cast(data as timestamp with time zone) as data, coalesce(sum(t.vl_total_movimentacao),0) as movimentacao, coalesce(sum(t.vl_desconto),0) as descontos FROM generate_series(cast (?1 as timestamp), cast (?2 as timestamp), '1 day') as dia(data) left join db_caixa.tb_movimentacao t on t.dt_movimentacao = data and t.cd_caixa in (?3) group by data order by data", nativeQuery = true)
List<Object[]> chartGeral(Date dtInicial, Date dtFinal, Integer[] cdCaixa);
//This gist have this return
//2016-01-01 | 2323.33 | 332.22
//2016-01-03 | 2323.33 | 332.22
//2016-01-04 | 2323.33 | 332.22
//2016-01-05 | 2323.33 | 332.22
//...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment