mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
fix testcase
This commit is contained in:
@@ -17,9 +17,9 @@ package com.alibaba.druid.stat;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
|
||||
public class JdbcStatManagerFactoryBean implements FactoryBean<JdbcStatManager> {
|
||||
public class JdbcStatManagerFactoryBean implements FactoryBean {
|
||||
@Override
|
||||
public JdbcStatManager getObject() throws Exception {
|
||||
public Object getObject() throws Exception {
|
||||
return JdbcStatManager.getInstance();
|
||||
}
|
||||
|
||||
|
||||
+15
-17
@@ -106,7 +106,7 @@ public class MySqlParameterizedOutputVisitorTest_77 extends TestCase {
|
||||
assertEquals("SELECT cbm_name AS cbm_name, team_name AS team, month_earn AS month_gaap, month_kpi AS month_kpi\n" +
|
||||
"\t, month_kpi - month_earn AS month_gaap_gap\n" +
|
||||
"\t, CASE \n" +
|
||||
"\t\tWHEN month_kpi = NULL THEN 0\n" +
|
||||
"\t\tWHEN month_kpi = 1 THEN 0\n" +
|
||||
"\t\tELSE month_earn * 100 / month_kpi\n" +
|
||||
"\tEND AS month_complete_rate, year_earn AS year_gaap, year_kpi AS year_kpi, year_kpi - year_earn AS year_gaap_gap\n" +
|
||||
"\t, CASE \n" +
|
||||
@@ -129,36 +129,36 @@ public class MySqlParameterizedOutputVisitorTest_77 extends TestCase {
|
||||
"\t\t\t, sum(reserve_gaap_m) AS gaap_cunliang, sum(ppl_fcst) AS pipeline\n" +
|
||||
"\t\t\t, 0 AS month_kpi, 0 AS next_month_kpi, 0 AS year_kpi\n" +
|
||||
"\t\tFROM dwd_aly_sop_gaap_di\n" +
|
||||
"\t\tWHERE stat_date = NULL\n" +
|
||||
"\t\tWHERE stat_date = '20181115'\n" +
|
||||
"\t\t\tAND CASE \n" +
|
||||
"\t\t\t\tWHEN NULL = 'true' THEN cbm_id = NULL\n" +
|
||||
"\t\t\t\tELSE team_path LIKE concat(NULL, '%')\n" +
|
||||
"\t\t\t\tWHEN 'true' = 'true' THEN cbm_id = 80882\n" +
|
||||
"\t\t\t\tELSE team_path LIKE concat('0.7940.227.7936.', '%')\n" +
|
||||
"\t\t\tEND\n" +
|
||||
"\t\tGROUP BY cbm_id, cbm_name, team_path, team_name\n" +
|
||||
"\t\tUNION ALL\n" +
|
||||
"\t\tSELECT assess_id AS cbm_id, assess_name AS cbm_name, team_path, team_name, 0 AS month_earn\n" +
|
||||
"\t\t\t, 0 AS year_earn, 0 AS gaap_cunliang, 0 AS pipeline\n" +
|
||||
"\t\t\t, sum(CASE \n" +
|
||||
"\t\t\t\tWHEN kpi_month = CAST(NULL AS bigint) THEN target_amount\n" +
|
||||
"\t\t\t\tWHEN kpi_month = CAST('201811' AS bigint) THEN target_amount\n" +
|
||||
"\t\t\t\tELSE 0\n" +
|
||||
"\t\t\tEND) AS month_kpi\n" +
|
||||
"\t\t\t, sum(CASE \n" +
|
||||
"\t\t\t\tWHEN kpi_month = CAST(NULL AS bigint) THEN target_amount\n" +
|
||||
"\t\t\t\tWHEN kpi_month = CAST('201812' AS bigint) THEN target_amount\n" +
|
||||
"\t\t\t\tELSE 0\n" +
|
||||
"\t\t\tEND) AS next_month_kpi\n" +
|
||||
"\t\t\t, sum(CASE \n" +
|
||||
"\t\t\t\tWHEN kpi_month = CAST(NULL AS bigint) THEN target_amount\n" +
|
||||
"\t\t\t\tWHEN kpi_month = CAST('2019' AS bigint) THEN target_amount\n" +
|
||||
"\t\t\t\tELSE 0\n" +
|
||||
"\t\t\tEND) AS year_kpi\n" +
|
||||
"\t\tFROM dim_aly_sales_kpi\n" +
|
||||
"\t\tWHERE (kpi_month = CAST(NULL AS bigint)\n" +
|
||||
"\t\t\t\tOR kpi_month = CAST(NULL AS bigint)\n" +
|
||||
"\t\t\t\tOR fiscal_year = CAST(NULL AS bigint))\n" +
|
||||
"\t\tWHERE (kpi_month = CAST('201811' AS bigint)\n" +
|
||||
"\t\t\t\tOR kpi_month = CAST('201812' AS bigint)\n" +
|
||||
"\t\t\t\tOR fiscal_year = CAST('2019' AS bigint))\n" +
|
||||
"\t\t\tAND assess_type = 1\n" +
|
||||
"\t\t\tAND target_type = 1\n" +
|
||||
"\t\t\tAND CASE \n" +
|
||||
"\t\t\t\tWHEN NULL = 'true' THEN assess_id = NULL\n" +
|
||||
"\t\t\t\tELSE team_path LIKE concat(NULL, '%')\n" +
|
||||
"\t\t\t\tWHEN 'true' = 'true' THEN assess_id = 80882\n" +
|
||||
"\t\t\t\tELSE team_path LIKE concat('0.7940.227.7936.', '%')\n" +
|
||||
"\t\t\tEND\n" +
|
||||
"\t\tGROUP BY assess_id, assess_name, team_path, team_name\n" +
|
||||
"\t) ti_1\n" +
|
||||
@@ -167,16 +167,14 @@ public class MySqlParameterizedOutputVisitorTest_77 extends TestCase {
|
||||
"\tLEFT JOIN (\n" +
|
||||
"\t\tSELECT cbm_id, team_path, count(DISTINCT cid_id) AS cid_cnt\n" +
|
||||
"\t\tFROM rpt_aly_sop_cust_info_d\n" +
|
||||
"\t\tWHERE stat_date = NULL\n" +
|
||||
"\t\tWHERE stat_date = '20181115'\n" +
|
||||
"\t\t\tAND CASE \n" +
|
||||
"\t\t\t\tWHEN NULL = 'true' THEN cbm_id = NULL\n" +
|
||||
"\t\t\t\tELSE team_path LIKE concat(NULL, '%')\n" +
|
||||
"\t\t\t\tWHEN 'true' = 'true' THEN cbm_id = 80882\n" +
|
||||
"\t\t\t\tELSE team_path LIKE concat('0.7940.227.7936.', '%')\n" +
|
||||
"\t\t\tEND\n" +
|
||||
"\t\tGROUP BY cbm_id, team_path\n" +
|
||||
"\t) t_2\n" +
|
||||
"\tON t_1.cbm_id = t_2.cbm_id\n" +
|
||||
"\t\tAND t_1.team_path = t_2.team_path", rsql);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user