select IFNULL(yysj,0) tysj,IFNULL(tysb,0) sbyy,IFNULL(sjwt,0) sjwt
FROM t_gc_js
replace into t_gc_js (yysj,tysb,sjwt,id) value(#{tysj},#{sbyy},#{sjwt},'1')
select count(ID) AS num
from jj_fix_ybz fy
where fy.is_tc=1 AND (fy.`status`=1 OR fy.`status`=0 )
AND single_type = #{proType}
AND single_type NOT IN ('01','03')
union all
select count(ID) AS num
from jj_fix_ybz fy
where fy.`status`=1 AND fy.is_tc=1
AND single_type = #{proType}
AND single_type NOT IN ('01','03')
union all
select count(ID) AS num
from jj_fix_ybz fy
where fy.`status`=0 AND fy.is_tc=1
AND single_type = #{proType}
AND single_type NOT IN ('01','03')
select so.lat,so.lon,ifNULL(a.num,0) num,ifNULL(b.num,0) zjNum,ifNULL(c.num,0) tcNum
FROM sys_org so
LEFT JOIN (
select count(ID) num,fy.build_org_no
from jj_fix_ybz fy
where fy.is_tc=1 AND (fy.`status`=1 OR fy.`status`=0 )
AND single_type = #{proType}
AND single_type NOT IN ('01','03')
GROUP BY fy.build_org_no
)a on a.build_org_no=so.org_id
LEFT JOIN (-- 在建数量
select count(ID) num,fy.build_org_no
from jj_fix_ybz fy
where fy.is_tc=1 AND fy.`status`=1
AND single_type = #{proType}
AND single_type NOT IN ('01','03')
GROUP BY fy.build_org_no
)b on b.build_org_no=so.org_id
LEFT JOIN (-- 停工数量
select count(ID) num,fy.build_org_no
from jj_fix_ybz fy
where fy.is_tc=1 AND fy.`status`=0
AND single_type = #{proType}
AND single_type NOT IN ('01','03')
GROUP BY fy.build_org_no
)c on c.build_org_no=so.org_id
SELECT DISTINCT so.city_name AS buildUnit,
jfy.single_name AS bidName,
CASE jfy.single_type WHEN '01' THEN '变电'
WHEN '03' THEN '线路'
ELSE '其他' END AS proType,
jfy.jl_enter_name AS jlUnit,
jfy.sg_enter_name AS workUnit
FROM jj_fix_ybz jfy
LEFT JOIN sys_org so ON jfy.build_org_no = so.org_id
and (( jfy.status = '1' AND jfy.is_tc = '1') or (jfy.status = '0' AND jfy.is_tc = '1'))
jfy.status = '1' AND jfy.is_tc = '1'
AND jfy.status = '0' AND jfy.is_tc = '1'
AND jfy.build_org_no IN (
#{item}
)
AND INSTR(jfy.single_name,#{bidName}) > 0
AND jfy.single_type = #{proType}
AND jfy.single_type NOT IN ('01','03')
select * ,
IFNULL(ROUND(realNum/planNum,2)*100,0) as numPercent, -- 计划完成率
IFNULL(ROUND(realLength/planLength,2)*100,0) as lengthPercent, -- 线路完成率
IFNULL(ROUND(realSub/planSub,2)*100,0) as subPercent -- 变电容量
from
(select IFNULL(cast(count(ID) as decimal(10,0)),0) as planNum,
ROUND(IFNULL(sum(SI.KYLINELEN),0),2) as planLength ,ROUND(IFNULL(sum(SI.KYTRANSCAP),0),2) as planSub
from pm_proplan_fcb fcb
inner join (
select S.PRJ_CODE,S.PLANYEAR,ANY_VALUE(SUM(PLAN_LINE_LENGTH)) KYLINELEN,ANY_VALUE(SUM(PLAN_SUBS_CAP)) KYTRANSCAP
from pm_proplan_fcb S
where S.PLANYEAR = year(now())
and S.ID NOT IN (
select ID
from
pm_proplan_fcb F
where F.PRJTYPE LIKE '%通讯%' or F.PRJTYPE LIKE '%光%' or F.PRJTYPE LIKE '%二次%' or F.PRJTYPE LIKE '%通信%'
and F.PLANYEAR = year(now())
)
and S.SIG_CODE IS NOT NULL
GROUP BY S.PRJ_CODE, S.PLANYEAR
) SI on SI.PRJ_CODE = fcb.PRJ_CODE and SI.PLANYEAR = fcb.PLANYEAR
where
DATE_FORMAT(${planTime},'%Y-%m-%d') >= concat(year(now()),'-01-01')
and DATE_FORMAT(${planTime},'%Y-%m-%d') >= DATE_FORMAT(now(),'%Y-%m-%d')
and SIG_CODE is null
and fcb.VOL_LEVEL!='24'
) a ,
(select IFNULL(cast(count(ID) as decimal(10, 0)), 0) as realNum,
IFNULL(ROUND(sum(p.LINE_LENGTH),2),0) as realLength,
IFNULL(ROUND(sum(p.SUBS_CAP),2),0) as realSub
from pm_project_info p
where
DATE_FORMAT(${planDate},'%Y-%m-%d') >= concat(year(now()),'-01-01')
and DATE_FORMAT(${planDate},'%Y-%m-%d') <= DATE_FORMAT(now(),'%Y-%m-%d')
and p.PRJ_NO is not null and p.PRJ_NO != ''
and p.PRJ_NO is not null and p.PRJ_NO != ''
and p.VOL_LEVEL!='24'
) b
select IFNULL(count(distinct cp.ID),0)
from cm_project_info cp
left join pm_project_info pp on pp.PRJ_NO=cp.PRJ_NO
LEFT JOIN sys_org so on so.org_id=cp.BUILD_ORG_NO
WHERE cp.balance_status='已完成'
and date_format(pp.ACT_PAY_DATE,'%Y-%m') >= #{startDate}
and date_format(pp.ACT_PAY_DATE,'%Y-%m') <= #{endDate}
select ROUND(CAST(IFNULL((select IFNULL(count(ID),0)
from pm_project_info
-- where balance_status='已完成'
where FIN_DATE is not null
and ACT_PAY_DATE < GW_PLAN_COMP_DATE
and date_format(GW_PLAN_COMP_DATE,'%Y-%m') >= #{startDate}
and date_format(GW_PLAN_COMP_DATE,'%Y-%m') <= #{endDate}
)
/
(select IFNULL(count(ID),0) as PLAN_NUM
from pm_project_info
where BUILD_ORG_NO is not null
and date_format(GW_PLAN_COMP_DATE,'%Y-%m') >= #{startDate}
and date_format(GW_PLAN_COMP_DATE,'%Y-%m') <= #{endDate}
)*100,0 )as decimal(10,2)),2) as completionRate
select IFNULL (ROUND(sum(BALANCE_DYNAMIC_INVEST),2) ,0) as balanceDynamicInvest
from cm_project_info
and date_format(UPDATE_TIME,'%Y-%m') >= #{startDate}
and date_format(UPDATE_TIME,'%Y-%m') <= #{endDate}
select ppi.PRJ_NO prjNo,ppi.PRJ_NAME prjName,ppi.GW_PLAN_COMP_DATE gwPlanCompDate,
ppi.ACT_PAY_DATE actPlanDate,ppi.LINE_LENGTH lineLength,
ppi.SUBS_CAP subCap,START_DATE startDate,FIN_DATE fineDate ,ppi.BUILD_ORG_NO,so.city_name orgName,
CASE ppi.VOL_LEVEL
WHEN '24' THEN '35'
WHEN '30' THEN '110'
WHEN '31' THEN '110'
WHEN '32' THEN '220'
WHEN '33' THEN '330'
WHEN '34' THEN '500'
WHEN '35' THEN '750'
ELSE
ppi.VOL_LEVEL
END voltage
from pm_project_info ppi
LEFT JOIN sys_org so on so.org_id=ppi.BUILD_ORG_NO
where
DATE_FORMAT(${planDate},'%Y-%m-%d') >= DATE_FORMAT(#{year},'%Y-%m-%d')
and DATE_FORMAT(${planDate},'%Y-%m-%d') <= DATE_FORMAT(now(),'%Y-%m-%d')
and ppi.VOL_LEVEL !='24'
and ppi.PRJ_NAME like concat('%',#{prjName},'%')
AND ppi.BUILD_ORG_NO IN (
#{item}
)
select count(ppi.ID) prjName,ROUND(sum(ppi.LINE_LENGTH),2) lineLength,ROUND(sum(ppi.SUBS_CAP),2) subCap
from pm_project_info ppi
LEFT JOIN sys_org so on so.org_id=ppi.BUILD_ORG_NO
where
DATE_FORMAT(${planDate},'%Y-%m-%d') >= concat(#{year},'-01-01')
and DATE_FORMAT(${planDate},'%Y-%m-%d') <= DATE_FORMAT(now(),'%Y-%m-%d')
and ppi.VOL_LEVEL !='24'
and ppi.PRJ_NAME like concat('%',#{prjName},'%')
AND ppi.BUILD_ORG_NO IN (
#{item}
)
select distinct cp.PRJ_NO
,pp.PRJ_NO prjNo,cp.PRJ_NAME prjName
,pp.GW_PLAN_COMP_DATE gwPlanCompDate,pp.ACT_PAY_DATE actPlanDate,pp.VOL_LEVEL
,pp.LINE_LENGTH lineLength,pp.SUBS_CAP subCap
,pp.START_DATE startDate,pp.FIN_DATE fineDate,pp.BUILD_ORG_NO,so.city_name orgName,
CASE pp.VOL_LEVEL
WHEN '24' THEN '35'
WHEN '30' THEN '110'
WHEN '31' THEN '110'
WHEN '32' THEN '220'
WHEN '33' THEN '330'
WHEN '34' THEN '500'
WHEN '35' THEN '750'
ELSE
pp.VOL_LEVEL
END voltage
from cm_project_info cp
left join pm_project_info pp on pp.PRJ_NO=cp.PRJ_NO
LEFT JOIN sys_org so on so.org_id=cp.BUILD_ORG_NO
WHERE cp.balance_status='已完成'
and date_format(pp.ACT_PAY_DATE,'%Y-%m') >= #{startDate}
and date_format(pp.ACT_PAY_DATE,'%Y-%m') <= #{endDate}
and cp.PRJ_NAME like concat('%',#{prjName},'%')
AND cp.BUILD_ORG_NO IN (
#{item}
)
INSERT INTO t_sj_number(org,pro_name,sign_name,voltage,pro_type,sj_unit,ps_unit,ps_yj_time,is_sjzl_q,sjzl_q_name,is_q,
wtk_num,sjjd,wtfx,jycqcs,wtjs,sfzg,sszy,wt_type,wt_xz,del_flag,create_time,update_time) value
(
#{item.org},#{item.proName},#{item.signName},#{item.voltage},#{item.proType},#{item.sjUnit},#{item.psUnit},#{item.psYjTime},
#{item.isSjzlQ},#{item.sjzlQName},#{item.isQ},#{item.wtkNum},#{item.sjjd},#{item.wtfx},#{item.jycqcs},#{item.wtjs},
#{item.sfzg},#{item.sszy},#{item.wtType},#{item.wtXz},#{item.delFag},#{item.createTime},#{item.updateTime}
)
UPDATE t_sj_number
org=#{org},pro_name=#{proName}, sign_name=#{signName},
voltage=#{voltage},pro_type=#{proType},sj_unit=#{sjUnit},ps_unit=#{psUnit},
ps_yj_time=#{psYjTime},is_sjzl_q=#{isSjzlQ},sjzl_q_name=#{sjzlQName},is_q=#{isQ},
wtk_num=#{wtkNum},sjjd=#{sjjd},wtfx=#{wtfx},jycqcs=#{jycqcs},wtjs=#{wtjs},
sfzg=#{sfzg},sszy=#{sszy},wt_type=#{wtType},wt_xz=#{wtXz}, update_time=#{updateTime}
where id=#{id}
update t_sj_number set del_flag=1
where id in (
#{item}
)
select id,org,pro_name proName,sign_name signName,voltage,pro_type proType,
sj_unit sjUnit,ps_unit psUnit,ps_yj_time psYjTime,is_sjzl_q isSjzlQ,sjzl_q_name sjzlQName,is_q isQ,
wtk_num wtkNum,sjjd,wtfx,jycqcs,wtjs,sfzg,sszy,wt_type wtType,wt_xz wtXz
FROM t_sj_number
del_flag=0
and is_sjzl_q=#{isSjzlQ}
and (
pro_name like concat('%',#{keyWord},'%') or
sign_name like concat('%',#{keyWord},'%') or
pro_type like concat('%',#{keyWord},'%') or
sj_unit like concat('%',#{keyWord},'%') or
ps_unit like concat('%',#{keyWord},'%') or
sjzl_q_name like concat('%',#{keyWord},'%') or
sjjd like concat('%',#{keyWord},'%') or
wtk_num like concat('%',#{keyWord},'%') or
sjjd like concat('%',#{keyWord},'%') or
wtfx like concat('%',#{keyWord},'%') or
wt_type like concat('%',#{keyWord},'%') or
wt_xz like concat('%',#{keyWord},'%')
)
select id,org,pro_name proName,sign_name signName,voltage,pro_type proType,
sj_unit sjUnit,ps_unit psUnit,ps_yj_time psYjTime,is_sjzl_q isSjzlQ,sjzl_q_name sjzlQName,is_q isQ,
wtk_num wtkNum,sjjd,wtfx,jycqcs,wtjs,sfzg,sszy,wt_type wtType,wt_xz wtXz
FROM t_sj_number
WHERE id=#{id}
SELECT COUNT(1)
FROM t_sj_number
WHERE del_flag=0 and is_sjzl_q='是'