jl-jjsp-service/securityControl-modules/securityControl-proteam/target/classes/mapper/newScreen/TySjMapper.xml

387 lines
18 KiB
XML
Raw Permalink Normal View History

2025-09-24 11:10:04 +08:00
<?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="com.sercurityControl.proteam.newScreen.mapper.TySjMapper">
<!-- 查询 工程技术查询-->
<select id="getGcjsNum" parameterType="com.sercurityControl.proteam.newScreen.domain.TySjEntity" resultType="com.sercurityControl.proteam.newScreen.domain.TySjEntity">
select IFNULL(yysj,0) tysj,IFNULL(tysb,0) sbyy,IFNULL(sjwt,0) sjwt
FROM t_gc_js
</select>
<!--插入数据-->
<insert id="insertData" parameterType="com.sercurityControl.proteam.newScreen.domain.TySjEntity">
replace into t_gc_js (yysj,tysb,sjwt,id) value(#{tysj},#{sbyy},#{sjwt},'1')
</insert>
<!-- 工程统计 -->
<select id="getProStatisNum" resultType="Integer" >
select count(ID) AS num
from jj_fix_ybz fy
where fy.is_tc=1 AND (fy.`status`=1 OR fy.`status`=0 )
<if test="proType !=null and proType!='' and proType != 04">
AND single_type = #{proType}
</if>
<if test="proType !=null and proType!='' and proType == 04">
AND single_type NOT IN ('01','03')
</if>
union all
select count(ID) AS num
from jj_fix_ybz fy
where fy.`status`=1 AND fy.is_tc=1
<if test="proType !=null and proType!='' and proType != 04">
AND single_type = #{proType}
</if>
<if test="proType !=null and proType!='' and proType == 04">
AND single_type NOT IN ('01','03')
</if>
union all
select count(ID) AS num
from jj_fix_ybz fy
where fy.`status`=0 AND fy.is_tc=1
<if test="proType !=null and proType!='' and proType != 04">
AND single_type = #{proType}
</if>
<if test="proType !=null and proType!='' and proType == 04">
AND single_type NOT IN ('01','03')
</if>
</select>
<!--查询工程统计-->
<select id="getMapProNum" resultType="com.sercurityControl.proteam.newScreen.domain.MapStatisVo" parameterType="com.sercurityControl.proteam.newScreen.domain.MapStatisVo">
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 )
<if test="proType !=null and proType!='' and proType != 04">
AND single_type = #{proType}
</if>
<if test="proType !=null and proType!='' and proType == 04">
AND single_type NOT IN ('01','03')
</if>
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
<if test="proType !=null and proType!='' and proType != 04">
AND single_type = #{proType}
</if>
<if test="proType !=null and proType!='' and proType == 04">
AND single_type NOT IN ('01','03')
</if>
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
<if test="proType !=null and proType!='' and proType != 04">
AND single_type = #{proType}
</if>
<if test="proType !=null and proType!='' and proType == 04">
AND single_type NOT IN ('01','03')
</if>
GROUP BY fy.build_org_no
)c on c.build_org_no=so.org_id
</select>
<!--获取在建、在施、停工数据列表-->
<select id="getProListByType" resultType="com.sercurityControl.proteam.domain.ProData">
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
<where>
<if test='type == 1'>
and (( jfy.status = '1' AND jfy.is_tc = '1') or (jfy.status = '0' AND jfy.is_tc = '1'))
</if>
<if test="type == 2">
jfy.status = '1' AND jfy.is_tc = '1'
</if>
<if test="type == 3">
AND jfy.status = '0' AND jfy.is_tc = '1'
</if>
<if test="buildCode!=null and buildCode!=''">
AND jfy.build_org_no IN (
<foreach collection="buildCodeList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="bidName != null and bidName != ''">
AND INSTR(jfy.single_name,#{bidName}) > 0
</if>
<if test="proType !=null and proType!='' and proType!=04">
AND jfy.single_type = #{proType}
</if>
<if test="proType !=null and proType!='' and proType==04">
AND jfy.single_type NOT IN ('01','03')
</if>
</where>
</select>
<!--查询 工程造价按期完成率 -->
<select id="getProPlanStatis" parameterType="String" resultType="java.util.Map">
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') &gt;= 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') &lt;= 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>
<!-- 结算项目 -->
<select id="getJsPro" resultType="String">
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='已完成'
<if test="startDate != null and startDate != ''">
and date_format(pp.ACT_PAY_DATE,'%Y-%m') >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and date_format(pp.ACT_PAY_DATE,'%Y-%m') &lt;= #{endDate}
</if>
</select>
<!--完成率-->
<select id="getWclPro" resultType="String">
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 &lt; GW_PLAN_COMP_DATE
<if test="startDate != null and startDate != ''">
and date_format(GW_PLAN_COMP_DATE,'%Y-%m') >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and date_format(GW_PLAN_COMP_DATE,'%Y-%m') &lt;= #{endDate}
</if>
)
/
(select IFNULL(count(ID),0) as PLAN_NUM
from pm_project_info
where BUILD_ORG_NO is not null
<if test="startDate != null and startDate != ''">
and date_format(GW_PLAN_COMP_DATE,'%Y-%m') >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and date_format(GW_PLAN_COMP_DATE,'%Y-%m') &lt;= #{endDate}
</if>
)*100,0 )as decimal(10,2)),2) as completionRate
</select>
<!--结算金额-->
<select id="getjrPro" resultType="java.util.Map" >
select IFNULL (ROUND(sum(BALANCE_DYNAMIC_INVEST),2) ,0) as balanceDynamicInvest
from cm_project_info
<where>
<if test="startDate != null and startDate != ''">
and date_format(UPDATE_TIME,'%Y-%m') >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and date_format(UPDATE_TIME,'%Y-%m') &lt;= #{endDate}
</if>
</where>
</select>
<!--工程计划数据-->
<select id="getProPlanList" resultType="com.sercurityControl.proteam.newScreen.domain.ProPlanVo" parameterType="com.sercurityControl.proteam.newScreen.domain.ProPlanVo" >
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') &lt;= DATE_FORMAT(now(),'%Y-%m-%d')
and ppi.VOL_LEVEL !='24'
<if test="prjName!=null and prjName!=''">
and ppi.PRJ_NAME like concat('%',#{prjName},'%')
</if>
<if test="orgList!=null and orgList!=''">
AND ppi.BUILD_ORG_NO IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
</select>
<!--工程计划数据统计-->
<select id="getProPlanListTj" resultType="java.util.Map" parameterType="com.sercurityControl.proteam.newScreen.domain.ProPlanVo" >
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') &lt;= DATE_FORMAT(now(),'%Y-%m-%d')
and ppi.VOL_LEVEL !='24'
<if test="prjName!=null and prjName!=''">
and ppi.PRJ_NAME like concat('%',#{prjName},'%')
</if>
<if test="orgList!=null and orgList!=''">
AND ppi.BUILD_ORG_NO IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
</select>
<!--工程造价数据详情页-->
<select id="getProZjList" resultType="com.sercurityControl.proteam.newScreen.domain.ProPlanVo" parameterType="com.sercurityControl.proteam.newScreen.domain.ProPlanVo" >
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='已完成'
<if test="startDate != null and startDate != ''">
and date_format(pp.ACT_PAY_DATE,'%Y-%m') >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and date_format(pp.ACT_PAY_DATE,'%Y-%m') &lt;= #{endDate}
</if>
<if test="prjName!=null and prjName!=''">
and cp.PRJ_NAME like concat('%',#{prjName},'%')
</if>
<if test="orgList!=null and orgList!=''">
AND cp.BUILD_ORG_NO IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
</select>
<insert id="addImportJsNumData" >
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
<foreach collection="list" item="item" separator=",">
(
#{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}
)
</foreach>
</insert>
<update id="updateSjNum" parameterType="com.sercurityControl.proteam.newScreen.domain.SjNumberVo">
UPDATE t_sj_number
<set>
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}
</set>
where id=#{id}
</update>
<update id="deleteSjNum" >
update t_sj_number set del_flag=1
where id in (
<foreach collection="list" item="item" separator=",">
#{item}
</foreach>
)
</update>
<select id="getSjNumList" parameterType="com.sercurityControl.proteam.newScreen.domain.SjNumberVo" resultType="com.sercurityControl.proteam.newScreen.domain.SjNumberVo">
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>
del_flag=0
<if test="isSjzlQ!=null and isSjzlQ!=''">
and is_sjzl_q=#{isSjzlQ}
</if>
<if test="keyWord!=null and keyWord!=''">
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},'%')
)
</if>
</where>
</select>
<!--查询设计详情-->
<select id="getSjNumDetail" resultType="com.sercurityControl.proteam.newScreen.domain.SjNumberVo" >
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>
<select id="getSjNum" resultType="Integer">
SELECT COUNT(1)
FROM t_sj_number
WHERE del_flag=0 and is_sjzl_q='是'
</select>
</mapper>