1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="PlanInputMapper">
-
- <select id="companyInputChartData" parameterType="pd" resultType="pd">
- select PCOMPANY as COMPANY,
- sum(ifnull(DAILY_COMPLETE,0) + ifnull(MINOR_PREVENTION_COMPLETE,0) + ifnull(MIDDLE_PREVENTION_COMPLETE,0) + ifnull(OVERHAUL_PREVENTION_COMPLETE,0)
- + ifnull(MINOR_REPAIR_COMPLETE,0) + ifnull(MIDDLE_REPAIR_COMPLETE,0) + ifnull(OVERHAUL_COMPLETE,0)
- + ifnull(SPECIAL_COMPLETE,0) + ifnull(TEST_COMPLETE,0) + ifnull(SCIENTIFIC_COMPLETE,0) + ifnull(DEVICE_COMPLETE,0) + ifnull(RESERVE_COMPLETE,0) + ifnull(EMERGENCY_COMPLETE,0))
- as DAILY_COMPLETE
- from annual_comp_sumtable_view
- <if test="YEAR!= ''">
- where YEAR = #{YEAR}
- </if>
- group by PCOMPANY_ID
- </select>
-
- <select id="chartsData" parameterType="pd" resultType="pd">
- select YEAR,
- sum(ifnull(DAILY_COMPLETE,0) + ifnull(MINOR_PREVENTION_COMPLETE,0) + ifnull(MIDDLE_PREVENTION_COMPLETE,0) + ifnull(OVERHAUL_PREVENTION_COMPLETE,0)
- + ifnull(MINOR_REPAIR_COMPLETE,0) + ifnull(MIDDLE_REPAIR_COMPLETE,0) + ifnull(OVERHAUL_COMPLETE,0)
- + ifnull(SPECIAL_COMPLETE,0) + ifnull(TEST_COMPLETE,0) + ifnull(SCIENTIFIC_COMPLETE,0) + ifnull(DEVICE_COMPLETE,0) + ifnull(RESERVE_COMPLETE,0) + ifnull(EMERGENCY_COMPLETE,0))
- as DAILY_COMPLETE,
- sum(ifnull(DAILY_DESIGN,0) + ifnull(MINOR_PREVENTION_DESIGN,0) + ifnull(MIDDLE_PREVENTION_DESIGN,0) + ifnull(OVERHAUL_PREVENTION_DESIGN,0)
- + ifnull(MINOR_REPAIR_DESIGN,0) + ifnull(MIDDLE_REPAIR_DESIGN,0) + ifnull(OVERHAUL_DESIGN,0)
- + ifnull(SPECIAL_DESIGN,0) + ifnull(TEST_DESIGN,0) + ifnull(SCIENTIFIC_DESIGN,0) + ifnull(DEVICE_DESIGN,0) + ifnull(RESERVE_DESIGN,0) + ifnull(EMERGENCY_DESIGN,0))
- as DAILY_DESIGN
- from annual_comp_sumtable_view
- <if test="companyName!= ''">
- where PCOMPANY = #{companyName}
- </if>
- group by YEAR
- order by YEAR
- </select>
-
- <select id="projectInputChartsData" parameterType="pd" resultType="pd">
- select CATEGORY,sum(ACTUAL_COST) as ACTUAL_COST from (
- select a.YEAR,CATEGORY,ACTUAL_COST
- from monthly_prevention_completion a left join highway_prevention_project_dettable b
- on a.COMPANY_ID = b.COMPANY_ID and a.YEAR = b.YEAR
- and a.ROAD_ID = b.ROAD_ID and a.PROJECT_NAME = b.PROJECT_NAME
- <if test="YEAR!= '' ">
- where a.YEAR = #{YEAR}
- </if>
- <if test="companyName!= ''">
- and a.COMPANY = #{companyName}
- </if>
- union all
- select a.YEAR,CATEGORY,ACTUAL_COST
- from monthly_repair_completion a left join highway_repair_project_dettable b
- on a.COMPANY_ID = b.COMPANY_ID and a.YEAR = b.YEAR
- and a.ROAD_ID = b.ROAD_ID and a.PROJECT_NAME = b.PROJECT_NAME
- <if test="YEAR!= '' ">
- where a.YEAR = #{YEAR}
- </if>
- <if test="companyName!= ''">
- and a.COMPANY = #{companyName}
- </if>
- union all
- select a.YEAR,CATEGORY,ACTUAL_COST
- from monthly_special_completion a left join highway_special_project_dettable b
- on a.COMPANY_ID = b.COMPANY_ID and a.YEAR = b.YEAR
- and a.ROAD_ID = b.ROAD_ID and a.PROJECT_NAME = b.PROJECT_NAME
- <if test="YEAR!= '' ">
- where a.YEAR = #{YEAR}
- </if>
- <if test="companyName!= ''">
- and a.COMPANY = #{companyName}
- </if>
- union all
- select a.YEAR,CATEGORY,ACTUAL_COST
- from monthly_test_project_completion a left join highway_test_project_dettable b
- on a.COMPANY_ID = b.COMPANY_ID and a.YEAR = b.YEAR
- and a.ROAD_ID = b.ROAD_ID and a.PROJECT_NAME = b.PROJECT_NAME
- <if test="YEAR!= '' ">
- where a.YEAR = #{YEAR}
- </if>
- <if test="companyName!= ''">
- and a.COMPANY = #{companyName}
- </if>
- union all
- select a.YEAR,CATEGORY,ACTUAL_COST
- from monthly_scientific_project_completion a left join highway_scientific_project_dettable b
- on a.COMPANY_ID = b.COMPANY_ID and a.YEAR = b.YEAR
- and a.ROAD_ID = b.ROAD_ID and a.PROJECT_NAME = b.PROJECT_NAME
- <if test="YEAR!= '' ">
- where a.YEAR = #{YEAR}
- </if>
- <if test="companyName!= ''">
- and a.COMPANY = #{companyName}
- </if>
- union all
- select a.YEAR,CATEGORY,ACTUAL_COST
- from monthly_emergency_completion a left join highway_emergency_project_dettable b
- on a.COMPANY_ID = b.COMPANY_ID and a.YEAR = b.YEAR
- and a.ROAD_ID = b.ROAD_ID and a.PROJECT_NAME = b.PROJECT_NAME
- <if test="YEAR!= '' ">
- where a.YEAR = #{YEAR}
- </if>
- <if test="companyName!= ''">
- and a.COMPANY = #{companyName}
- </if>
- )a
- group by CATEGORY
- </select>
-
- <select id="getCompanyList" parameterType="String" resultType="pd">
- select NAME,BIANMA from oa_department
- where PARENT_ID = '0'
- <if test="_parameter != ''">
- and NAME = #{_parameter}
- </if>
- ORDER BY BIANMA ASC
- </select>
-
- <select id="getDataByScale" parameterType="pd" resultType="pd">
- select e.* from (
- select
- @f:= case when @company_id2=c.company_id then '0' else '1' end as flag,
- @company_id2:=c.company_id1 as company_id2,
- c.*,cast(num as char) as numstr
- from (
- SELECT
- @r:= case when @company_id=a.company_id then @r+1 else 1 end num,
- @company_id:=a.company_id as company_id1,
- a.*
- from(
- select COMPANY,COMPANY_ID,ROAD_ID,ROAD,<include refid="scaleCol"></include>
- from (
- <if test="datatype == 1">
- <include refid="planByscale"></include>
- </if>
- <if test="datatype == 2">
- <include refid="compByscale"></include>
- </if>
- ) tab
- where cost is not null
- group by COMPANY,COMPANY_ID,ROAD_ID,ROAD
- order by COMPANY,COMPANY_ID,ROAD_ID,ROAD
- )a
- ,(select @r:=0 ,@company_id:='',@c:=1) b
- order by company_id,num desc
- )c
- ,(select @f:=0,@company_id2:='') d
- )e
- order by company_id,road_id
- </select>
-
- <select id="getData" parameterType="pd" resultType="pd">
- select e.* from (
- select
- @f:= case when @company_id2=c.company_id then '0' else '1' end as flag,
- @company_id2:=c.company_id1 as company_id2,
- c.*,cast(num as char) as numstr
- from (
- SELECT
- @r:= case when @company_id=a.company_id then @r+1 else 1 end num,
- @company_id:=a.company_id as company_id1,
- a.*
- from(
- select COMPANY,COMPANY_ID,ROAD_ID,ROAD,<include refid="col"></include>
- from (
- <if test="datatype == 1">
- <include refid="plan"></include>
- </if>
- <if test="datatype == 2">
- <include refid="comp"></include>
- </if>
- ) tab
- where cost is not null
- group by COMPANY,COMPANY_ID,ROAD_ID,ROAD
- order by COMPANY,COMPANY_ID,ROAD_ID,ROAD
- )a
- ,(select @r:=0 ,@company_id:='',@c:=1) b
- order by company_id,num desc
- )c
- ,(select @f:=0,@company_id2:='') d
- )e
- order by company_id,road_id
- </select>
-
- <select id="getSumDataByScale" parameterType="pd" resultType="pd">
- select
- <if test="groupByCompany == 1">
- COMPANY,COMPANY_ID,
- </if>
- <include refid="scaleCol"></include>
- from (
- <if test="datatype == 1">
- <include refid="planByscale"></include>
- </if>
- <if test="datatype == 2">
- <include refid="compByscale"></include>
- </if>
- ) tab
- where cost is not null
- <if test="groupByCompany == 1">
- group by COMPANY,COMPANY_ID
- order by COMPANY_ID
- </if>
- </select>
-
- <select id="getSumData" parameterType="pd" resultType="pd">
- select
- <if test="groupByCompany == 1">
- COMPANY,COMPANY_ID,
- </if>
- <include refid="col"></include>
- from (
- <if test="datatype == 1">
- <include refid="plan"></include>
- </if>
- <if test="datatype == 2">
- <include refid="comp"></include>
- </if>
- ) tab
- where cost is not null
- <if test="groupByCompany == 1">
- group by COMPANY,COMPANY_ID
- order by COMPANY_ID
- </if>
- </select>
-
- <sql id="col">
- sum(CASE WHEN(type='daily' and category='路基') THEN cost ELSE NULL END ) as daily_subgrade,
- sum(CASE WHEN(type='daily' and category='路面') THEN cost ELSE NULL END ) as daily_pavement,
- sum(CASE WHEN(type='daily' and category='桥梁') THEN cost ELSE NULL END ) as daily_bridge,
- sum(CASE WHEN(type='daily' and category='涵洞通道') THEN cost ELSE NULL END ) as daily_culvert,
- sum(CASE WHEN(type='daily' and category='隧道') THEN cost ELSE NULL END ) as daily_tunnel,
- sum(CASE WHEN(type='daily' and category='交安设施') THEN cost ELSE NULL END ) as daily_safe,
- sum(CASE WHEN(type='daily' and category='沿线设施') THEN cost ELSE NULL END ) as daily_line,
- sum(CASE WHEN(type='daily' and category='绿化') THEN cost ELSE NULL END ) as daily_green,
- sum(CASE WHEN(type='daily' and category='清扫保洁') THEN cost ELSE NULL END ) as daily_clean,
- sum(CASE WHEN(type='daily' and category='巡查检查') THEN cost ELSE NULL END ) as daily_patrol,
- sum(CASE WHEN(type='daily' and category='养护车辆设备') THEN cost ELSE NULL END ) as daily_car,
- sum(CASE WHEN(type='daily' and category='应急保通') THEN cost ELSE NULL END ) as daily_emergency,
-
- sum(CASE WHEN(type='prevention' and category='路基') THEN cost ELSE NULL END ) as prevention_subgrade,
- sum(CASE WHEN(type='prevention' and category='路面') THEN cost ELSE NULL END ) as prevention_pavement,
- sum(CASE WHEN(type='prevention' and category='桥涵') THEN cost ELSE NULL END ) as prevention_bridgeAndCulvert,
- sum(CASE WHEN(type='prevention' and category='隧道') THEN cost ELSE NULL END ) as prevention_tunnel,
-
- sum(CASE WHEN(type='repair' and category='路基') THEN cost ELSE NULL END ) as repair_subgrade,
- sum(CASE WHEN(type='repair' and category='路面') THEN cost ELSE NULL END ) as repair_pavement,
- sum(CASE WHEN(type='repair' and category='桥涵') THEN cost ELSE NULL END ) as repair_bridgeAndCulvert,
- sum(CASE WHEN(type='repair' and category='隧道') THEN cost ELSE NULL END ) as repair_tunnel,
- sum(CASE WHEN(type='repair' and category='交安设施') THEN cost ELSE NULL END ) as repair_safe,
- sum(CASE WHEN(type='repair' and category='沿线设施') THEN cost ELSE NULL END ) as repair_line,
- sum(CASE WHEN(type='repair' and category='绿化') THEN cost ELSE NULL END ) as repair_green,
- sum(CASE WHEN(type='repair' and category='其他') THEN cost ELSE NULL END ) as repair_other,
-
- sum(CASE WHEN(type='special' and category='路基') THEN cost ELSE NULL END ) as special_subgrade,
- sum(CASE WHEN(type='special' and category='路面') THEN cost ELSE NULL END ) as special_pavement,
- sum(CASE WHEN(type='special' and category='桥涵') THEN cost ELSE NULL END ) as special_bridgeAndCulvert,
- sum(CASE WHEN(type='special' and category='隧道') THEN cost ELSE NULL END ) as special_tunnel,
- sum(CASE WHEN(type='special' and category='交安设施') THEN cost ELSE NULL END ) as special_safe,
- sum(CASE WHEN(type='special' and category='沿线设施') THEN cost ELSE NULL END ) as special_line,
- sum(CASE WHEN(type='special' and category='绿化') THEN cost ELSE NULL END ) as special_green,
- sum(CASE WHEN(type='special' and category='其他') THEN cost ELSE NULL END ) as special_other,
-
- sum(CASE WHEN(type='emergency' and category='路基') THEN cost ELSE NULL END ) as emergency_subgrade,
- sum(CASE WHEN(type='emergency' and category='路面') THEN cost ELSE NULL END ) as emergency_pavement,
- sum(CASE WHEN(type='emergency' and category='桥涵') THEN cost ELSE NULL END ) as emergency_bridgeAndCulvert,
- sum(CASE WHEN(type='emergency' and category='隧道') THEN cost ELSE NULL END ) as emergency_tunnel,
- sum(CASE WHEN(type='emergency' and category='交安设施') THEN cost ELSE NULL END ) as emergency_safe,
- sum(CASE WHEN(type='emergency' and category='沿线设施') THEN cost ELSE NULL END ) as emergency_line,
- sum(CASE WHEN(type='emergency' and category='绿化') THEN cost ELSE NULL END ) as emergency_green,
- sum(CASE WHEN(type='emergency' and category='其他') THEN cost ELSE NULL END ) as emergency_other,
-
- sum(CASE WHEN(type='test' and category='路基') THEN cost ELSE NULL END ) as test_subgrade,
- sum(CASE WHEN(type='test' and category='路面') THEN cost ELSE NULL END ) as test_pavement,
- sum(CASE WHEN(type='test' and category='桥涵') THEN cost ELSE NULL END ) as test_bridgeAndCulvert,
- sum(CASE WHEN(type='test' and category='隧道') THEN cost ELSE NULL END ) as test_tunnel,
- sum(CASE WHEN(type='test' and category='交安设施') THEN cost ELSE NULL END ) as test_safe,
- sum(CASE WHEN(type='test' and category='沿线设施') THEN cost ELSE NULL END ) as test_line,
- sum(CASE WHEN(type='test' and category='其他') THEN cost ELSE NULL END ) as test_other,
-
- sum(CASE WHEN(type='scientific' and category='路基') THEN cost ELSE NULL END ) as scientific_subgrade,
- sum(CASE WHEN(type='scientific' and category='路面') THEN cost ELSE NULL END ) as scientific_pavement,
- sum(CASE WHEN(type='scientific' and category='桥隧') THEN cost ELSE NULL END ) as scientific_bridgeAndTunnel,
- sum(CASE WHEN(type='scientific' and category='其他') THEN cost ELSE NULL END ) as scientific_other,
-
- sum(CASE WHEN(type='equipment' and category='noCategory') THEN cost ELSE NULL END ) as equipment_noCategory,
-
- sum(CASE WHEN(type='reserve' and category='noCategory') THEN cost ELSE NULL END ) as reserve_noCategory,
-
- sum(CASE WHEN(category='路基') THEN cost ELSE NULL END ) as subgrade,
- sum(CASE WHEN(category='路面') THEN cost ELSE NULL END ) as pavement,
- sum(CASE WHEN(category='桥梁') THEN cost ELSE NULL END ) as bridge,
- sum(CASE WHEN(category='桥涵') THEN cost ELSE NULL END ) as bridgeAndCulvert,
- sum(CASE WHEN(category='涵洞通道') THEN cost ELSE NULL END ) as culvert,
- sum(CASE WHEN(category='桥隧') THEN cost ELSE NULL END ) as bridgeAndTunnel,
- sum(CASE WHEN(category='隧道') THEN cost ELSE NULL END ) as tunnel,
- sum(CASE WHEN(category='交安设施') THEN cost ELSE NULL END ) as safe,
- sum(CASE WHEN(category='沿线设施') THEN cost ELSE NULL END ) as line,
- sum(CASE WHEN(category='绿化') THEN cost ELSE NULL END ) as green,
- sum(CASE WHEN(category='其他') THEN cost ELSE NULL END ) as other,
- sum(CASE WHEN(category='清扫保洁') THEN cost ELSE NULL END ) as clean,
- sum(CASE WHEN(category='巡查检查') THEN cost ELSE NULL END ) as patrol,
- sum(CASE WHEN(category='养护车辆设备') THEN cost ELSE NULL END ) as car,
- sum(CASE WHEN(category='应急保通') THEN cost ELSE NULL END ) as emergencyC,
-
- sum(CASE WHEN(type='daily') THEN cost ELSE NULL END ) as daily,
- sum(CASE WHEN(type='prevention') THEN cost ELSE NULL END ) as prevention,
- sum(CASE WHEN(type='repair') THEN cost ELSE NULL END ) as repair,
- sum(CASE WHEN(type='special') THEN cost ELSE NULL END ) as special,
- sum(CASE WHEN(type='emergency') THEN cost ELSE NULL END ) as emergency,
- sum(CASE WHEN(type='test') THEN cost ELSE NULL END ) as test,
- sum(CASE WHEN(type='scientific') THEN cost ELSE NULL END ) as scientific,
- sum(CASE WHEN(type='equipment') THEN cost ELSE NULL END ) as equipment,
- sum(CASE WHEN(type='reserve') THEN cost ELSE NULL END ) as reserve,
- sum(cost) as total
- </sql>
-
- <sql id="scaleCol">
- sum(CASE WHEN(type='prevention' and scale='大修' and category='路基') THEN cost ELSE NULL END ) as prevention_max_subgrade,
- sum(CASE WHEN(type='prevention' and scale='大修' and category='路面') THEN cost ELSE NULL END ) as prevention_max_pavement,
- sum(CASE WHEN(type='prevention' and scale='大修' and category='桥涵') THEN cost ELSE NULL END ) as prevention_max_bridgeAndCulvert,
- sum(CASE WHEN(type='prevention' and scale='大修' and category='隧道') THEN cost ELSE NULL END ) as prevention_max_tunnel,
- sum(CASE WHEN(type='prevention' and scale='中修' and category='路基') THEN cost ELSE NULL END ) as prevention_mid_subgrade,
- sum(CASE WHEN(type='prevention' and scale='中修' and category='路面') THEN cost ELSE NULL END ) as prevention_mid_pavement,
- sum(CASE WHEN(type='prevention' and scale='中修' and category='桥涵') THEN cost ELSE NULL END ) as prevention_mid_bridgeAndCulvert,
- sum(CASE WHEN(type='prevention' and scale='中修' and category='隧道') THEN cost ELSE NULL END ) as prevention_mid_tunnel,
- sum(CASE WHEN(type='prevention' and scale='小修' and category='路基') THEN cost ELSE NULL END ) as prevention_min_subgrade,
- sum(CASE WHEN(type='prevention' and scale='小修' and category='路面') THEN cost ELSE NULL END ) as prevention_min_pavement,
- sum(CASE WHEN(type='prevention' and scale='小修' and category='桥涵') THEN cost ELSE NULL END ) as prevention_min_bridgeAndCulvert,
- sum(CASE WHEN(type='prevention' and scale='小修' and category='隧道') THEN cost ELSE NULL END ) as prevention_min_tunnel,
-
- sum(CASE WHEN(type='repair' and scale='大修' and category='路基') THEN cost ELSE NULL END ) as repair_max_subgrade,
- sum(CASE WHEN(type='repair' and scale='大修' and category='路面') THEN cost ELSE NULL END ) as repair_max_pavement,
- sum(CASE WHEN(type='repair' and scale='大修' and category='桥涵') THEN cost ELSE NULL END ) as repair_max_bridgeAndCulvert,
- sum(CASE WHEN(type='repair' and scale='大修' and category='隧道') THEN cost ELSE NULL END ) as repair_max_tunnel,
- sum(CASE WHEN(type='repair' and scale='中修' and category='路基') THEN cost ELSE NULL END ) as repair_mid_subgrade,
- sum(CASE WHEN(type='repair' and scale='中修' and category='路面') THEN cost ELSE NULL END ) as repair_mid_pavement,
- sum(CASE WHEN(type='repair' and scale='中修' and category='桥涵') THEN cost ELSE NULL END ) as repair_mid_bridgeAndCulvert,
- sum(CASE WHEN(type='repair' and scale='中修' and category='隧道') THEN cost ELSE NULL END ) as repair_mid_tunnel,
- sum(CASE WHEN(type='repair' and scale='小修' and category='路基') THEN cost ELSE NULL END ) as repair_min_subgrade,
- sum(CASE WHEN(type='repair' and scale='小修' and category='路面') THEN cost ELSE NULL END ) as repair_min_pavement,
- sum(CASE WHEN(type='repair' and scale='小修' and category='桥涵') THEN cost ELSE NULL END ) as repair_min_bridgeAndCulvert,
- sum(CASE WHEN(type='repair' and scale='小修' and category='隧道') THEN cost ELSE NULL END ) as repair_min_tunnel,
-
- sum(CASE WHEN(scale='大修' and category='路基') THEN cost ELSE NULL END ) as max_subgrade,
- sum(CASE WHEN(scale='大修' and category='路面') THEN cost ELSE NULL END ) as max_pavement,
- sum(CASE WHEN(scale='大修' and category='桥涵') THEN cost ELSE NULL END ) as max_bridgeAndCulvert,
- sum(CASE WHEN(scale='大修' and category='隧道') THEN cost ELSE NULL END ) as max_tunnel,
- sum(CASE WHEN(scale='中修' and category='路基') THEN cost ELSE NULL END ) as mid_subgrade,
- sum(CASE WHEN(scale='中修' and category='路面') THEN cost ELSE NULL END ) as mid_pavement,
- sum(CASE WHEN(scale='中修' and category='桥涵') THEN cost ELSE NULL END ) as mid_bridgeAndCulvert,
- sum(CASE WHEN(scale='中修' and category='隧道') THEN cost ELSE NULL END ) as mid_tunnel,
- sum(CASE WHEN(scale='小修' and category='路基') THEN cost ELSE NULL END ) as min_subgrade,
- sum(CASE WHEN(scale='小修' and category='路面') THEN cost ELSE NULL END ) as min_pavement,
- sum(CASE WHEN(scale='小修' and category='桥涵') THEN cost ELSE NULL END ) as min_bridgeAndCulvert,
- sum(CASE WHEN(scale='小修' and category='隧道') THEN cost ELSE NULL END ) as min_tunnel,
-
- sum(CASE WHEN(scale='大修') THEN cost ELSE NULL END ) as max,
- sum(CASE WHEN(scale='中修') THEN cost ELSE NULL END ) as mid,
- sum(CASE WHEN(scale='小修') THEN cost ELSE NULL END ) as min,
- sum(CASE WHEN(category='路基') THEN cost ELSE NULL END ) as subgrade,
- sum(CASE WHEN(category='路面') THEN cost ELSE NULL END ) as pavement,
- sum(CASE WHEN(category='桥涵') THEN cost ELSE NULL END ) as bridgeAndCulvert,
- sum(CASE WHEN(category='隧道') THEN cost ELSE NULL END ) as tunnel,
- sum(cost) as total
- </sql>
- <sql id="planByscale">
- <foreach item="tabletypeitem" collection="tabletype">
- <if test="tabletypeitem == 'prevention'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'prevention' as type,PROJECT_SCALE as scale,CATEGORY,
- CASE WHEN isnull(AUDIT_FEE) THEN TOTAL_COST ELSE AUDIT_FEE END as cost
- from highway_prevention_project_dettable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="scale != null">
- and a.PROJECT_SCALE in
- <foreach item="item" index="index" collection="scale" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'repair'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'repair' as type,PROJECT_SCALE as scale,CATEGORY,
- CASE WHEN isnull(AUDIT_FEE) THEN TOTAL_COST ELSE AUDIT_FEE END as cost
- from highway_repair_project_dettable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="scale != null">
- and a.PROJECT_SCALE in
- <foreach item="item" index="index" collection="scale" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- </foreach>
- select null as COMPANY_ID,null as COMPANY,null as ROAD_ID,null as ROAD,null as type,null AS scale,null as CATEGORY ,null as cost
- </sql>
- <sql id="compByscale">
- <foreach item="tabletypeitem" collection="tabletype">
- <if test="tabletypeitem == 'prevention'">
- select a.COMPANY,a.COMPANY_ID,a.ROAD_ID,a.ROAD,'prevention' as type,
- a.PROJECT_SCALE as scale,a.CATEGORY,b.ACTUAL_COST as cost
- from highway_prevention_project_dettable a left join monthly_prevention_completion b
- on a.YEAR = b.YEAR and a.COMPANY_ID = b.COMPANY_ID and a.ROAD_ID = b.ROAD_ID and a.PROJECT_NAME = b.PROJECT_NAME
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="scale != null">
- and a.PROJECT_SCALE in
- <foreach item="item" index="index" collection="scale" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'repair'">
- select a.COMPANY,a.COMPANY_ID,a.ROAD_ID,a.ROAD,'repair' as type,
- a.PROJECT_SCALE as scale,a.CATEGORY,b.ACTUAL_COST as cost
- from highway_repair_project_dettable a left join monthly_repair_completion b
- on a.YEAR = b.YEAR and a.COMPANY_ID = b.COMPANY_ID and a.ROAD_ID = b.ROAD_ID and a.PROJECT_NAME = b.PROJECT_NAME
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="scale != null">
- and a.PROJECT_SCALE in
- <foreach item="item" index="index" collection="scale" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- </foreach>
- select null as COMPANY_ID,null as COMPANY,null as ROAD_ID,null as ROAD,null as type,null AS scale,null as CATEGORY ,null as cost
- </sql>
- <sql id="plan">
- <foreach item="tabletypeitem" collection="tabletype">
- <if test="tabletypeitem == 'daily'">
- <foreach item="c" collection="category">
- <if test="c == '路基'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'daily' as type,'路基' as CATEGORY,
- CASE WHEN isnull(SUBGRADE_AUDIT_FEE) THEN SUBGRADE_PLAN_COST ELSE SUBGRADE_AUDIT_FEE END as cost
- from highway_daily_plan_statable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="c == '路面'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'daily' as type,'路面' as CATEGORY,
- CASE WHEN isnull(PAVEMENT_AUDIT_FEE) THEN PAVEMENT_PLAN_COST ELSE PAVEMENT_AUDIT_FEE END as cost
- from highway_daily_plan_statable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="c == '桥梁'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'daily' as type,'桥梁' as CATEGORY,
- CASE WHEN isnull(BRIDGE_AUDIT_FEE) THEN BRIDGE_PLAN_COST ELSE BRIDGE_AUDIT_FEE END as cost
- from highway_daily_plan_statable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="c == '涵洞通道'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'daily' as type,'涵洞通道' as CATEGORY,
- CASE WHEN isnull(CULVERT_AUDIT_FEE) THEN CULVERT_PLAN_COST ELSE CULVERT_AUDIT_FEE END as cost
- from highway_daily_plan_statable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="c == '隧道'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'daily' as type,'隧道' as CATEGORY,
- CASE WHEN isnull(TUNNEL_AUDIT_FEE) THEN TUNNEL_PLAN_COST ELSE TUNNEL_AUDIT_FEE END as cost
- from highway_daily_plan_statable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="c == '交安设施'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'daily' as type,'交安设施' as CATEGORY,
- CASE WHEN isnull(SAFE_AUDIT_FEE) THEN SAFE_PLAN_COST ELSE SAFE_AUDIT_FEE END as cost
- from highway_daily_plan_statable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="c == '沿线设施'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'daily' as type,'沿线设施' as CATEGORY,
- CASE WHEN isnull(LINE_AUDIT_FEE) THEN LINE_PLAN_COST ELSE LINE_AUDIT_FEE END as cost
- from highway_daily_plan_statable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="c == '绿化'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'daily' as type,'绿化' as CATEGORY,
- CASE WHEN isnull(GREEN_AUDIT_FEE) THEN GREEN_PLAN_COST ELSE GREEN_AUDIT_FEE END as cost
- from highway_daily_plan_statable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="c == '清扫保洁'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'daily' as type,'清扫保洁' as CATEGORY,
- CASE WHEN isnull(CLEAN_AUDIT_FEE) THEN CLEAN_PLAN_COST ELSE CLEAN_AUDIT_FEE END as cost
- from highway_daily_plan_statable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="c == '巡查检查'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'daily' as type,'巡查检查' as CATEGORY,
- CASE WHEN isnull(PATROL_AUDIT_FEE) THEN PATROL_PLAN_COST ELSE PATROL_AUDIT_FEE END as cost
- from highway_daily_plan_statable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="c == '养护车辆设备'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'daily' as type,'养护车辆设备' as CATEGORY,
- CASE WHEN isnull(CAR_AUDIT_FEE) THEN CAR_PLAN_COST ELSE CAR_AUDIT_FEE END as cost
- from highway_daily_plan_statable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="c == '应急保通'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'daily' as type,'应急保通' as CATEGORY,
- CASE WHEN isnull(EMERGENCY_AUDIT_FEE) THEN EMERGENCY_PLAN_COST ELSE EMERGENCY_AUDIT_FEE END as cost
- from highway_daily_plan_statable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- </foreach>
- </if>
- <if test="tabletypeitem == 'prevention'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'prevention' as type,CATEGORY,
- CASE WHEN isnull(AUDIT_FEE) THEN TOTAL_COST ELSE AUDIT_FEE END as cost
- from highway_prevention_project_dettable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'repair'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'repair' as type,CATEGORY,
- CASE WHEN isnull(AUDIT_FEE) THEN TOTAL_COST ELSE AUDIT_FEE END as cost
- from highway_repair_project_dettable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'special'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'special' as type,CATEGORY,
- CASE WHEN isnull(AUDIT_FEE) THEN TOTAL_COST ELSE AUDIT_FEE END as cost
- from highway_special_project_dettable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'emergency'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'emergency' as type,CATEGORY,
- CASE WHEN isnull(AUDIT_FEE) THEN TOTAL_COST ELSE AUDIT_FEE END as cost
- from highway_emergency_project_dettable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'test'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'test' as type,CATEGORY,
- CASE WHEN isnull(AUDIT_FEE) THEN TOTAL_COST ELSE AUDIT_FEE END as cost
- from highway_test_project_dettable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'scientific'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'scientific' as type,CATEGORY,
- CASE WHEN isnull(AUDIT_FEE) THEN year_cost ELSE AUDIT_FEE END as cost
- from highway_scientific_project_dettable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'equipment'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'equipment' as type,'noCategory' as CATEGORY,
- CASE WHEN isnull(AUDIT_FEE) THEN project_cost ELSE AUDIT_FEE END as cost
- from highway_equipment_overhaul_project_dettable a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'reserve'">
- select COMPANY_ID,COMPANY,ROAD_ID,ROAD,'reserve' as type,'noCategory' as CATEGORY,
- CASE WHEN isnull(AUDIT_FEE) THEN TOTAL_COST ELSE AUDIT_FEE END as cost
- from highway_reserve_fees_sumtable_total a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- </foreach>
- select null as COMPANY_ID,null as COMPANY,null as ROAD_ID,null as ROAD,null as type,null as CATEGORY ,null as cost
- </sql>
- <sql id="comp">
- <foreach item="tabletypeitem" collection="tabletype">
- <if test="tabletypeitem == 'daily'">
- select * from(
- select COMPANY,COMPANY_ID,ROAD_ID,ROAD,'daily' as type,
- CASE
- WHEN (type = 'SUBGRADE_COST') THEN '路基'
- WHEN (type = 'PAVEMENT_COST') THEN '路面'
- WHEN (type = 'BRIDGE_COST') THEN '桥梁'
- WHEN (type = 'CULVERT_COST') THEN '涵洞通道'
- WHEN (type = 'TUNNEL_COST') THEN '隧道'
- WHEN (type = 'SAFE_COST') THEN '交安设施'
- WHEN (type = 'LINE_COST') THEN '沿线设施'
- WHEN (type = 'GREEN_COST') THEN '绿化'
- WHEN (type = 'CLEAN_COST') THEN '清扫保洁'
- WHEN (type = 'PATROL_COST') THEN '巡查检查'
- WHEN (type = 'CAR_COST') THEN '养护车辆设备'
- WHEN (type = 'EMERGENCY_COST') THEN '应急保通'
- END as CATEGORY,
- ACTUAL_COST as cost
- from monthly_daily_completion a
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- )a
- <if test="category != null">
- where CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'prevention'">
- select a.COMPANY,a.COMPANY_ID,a.ROAD_ID,a.ROAD,'prevention' as type,a.CATEGORY,b.ACTUAL_COST as cost
- from highway_prevention_project_dettable a left join monthly_prevention_completion b
- on a.YEAR = b.YEAR and a.COMPANY_ID = b.COMPANY_ID and a.ROAD_ID = b.ROAD_ID and a.PROJECT_NAME = b.PROJECT_NAME
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'repair'">
- select a.COMPANY,a.COMPANY_ID,a.ROAD_ID,a.ROAD,'repair' as type,a.CATEGORY,b.ACTUAL_COST as cost
- from highway_repair_project_dettable a left join monthly_repair_completion b
- on a.YEAR = b.YEAR and a.COMPANY_ID = b.COMPANY_ID and a.ROAD_ID = b.ROAD_ID and a.PROJECT_NAME = b.PROJECT_NAME
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'special'">
- select a.COMPANY,a.COMPANY_ID,a.ROAD_ID,a.ROAD,'special' as type,a.CATEGORY,b.ACTUAL_COST as cost
- from highway_special_project_dettable a left join monthly_special_completion b
- on a.YEAR = b.YEAR and a.COMPANY_ID = b.COMPANY_ID and a.ROAD_ID = b.ROAD_ID and a.PROJECT_NAME = b.PROJECT_NAME
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'emergency'">
- select a.COMPANY,a.COMPANY_ID,a.ROAD_ID,a.ROAD,'emergency' as type,a.CATEGORY,b.ACTUAL_COST as cost
- from highway_emergency_project_dettable a left join monthly_emergency_completion b
- on a.YEAR = b.YEAR and a.COMPANY_ID = b.COMPANY_ID and a.ROAD_ID = b.ROAD_ID and a.PROJECT_NAME = b.PROJECT_NAME
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'test'">
- select a.COMPANY,a.COMPANY_ID,a.ROAD_ID,a.ROAD,'test' as type,a.CATEGORY,b.ACTUAL_COST as cost
- from highway_test_project_dettable a left join monthly_test_project_completion b
- on a.YEAR = b.YEAR and a.COMPANY_ID = b.COMPANY_ID and a.ROAD_ID = b.ROAD_ID and a.PROJECT_NAME = b.PROJECT_NAME
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'scientific'">
- select a.COMPANY,a.COMPANY_ID,a.ROAD_ID,a.ROAD,'scientific' as type,a.CATEGORY,b.ACTUAL_COST as cost
- from highway_scientific_project_dettable a left join monthly_scientific_project_completion b
- on a.YEAR = b.YEAR and a.COMPANY_ID = b.COMPANY_ID and a.ROAD_ID = b.ROAD_ID and a.PROJECT_NAME = b.PROJECT_NAME
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="category != null">
- and a.CATEGORY in
- <foreach item="item" index="index" collection="category" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'equipment'">
- select a.COMPANY,a.COMPANY_ID,a.ROAD_ID,a.ROAD,'equipment' as type,'noCategory' as CATEGORY,b.ACTUAL_COST as cost
- from highway_equipment_overhaul_project_dettable a left join monthly_equipment_overhaul_completion b
- on a.YEAR = b.YEAR and a.COMPANY_ID = b.COMPANY_ID and a.ROAD_ID = b.ROAD_ID and a.PROJECT_NAME = b.PROJECT_NAME
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- <if test="tabletypeitem == 'reserve'">
- select a.COMPANY,a.COMPANY_ID,a.ROAD_ID,a.ROAD,'reserve' as type,'noCategory' as CATEGORY,b.ACTUAL_COST as cost
- from highway_reserve_fees_sumtable_total a left join highway_reserve_fees_sumtable b
- on a.YEAR = b.YEAR and a.COMPANY_ID = b.COMPANY_ID and a.ROAD_ID = b.ROAD_ID
- where 1=1
- <if test="company != '' and company != null">
- and a.COMPANY = #{company}
- </if>
- <if test="startYear != '' and startYear != null">
- and a.YEAR >= #{startYear}
- </if>
- <if test="endYear != '' and endYear != null">
- and a.YEAR <= #{endYear}
- </if>
- <if test="companys != null">
- and a.COMPANY_ID in
- <foreach item="item" index="index" collection="companys" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- union all
- </if>
- </foreach>
- select null as COMPANY_ID,null as COMPANY,null as ROAD_ID,null as ROAD,null as type,null as CATEGORY ,null as cost
- </sql>
- </mapper>
|