|
@@ -119,100 +119,102 @@
|
|
|
,max(PLAN_COST_11) as PLAN_COST_11,max(PLAN_QUANTITIES_11) as PLAN_QUANTITIES_11
|
|
|
,max(PLAN_COST_12) as PLAN_COST_12,max(PLAN_QUANTITIES_12) as PLAN_QUANTITIES_12
|
|
|
from(
|
|
|
- select *
|
|
|
- ,case when month=1 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_1
|
|
|
- ,case when month=1 then ACTUAL_COST else null end ACTUAL_COST_1
|
|
|
- ,case when month=1 then PAY_COST else null end PAY_COST_1
|
|
|
- ,case when month=1 then RATIO else null end RATIO_1
|
|
|
- ,case when month=2 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_2
|
|
|
- ,case when month=2 then ACTUAL_COST else null end ACTUAL_COST_2
|
|
|
- ,case when month=2 then PAY_COST else null end PAY_COST_2
|
|
|
- ,case when month=2 then RATIO else null end RATIO_2
|
|
|
- ,case when month=3 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_3
|
|
|
- ,case when month=3 then ACTUAL_COST else null end ACTUAL_COST_3
|
|
|
- ,case when month=3 then PAY_COST else null end PAY_COST_3
|
|
|
- ,case when month=3 then RATIO else null end RATIO_3
|
|
|
- ,case when month=4 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_4
|
|
|
- ,case when month=4 then ACTUAL_COST else null end ACTUAL_COST_4
|
|
|
- ,case when month=4 then PAY_COST else null end PAY_COST_4
|
|
|
- ,case when month=4 then RATIO else null end RATIO_4
|
|
|
- ,case when month=5 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_5
|
|
|
- ,case when month=5 then ACTUAL_COST else null end ACTUAL_COST_5
|
|
|
- ,case when month=5 then PAY_COST else null end PAY_COST_5
|
|
|
- ,case when month=5 then RATIO else null end RATIO_5
|
|
|
- ,case when month=6 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_6
|
|
|
- ,case when month=6 then ACTUAL_COST else null end ACTUAL_COST_6
|
|
|
- ,case when month=6 then PAY_COST else null end PAY_COST_6
|
|
|
- ,case when month=6 then RATIO else null end RATIO_6
|
|
|
- ,case when month=7 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_7
|
|
|
- ,case when month=7 then ACTUAL_COST else null end ACTUAL_COST_7
|
|
|
- ,case when month=7 then PAY_COST else null end PAY_COST_7
|
|
|
- ,case when month=7 then RATIO else null end RATIO_7
|
|
|
- ,case when month=8 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_8
|
|
|
- ,case when month=8 then ACTUAL_COST else null end ACTUAL_COST_8
|
|
|
- ,case when month=8 then PAY_COST else null end PAY_COST_8
|
|
|
- ,case when month=8 then RATIO else null end RATIO_8
|
|
|
- ,case when month=9 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_9
|
|
|
- ,case when month=9 then ACTUAL_COST else null end ACTUAL_COST_9
|
|
|
- ,case when month=9 then PAY_COST else null end PAY_COST_9
|
|
|
- ,case when month=9 then RATIO else null end RATIO_9
|
|
|
- ,case when month=10 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_10
|
|
|
- ,case when month=10 then ACTUAL_COST else null end ACTUAL_COST_10
|
|
|
- ,case when month=10 then PAY_COST else null end PAY_COST_10
|
|
|
- ,case when month=10 then RATIO else null end RATIO_10
|
|
|
- ,case when month=11 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_11
|
|
|
- ,case when month=11 then ACTUAL_COST else null end ACTUAL_COST_11
|
|
|
- ,case when month=11 then PAY_COST else null end PAY_COST_11
|
|
|
- ,case when month=11 then RATIO else null end RATIO_11
|
|
|
- ,case when month=12 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_12
|
|
|
- ,case when month=12 then ACTUAL_COST else null end ACTUAL_COST_12
|
|
|
- ,case when month=12 then PAY_COST else null end PAY_COST_12
|
|
|
- ,case when month=12 then RATIO else null end RATIO_12
|
|
|
- from ${TABLETYPE}
|
|
|
- where YEAR = #{YEAR} and COMPANY_ID = #{COMPANY_ID}
|
|
|
- <if test="ROADS != null and ROADS != ''">
|
|
|
- AND ROAD IN
|
|
|
- <foreach collection="ROADS" item="ROADS" index="index"
|
|
|
- open="(" close=")" separator=",">
|
|
|
- #{ROADS}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
+
|
|
|
+
|
|
|
+ select *
|
|
|
+ ,case when month=1 then PLAN_COST else null end PLAN_COST_1
|
|
|
+ ,case when month=1 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_1
|
|
|
+ ,case when month=2 then PLAN_COST else null end PLAN_COST_2
|
|
|
+ ,case when month=2 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_2
|
|
|
+ ,case when month=3 then PLAN_COST else null end PLAN_COST_3
|
|
|
+ ,case when month=3 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_3
|
|
|
+ ,case when month=4 then PLAN_COST else null end PLAN_COST_4
|
|
|
+ ,case when month=4 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_4
|
|
|
+ ,case when month=5 then PLAN_COST else null end PLAN_COST_5
|
|
|
+ ,case when month=5 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_5
|
|
|
+ ,case when month=6 then PLAN_COST else null end PLAN_COST_6
|
|
|
+ ,case when month=6 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_6
|
|
|
+ ,case when month=7 then PLAN_COST else null end PLAN_COST_7
|
|
|
+ ,case when month=7 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_7
|
|
|
+ ,case when month=8 then PLAN_COST else null end PLAN_COST_8
|
|
|
+ ,case when month=8 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_8
|
|
|
+ ,case when month=9 then PLAN_COST else null end PLAN_COST_9
|
|
|
+ ,case when month=9 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_9
|
|
|
+ ,case when month=10 then PLAN_COST else null end PLAN_COST_10
|
|
|
+ ,case when month=10 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_10
|
|
|
+ ,case when month=11 then PLAN_COST else null end PLAN_COST_11
|
|
|
+ ,case when month=11 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_11
|
|
|
+ ,case when month=12 then PLAN_COST else null end PLAN_COST_12
|
|
|
+ ,case when month=12 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_12
|
|
|
+ from monthly_plan_record
|
|
|
+ where PROJECT_TYPE = #{subtable} and YEAR = #{YEAR} and COMPANY_ID = #{COMPANY_ID}
|
|
|
+ <if test="ROADS != null and ROADS != ''">
|
|
|
+ AND ROAD IN
|
|
|
+ <foreach collection="ROADS" item="ROADS" index="index"
|
|
|
+ open="(" close=")" separator=",">
|
|
|
+ #{ROADS}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
)yb
|
|
|
left join (
|
|
|
- select *
|
|
|
- ,case when month=1 then PLAN_COST else null end PLAN_COST_1
|
|
|
- ,case when month=1 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_1
|
|
|
- ,case when month=2 then PLAN_COST else null end PLAN_COST_2
|
|
|
- ,case when month=2 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_2
|
|
|
- ,case when month=3 then PLAN_COST else null end PLAN_COST_3
|
|
|
- ,case when month=3 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_3
|
|
|
- ,case when month=4 then PLAN_COST else null end PLAN_COST_4
|
|
|
- ,case when month=4 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_4
|
|
|
- ,case when month=5 then PLAN_COST else null end PLAN_COST_5
|
|
|
- ,case when month=5 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_5
|
|
|
- ,case when month=6 then PLAN_COST else null end PLAN_COST_6
|
|
|
- ,case when month=6 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_6
|
|
|
- ,case when month=7 then PLAN_COST else null end PLAN_COST_7
|
|
|
- ,case when month=7 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_7
|
|
|
- ,case when month=8 then PLAN_COST else null end PLAN_COST_8
|
|
|
- ,case when month=8 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_8
|
|
|
- ,case when month=9 then PLAN_COST else null end PLAN_COST_9
|
|
|
- ,case when month=9 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_9
|
|
|
- ,case when month=10 then PLAN_COST else null end PLAN_COST_10
|
|
|
- ,case when month=10 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_10
|
|
|
- ,case when month=11 then PLAN_COST else null end PLAN_COST_11
|
|
|
- ,case when month=11 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_11
|
|
|
- ,case when month=12 then PLAN_COST else null end PLAN_COST_12
|
|
|
- ,case when month=12 then PLAN_QUANTITIES else null end PLAN_QUANTITIES_12
|
|
|
- from monthly_plan_record
|
|
|
- where PROJECT_TYPE = #{subtable} and YEAR = #{YEAR} and COMPANY_ID = #{COMPANY_ID}
|
|
|
- <if test="ROADS != null and ROADS != ''">
|
|
|
- AND ROAD IN
|
|
|
- <foreach collection="ROADS" item="ROADS" index="index"
|
|
|
- open="(" close=")" separator=",">
|
|
|
- #{ROADS}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
+ select *
|
|
|
+ ,case when month=1 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_1
|
|
|
+ ,case when month=1 then ACTUAL_COST else null end ACTUAL_COST_1
|
|
|
+ ,case when month=1 then PAY_COST else null end PAY_COST_1
|
|
|
+ ,case when month=1 then RATIO else null end RATIO_1
|
|
|
+ ,case when month=2 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_2
|
|
|
+ ,case when month=2 then ACTUAL_COST else null end ACTUAL_COST_2
|
|
|
+ ,case when month=2 then PAY_COST else null end PAY_COST_2
|
|
|
+ ,case when month=2 then RATIO else null end RATIO_2
|
|
|
+ ,case when month=3 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_3
|
|
|
+ ,case when month=3 then ACTUAL_COST else null end ACTUAL_COST_3
|
|
|
+ ,case when month=3 then PAY_COST else null end PAY_COST_3
|
|
|
+ ,case when month=3 then RATIO else null end RATIO_3
|
|
|
+ ,case when month=4 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_4
|
|
|
+ ,case when month=4 then ACTUAL_COST else null end ACTUAL_COST_4
|
|
|
+ ,case when month=4 then PAY_COST else null end PAY_COST_4
|
|
|
+ ,case when month=4 then RATIO else null end RATIO_4
|
|
|
+ ,case when month=5 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_5
|
|
|
+ ,case when month=5 then ACTUAL_COST else null end ACTUAL_COST_5
|
|
|
+ ,case when month=5 then PAY_COST else null end PAY_COST_5
|
|
|
+ ,case when month=5 then RATIO else null end RATIO_5
|
|
|
+ ,case when month=6 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_6
|
|
|
+ ,case when month=6 then ACTUAL_COST else null end ACTUAL_COST_6
|
|
|
+ ,case when month=6 then PAY_COST else null end PAY_COST_6
|
|
|
+ ,case when month=6 then RATIO else null end RATIO_6
|
|
|
+ ,case when month=7 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_7
|
|
|
+ ,case when month=7 then ACTUAL_COST else null end ACTUAL_COST_7
|
|
|
+ ,case when month=7 then PAY_COST else null end PAY_COST_7
|
|
|
+ ,case when month=7 then RATIO else null end RATIO_7
|
|
|
+ ,case when month=8 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_8
|
|
|
+ ,case when month=8 then ACTUAL_COST else null end ACTUAL_COST_8
|
|
|
+ ,case when month=8 then PAY_COST else null end PAY_COST_8
|
|
|
+ ,case when month=8 then RATIO else null end RATIO_8
|
|
|
+ ,case when month=9 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_9
|
|
|
+ ,case when month=9 then ACTUAL_COST else null end ACTUAL_COST_9
|
|
|
+ ,case when month=9 then PAY_COST else null end PAY_COST_9
|
|
|
+ ,case when month=9 then RATIO else null end RATIO_9
|
|
|
+ ,case when month=10 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_10
|
|
|
+ ,case when month=10 then ACTUAL_COST else null end ACTUAL_COST_10
|
|
|
+ ,case when month=10 then PAY_COST else null end PAY_COST_10
|
|
|
+ ,case when month=10 then RATIO else null end RATIO_10
|
|
|
+ ,case when month=11 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_11
|
|
|
+ ,case when month=11 then ACTUAL_COST else null end ACTUAL_COST_11
|
|
|
+ ,case when month=11 then PAY_COST else null end PAY_COST_11
|
|
|
+ ,case when month=11 then RATIO else null end RATIO_11
|
|
|
+ ,case when month=12 then ACTUAL_QUANTITIES else null end ACTUAL_QUANTITIES_12
|
|
|
+ ,case when month=12 then ACTUAL_COST else null end ACTUAL_COST_12
|
|
|
+ ,case when month=12 then PAY_COST else null end PAY_COST_12
|
|
|
+ ,case when month=12 then RATIO else null end RATIO_12
|
|
|
+ from ${TABLETYPE}
|
|
|
+ where YEAR = #{YEAR} and COMPANY_ID = #{COMPANY_ID}
|
|
|
+ <if test="ROADS != null and ROADS != ''">
|
|
|
+ AND ROAD IN
|
|
|
+ <foreach collection="ROADS" item="ROADS" index="index"
|
|
|
+ open="(" close=")" separator=",">
|
|
|
+ #{ROADS}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
)mpr
|
|
|
on yb.YEAR = mpr.YEAR and yb.COMPANY_ID = mpr.COMPANY_ID and yb.ROAD_ID = mpr.ROAD_ID
|
|
|
and yb.PROJECT_NAME = mpr.PROJECT_NAME
|