示例#1
0
 public void testReportSumByTypeAndYearAndMonth() {
   ReportDaoUtil util = (ReportDaoUtil) applicationContext.getBean("reportUtil");
   String sql =
       new MyReport.Builder("money_detail_view")
           .groupBy(new String[] {"month", "tallytype"})
           .sum("money")
           .colomns(new String[] {"month", "tallytype"})
           .where("year='2013'")
           .build()
           .generateSql();
   System.out.println("查询sql:" + sql);
   String ans =
       util.getReportStr(
           sql,
           new ReportStrGenerate2() {
             @Override
             public String change(Map objs) {
               return "['"
                   + objs.get("month")
                   + "',"
                   + objs.get("tallytype")
                   + "',"
                   + objs.get("SUM_money")
                   + "]";
             }
           });
   System.out.println(ans);
 }
示例#2
0
 // select g_value,sum(flag),sum(flag)-count(1) from gongguo_detail group by
 // g_value order by g_value;
 public void atestReportSumByTypeAndYear() {
   ReportDaoUtil util = (ReportDaoUtil) applicationContext.getBean("reportUtil");
   String sql =
       new MyReport.Builder("gongguo_view")
           .groupBy(new String[] {"g_value"})
           .colomns(new String[] {"pname"})
           .sum("flag")
           .count()
           .order("g_value")
           .build()
           .generateSql();
   System.out.println("查询sql:" + sql);
   String ans =
       util.getReportStr(
           sql,
           new ReportStrGenerate() {
             @Override
             public String change(Object[] objs) {
               return "['"
                   + objs[2]
                   + "',"
                   + (Double.parseDouble(objs[0] + "") - Double.parseDouble(objs[1] + ""))
                   + ","
                   + (Double.parseDouble(objs[0] + ""))
                   + "]";
             }
           });
   System.out.println(ans);
 }
示例#3
0
 public void atestReportGongguoStatis() {
   ReportDaoUtil util = (ReportDaoUtil) SpringContextUtil.getBean("reportUtil");
   String sql =
       new MyReport.Builder("gongguo_view")
           .groupBy(new String[] {"g_value"})
           .colomns(new String[] {"pname"})
           .sum("flag")
           .count()
           .order("g_value")
           .build()
           .generateSql();
   System.out.println("查询sql:" + sql);
   String ans =
       util.getReportStr(
           sql,
           new ReportStrGenerate2() {
             @Override
             public String change(Map objs) {
               return "['"
                   + objs.get("pname")
                   + "',"
                   + (Double.parseDouble(objs.get("COUNT1") + "")
                       - Double.parseDouble(objs.get("SUM_flag") + ""))
                   + ","
                   + (Double.parseDouble(objs.get("COUNT1") + ""))
                   + "]";
             }
           });
   System.out.println(ans);
 }
示例#4
0
 public void atestReportSumByBigType() {
   ReportDaoUtil util = (ReportDaoUtil) applicationContext.getBean("reportUtil");
   String sql =
       new MyReport.Builder("money_detail_view")
           .sum("money")
           .groupBy("bigtype")
           .colomns(new String[] {"bigtype"})
           .build()
           .generateSql();
   System.out.println("查询sql:" + sql);
   String ans =
       util.getReportStr(
           sql,
           new ReportStrGenerate() {
             @Override
             public String change(Object[] objs) {
               return "['" + objs[1] + "'," + objs[0] + "]";
             }
           });
   System.out.println(ans);
 }
示例#5
0
 public void atestReportOutSumByDay() {
   ReportDaoUtil util = (ReportDaoUtil) applicationContext.getBean("reportUtil");
   String sql =
       new MyReport.Builder("money_detail_view")
           .sum("money")
           .where(" money_time='2014-03-03'")
           .groupBy("money_sno")
           .colomns(new String[] {"money_time", "money", "tallytype", "money_sno"})
           .build()
           .generateSql();
   System.out.println("查询sql:" + sql);
   String ans =
       util.getReportStr(
           sql,
           new ReportStrGenerate() {
             @Override
             public String change(Object[] objs) {
               return "['" + objs[1] + "'," + objs[3] + "," + objs[2] + "]";
             }
           });
   System.out.println(ans);
 }