|
@@ -42,13 +42,13 @@ select
|
|
|
from
|
|
|
car.car_base_data_month
|
|
|
where
|
|
|
- nian_yue = (
|
|
|
+ year_month = (
|
|
|
select
|
|
|
- max(nian_yue)
|
|
|
+ max(year_month)
|
|
|
from
|
|
|
car.car_base_data_month)
|
|
|
<if test="dto.city != null and dto.city != ''">
|
|
|
- and di_shi = #{dto.city}
|
|
|
+ and first_unit = #{dto.city}
|
|
|
</if>
|
|
|
</script>
|
|
|
""")
|
|
@@ -66,9 +66,9 @@ select
|
|
|
from
|
|
|
car.car_base_data_month
|
|
|
where
|
|
|
- nian_yue = (
|
|
|
+ year_month = (
|
|
|
select
|
|
|
- max(nian_yue)
|
|
|
+ max(year_month)
|
|
|
from
|
|
|
car.car_base_data_month)
|
|
|
and city is not null
|
|
@@ -83,9 +83,9 @@ select
|
|
|
from
|
|
|
car.car_di_xiao_month
|
|
|
where
|
|
|
- nian_yue = (
|
|
|
+ year_month = (
|
|
|
select
|
|
|
- max(nian_yue)
|
|
|
+ max(year_month)
|
|
|
from
|
|
|
car.car_di_xiao_month)
|
|
|
and city is not null
|
|
@@ -122,9 +122,9 @@ select
|
|
|
from
|
|
|
car.car_base_data_month
|
|
|
where
|
|
|
- nian_yue = (
|
|
|
+ year_month = (
|
|
|
select
|
|
|
- max(nian_yue)
|
|
|
+ max(year_month)
|
|
|
from
|
|
|
car.car_base_data_month)
|
|
|
and district is not null
|
|
@@ -140,9 +140,9 @@ select
|
|
|
from
|
|
|
car.car_di_xiao_month
|
|
|
where
|
|
|
- nian_yue = (
|
|
|
+ year_month = (
|
|
|
select
|
|
|
- max(nian_yue)
|
|
|
+ max(year_month)
|
|
|
from
|
|
|
car.car_di_xiao_month)
|
|
|
and district is not null
|
|
@@ -175,7 +175,7 @@ select * from t104 order by area_name
|
|
|
with
|
|
|
t101 as (
|
|
|
select
|
|
|
- di_shi,
|
|
|
+ first_unit,
|
|
|
avg(zong_li_cheng) as mileage,
|
|
|
avg(chu_qin_lv) as attendanceRate
|
|
|
from
|
|
@@ -186,12 +186,12 @@ where
|
|
|
max(year_no)
|
|
|
from
|
|
|
car.car_li_cheng_month)
|
|
|
- and di_shi is not null
|
|
|
- and di_shi != ''
|
|
|
- and di_shi != '省公司本部'
|
|
|
+ and first_unit is not null
|
|
|
+ and first_unit != ''
|
|
|
+ and first_unit != '省公司本部'
|
|
|
and position('建设部' in che_liang_suo_shu_dan_wei) = 0
|
|
|
group by
|
|
|
- di_shi
|
|
|
+ first_unit
|
|
|
),
|
|
|
t102 as (
|
|
|
select
|
|
@@ -200,11 +200,11 @@ select
|
|
|
from
|
|
|
t101
|
|
|
left join car.car_second_unit_sort on
|
|
|
- t101.di_shi = car.car_second_unit_sort.second_unit
|
|
|
+ t101.first_unit = car.car_second_unit_sort.second_unit
|
|
|
),
|
|
|
t103 as (
|
|
|
select
|
|
|
- di_shi as area_name,
|
|
|
+ first_unit as area_name,
|
|
|
round(mileage,
|
|
|
2) as mileage,
|
|
|
round(attendanceRate * 100,
|
|
@@ -229,7 +229,7 @@ from
|
|
|
with
|
|
|
t101 as (
|
|
|
select
|
|
|
- er_ji_dan_wei,
|
|
|
+ second_unit,
|
|
|
avg(zong_li_cheng) as mileage,
|
|
|
avg(chu_qin_lv) as attendanceRate
|
|
|
from
|
|
@@ -240,15 +240,15 @@ where
|
|
|
max(year_no)
|
|
|
from
|
|
|
car.car_li_cheng_month)
|
|
|
- and er_ji_dan_wei is not null
|
|
|
- and er_ji_dan_wei != ''
|
|
|
- and di_shi = #{dto.city}
|
|
|
+ and second_unit is not null
|
|
|
+ and second_unit != ''
|
|
|
+ and first_unit = #{dto.city}
|
|
|
group by
|
|
|
- er_ji_dan_wei
|
|
|
+ second_unit
|
|
|
),
|
|
|
t102 as (
|
|
|
select
|
|
|
- er_ji_dan_wei as area_name,
|
|
|
+ second_unit as area_name,
|
|
|
round(mileage,
|
|
|
2) as mileage,
|
|
|
round(attendanceRate * 100,
|
|
@@ -256,7 +256,7 @@ select
|
|
|
from
|
|
|
t101
|
|
|
order by
|
|
|
- er_ji_dan_wei
|
|
|
+ second_unit
|
|
|
)
|
|
|
select
|
|
|
*
|
|
@@ -272,7 +272,7 @@ from
|
|
|
with
|
|
|
t101 as (
|
|
|
select
|
|
|
- di_shi,
|
|
|
+ first_unit,
|
|
|
sum(zong_fei_yong) as cost_sum,
|
|
|
avg(zong_fei_yong) as cost_avg
|
|
|
from
|
|
@@ -283,12 +283,12 @@ where
|
|
|
max(year_no)
|
|
|
from
|
|
|
car.car_fei_yong_month)
|
|
|
- and di_shi is not null
|
|
|
- and di_shi != ''
|
|
|
+ and first_unit is not null
|
|
|
+ and first_unit != ''
|
|
|
and position('建设部' in che_liang_suo_shu_dan_wei) = 0
|
|
|
and rui_xing = 1
|
|
|
group by
|
|
|
- di_shi
|
|
|
+ first_unit
|
|
|
),
|
|
|
t102 as (
|
|
|
select
|
|
@@ -297,11 +297,11 @@ select
|
|
|
from
|
|
|
t101
|
|
|
left join car.car_second_unit_sort on
|
|
|
- t101.di_shi = car.car_second_unit_sort.second_unit
|
|
|
+ t101.first_unit = car.car_second_unit_sort.second_unit
|
|
|
),
|
|
|
t103 as (
|
|
|
select
|
|
|
- di_shi as area_name,
|
|
|
+ first_unit as area_name,
|
|
|
round(cost_sum,
|
|
|
2) as cost_sum,
|
|
|
round(cost_avg,
|
|
@@ -326,7 +326,7 @@ from
|
|
|
with
|
|
|
t101 as (
|
|
|
select
|
|
|
- er_ji_dan_wei,
|
|
|
+ second_unit,
|
|
|
sum(zong_fei_yong) as cost_sum,
|
|
|
avg(zong_fei_yong) as cost_avg
|
|
|
from
|
|
@@ -337,16 +337,16 @@ where
|
|
|
max(year_no)
|
|
|
from
|
|
|
car.car_fei_yong_month)
|
|
|
- and er_ji_dan_wei is not null
|
|
|
- and er_ji_dan_wei != ''
|
|
|
+ and second_unit is not null
|
|
|
+ and second_unit != ''
|
|
|
and rui_xing = 1
|
|
|
- and di_shi = #{dto.city}
|
|
|
+ and first_unit = #{dto.city}
|
|
|
group by
|
|
|
- er_ji_dan_wei
|
|
|
+ second_unit
|
|
|
),
|
|
|
t102 as (
|
|
|
select
|
|
|
- er_ji_dan_wei as area_name,
|
|
|
+ second_unit as area_name,
|
|
|
round(cost_sum,
|
|
|
2) as cost_sum,
|
|
|
round(cost_avg,
|
|
@@ -354,7 +354,7 @@ select
|
|
|
from
|
|
|
t101
|
|
|
order by
|
|
|
- er_ji_dan_wei
|
|
|
+ second_unit
|
|
|
)
|
|
|
select
|
|
|
*
|