-- dic_门店 SELECT DISTINCT comm_id AS 项目id,/*门店*/ comm_name AS 项目名称 FROM dim_organ_mapping WHERE 1=1 ${IF(LEN(p_area)>0," AND organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")} -- dic_片区 SELECT DISTINCT organ_code AS 片区id, organ_name AS 片区名称 FROM dim_organ_mapping -- report_收入成本利润预算填报 select ${if(len(p_area) == 0,"organ_code code, organ_name name,","comm_id code, comm_name name,")} yr_month, category, yslx, index_income_target, index_income_fact, income_completion_rate from( select organ_code, organ_name, comm_id, comm_name, yr_month, category, '收入' yslx, index_income_target, index_income_fact, income_completion_rate from ods_caiwu_feecollection union all select organ_code, organ_name, comm_id, comm_name, yr_month, category, '成本' yslx, index_cost_target, index_cost_fact, cost_completion_rate from ods_caiwu_feecollection union all select organ_code, organ_name, comm_id, comm_name, yr_month, category, '利润' yslx, index_profit_target, profit_completion_rate, income_completion_rate from ods_caiwu_feecollection union all select organ_code, organ_name, comm_id, comm_name, yr_month, category, '市拓' yslx, index_market_target, index_market_fact, market_completion_rate from ods_caiwu_feecollection ) a where yslx = ${"'" + p_yslx + "'"} ${if(len(p_startdate) == 0,"","and yr_month = '" + p_startdate + "'")} ${if(len(p_area) == 0,"","and organ_code = '" + p_area+ "'")}