monthly_scientific_project_completion
monthly_scientific_report_list
highway_scientific_project_dettable
COMPANY,
COMPANY_ID,
ROAD,
ROAD_ID,
YEAR,
PROJECT_NAME,
MONTH,
ACTUAL_COST,
PAY_COST,
RATIO
#{item.company},
#{item.companyId},
#{item.road},
#{item.roadId},
#{item.year},
#{item.projectName},
#{item.month},
#{item.actualCost},
#{item.payCost},
#{item.ratio}
SELECT
*
FROM
WHERE
YEAR = #{year}
AND COMPANY_ID IN
#{companyIds}
ORDER BY COMPANY_ID ASC ,ROAD_ID ASC
select
from
WHERE
YEAR = #{year}
AND COMPANY_ID IN
#{companyIds}
SELECT
COMPANY_ID,
ROAD_ID,
SUM(ACTUAL_COST) SUM_ACTUAL_COST,
SUM(PAY_COST) SUM_PAY_COST,
SUM(RATIO) SUM_RATIO
FROM
WHERE
YEAR = #{year}
AND COMPANY_ID IN
#{companyIds}
GROUP BY COMPANY_ID,ROAD_ID
insert into
(
)
values
(
)
delete from
where
YEAR = #{year}
AND MONTH = #{month}
AND COMPANY_ID IN
#{companyIds}
select
*
from
where
1=1
and
(
NAME LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
)
and COMPANY = #{COMPANY}
insert into
(
COMPANY, COMPANY_ID,YEAR,NAME,STATUS,CTIME, MTIME
) values (
#{COMPANY}, #{COMPANY_ID}, #{YEAR}, #{NAME}, #{STATUS}, #{CTIME}, #{MTIME}
)
delete from
where
COMPANY_ID = #{COMPANY_ID}
AND YEAR = #{YEAR}
delete from
where
COMPANY_ID = #{COMPANY_ID}
AND YEAR = #{YEAR}
select * from(
select
@f:= case when @ROAD_ID2=c.ROAD_ID then '0' else '1' end flag,
@ROAD_ID2:=c.ROAD_ID1 ROAD_ID2,
c.*,cast(num as char)numstr
from(
SELECT
@r:= case when @ROAD_ID=a.ROAD_ID then @r+1 else 1 end num,
@ROAD_ID:=a.ROAD_ID ROAD_ID1,
a.*
from(
select h.COMPANY_ID,h.COMPANY,h.ROAD_ID,h.ROAD,h.YEAR,h.PROJECT_NAME,
h.CATEGORY,h.CONTENT,h.YEAR_COST as PROJECT_COST,IFNULL(h.AUDIT_FEE,h.YEAR_COST) as AUDIT_FEE,
h.MATTER_YEAR,h.MATTER_NEW_CARRY,h.MATTER_CONSULT,
h.AUDIT_MAKER,h.XMWCQKSM as ACTUAL_QUANTITIES,
m.ACTUAL_COST_1,m.PAY_COST_1,m.RATIO_1,m.ACTUAL_COST_2,m.PAY_COST_2,m.RATIO_2,m.ACTUAL_COST_3,m.PAY_COST_3,m.RATIO_3,
m.ACTUAL_COST_4,m.PAY_COST_4,m.RATIO_4,m.ACTUAL_COST_5,m.PAY_COST_5,m.RATIO_5,m.ACTUAL_COST_6,m.PAY_COST_6,m.RATIO_6,
m.ACTUAL_COST_7,m.PAY_COST_7,m.RATIO_7,m.ACTUAL_COST_8,m.PAY_COST_8,m.RATIO_8,m.ACTUAL_COST_9,m.PAY_COST_9,m.RATIO_9,
m.ACTUAL_COST_10,m.PAY_COST_10,m.RATIO_10,m.ACTUAL_COST_11,m.PAY_COST_11,m.RATIO_11,m.ACTUAL_COST_12,m.PAY_COST_12,m.RATIO_12
from ${subtable} h
left join (
select yb.COMPANY_ID,yb.ROAD_ID,yb.YEAR,yb.PROJECT_NAME
,max(ACTUAL_COST_1) as ACTUAL_COST_1,max(PAY_COST_1) as PAY_COST_1,max(RATIO_1) as RATIO_1
,max(ACTUAL_COST_2) as ACTUAL_COST_2,max(PAY_COST_2) as PAY_COST_2,max(RATIO_2) as RATIO_2
,max(ACTUAL_COST_3) as ACTUAL_COST_3,max(PAY_COST_3) as PAY_COST_3,max(RATIO_3) as RATIO_3
,max(ACTUAL_COST_4) as ACTUAL_COST_4,max(PAY_COST_4) as PAY_COST_4,max(RATIO_4) as RATIO_4
,max(ACTUAL_COST_5) as ACTUAL_COST_5,max(PAY_COST_5) as PAY_COST_5,max(RATIO_5) as RATIO_5
,max(ACTUAL_COST_6) as ACTUAL_COST_6,max(PAY_COST_6) as PAY_COST_6,max(RATIO_6) as RATIO_6
,max(ACTUAL_COST_7) as ACTUAL_COST_7,max(PAY_COST_7) as PAY_COST_7,max(RATIO_7) as RATIO_7
,max(ACTUAL_COST_8) as ACTUAL_COST_8,max(PAY_COST_8) as PAY_COST_8,max(RATIO_8) as RATIO_8
,max(ACTUAL_COST_9) as ACTUAL_COST_9,max(PAY_COST_9) as PAY_COST_9,max(RATIO_9) as RATIO_9
,max(ACTUAL_COST_10) as ACTUAL_COST_10,max(PAY_COST_10) as PAY_COST_10,max(RATIO_10) as RATIO_10
,max(ACTUAL_COST_11) as ACTUAL_COST_11,max(PAY_COST_11) as PAY_COST_11,max(RATIO_11) as RATIO_11
,max(ACTUAL_COST_12) as ACTUAL_COST_12,max(PAY_COST_12) as PAY_COST_12,max(RATIO_12) as RATIO_12
from(
select *
,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_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_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_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_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_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_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_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_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_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_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_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}
AND ROAD IN
#{ROADS}
)yb group by yb.YEAR,yb.COMPANY_ID,yb.ROAD_ID,yb.PROJECT_NAME
) m
on h.YEAR = m.YEAR and h.COMPANY_ID = m.COMPANY_ID and h.PROJECT_NAME = m.PROJECT_NAME
where h.YEAR = #{YEAR} and h.COMPANY_ID = #{COMPANY_ID}
AND ROAD IN
#{ROADS}
)a
,(select @r:=0 ,@ROAD_ID:='',@c:=1) b
order by COMPANY_ID,ROAD_ID,num desc
)c
,(select @f:=0,@ROAD_ID2:='') d
)e
order by COMPANY_ID,ROAD_ID,num
delete from ${TABLETYPE}
where YEAR = #{YEAR} AND COMPANY_ID = #{COMPANY_ID} AND ROAD_ID = #{ROAD_ID} AND PROJECT_NAME = #{PROJECT_NAME}
insert into ${TABLETYPE}(
COMPANY,COMPANY_ID,ROAD,ROAD_ID,YEAR,PROJECT_NAME,MONTH,ACTUAL_COST,PAY_COST,RATIO,ACTUAL_QUANTITIES
)values(
#{COMPANY}, #{COMPANY_ID}, #{ROAD}, #{ROAD_ID}, #{YEAR}, #{PROJECT_NAME}, #{MONTH}, #{ACTUAL_COST}, #{PAY_COST}, #{RATIO},#{ACTUAL_QUANTITIES}
)
update ${TABLE_NAME}
set XMWCQKSM=#{SJWCGCL}
where YEAR = #{YEAR} AND COMPANY_ID = #{COMPANY_ID} AND ROAD_ID = #{ROAD_ID} AND PROJECT_NAME = #{PROJECT_NAME}