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

466 lines
22 KiB
XML

<?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.mapper.DutyChildMapper">
<select id="getAllProList" resultType="com.sercurityControl.proteam.domain.vo.DutyChildVo">
SELECT distinct single_project_name proName,single_project_code singCode,so.city_name orgName,
actual_commencement_date startTime,
actual_finish_time endTime,
(case
when prj_type='0' then '变电'
when prj_type='1' then '线路'
when prj_type='3' then '间隔'
ELSE '其他' end) `prjType` ,
(case
when is_stop='1' then '停工'
when is_work='1' then '在施'
when safety_project_status='01' then '待建'
when safety_project_status='04' then '投产'
when safety_project_status='05' then '在建'
ELSE '其他' end) `proStatus`
FROM jj_single_info jsi
left join sys_org so on jsi.build_unit_code=so.org_id
where 1=1 and jsi.delete_flag=0
<if test="cityList!=null and cityList!=''">
AND so.build_unit_code IN (
<foreach collection="cityList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="proName!=null and proName!=''">
and jsi.single_project_name like concat('%',#{proName},'%')
</if>
<if test="type!=null and type!='' ">
and jsi.is_stop='1'
</if>
</select>
<!--查询 施工数据的集合-->
<select id="getSgList" resultType="com.sercurityControl.proteam.domain.vo.DutyChildVo">
SELECT distinct jsi.single_project_name proName,jsi.single_project_code singCode,so.city_name orgName,
actual_commencement_date startTime,
actual_finish_time endTime,
(case
when prj_type='0' then '变电'
when prj_type='1' then '线路'
when prj_type='3' then '间隔'
ELSE '其他' end) `prjType` ,
(case
when is_stop='1' then '停工'
when is_work='1' then '在施'
when safety_project_status='01' then '待建'
when safety_project_status='04' then '投产'
when safety_project_status='05' then '在建'
ELSE '其他' end) `proStatus`
FROM jj_single_info jsi
LEFT JOIN jj_class_meetting cm on cm.single_project_code=jsi.single_project_code AND cm.current_constr_date=CURRENT_DATE() and cm.delete_flag=0
left join sys_org so on jsi.build_unit_code=so.org_id
where 1=1 and jsi.delete_flag=0 and cm.id is not null
and jsi.safety_project_status in('05')
<if test="cityList!=null and cityList!=''">
AND jsi.build_unit_code IN (
<foreach collection="cityList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="proName!=null and proName!=''">
and jsi.single_project_name like concat('%',#{proName},'%')
</if>
</select>
<select id="getWsgList" resultType="com.sercurityControl.proteam.domain.vo.DutyChildVo">
SELECT distinct jsi.single_project_name proName,jsi.single_project_code singCode,so.city_name orgName,
actual_commencement_date startTime,
actual_finish_time endTime,
(case
when prj_type='0' then '变电'
when prj_type='1' then '线路'
when prj_type='3' then '间隔'
ELSE '其他' end) `prjType` ,
(case
when is_work='1' then '在施'
when is_stop='1' then '停工'
when safety_project_status='01' then '待建'
when safety_project_status='04' then '投产'
when safety_project_status='05' then '在建'
ELSE '其他' end) `proStatus`
FROM jj_single_info jsi
LEFT JOIN jj_class_meetting cm on cm.single_project_code=jsi.single_project_code AND cm.current_constr_date=CURRENT_DATE() and cm.delete_flag=0
left join sys_org so on jsi.build_unit_code=so.org_id
where 1=1 and jsi.delete_flag=0 and cm.id is null
and jsi.safety_project_status in('05')
<if test="cityList!=null and cityList!=''">
AND jsi.build_unit_code IN (
<foreach collection="cityList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="proName!=null and proName!=''">
and jsi.single_project_name like concat('%',#{proName},'%')
</if>
</select>
<select id="getAllProList2" resultType="com.sercurityControl.proteam.domain.vo.DutyChildVo">
select org_name orgName,voltage_level voltageLevel,pro_name proName,img_progress imageProcess,single_type singType,
IFNULL(build_scale_line,build_scale_power) buildScale,IFNULL(physical_quantity_line,physical_quantity_main_tran) physicalQuantity,
year_date yearDate,kg_date kgTime,tc_date tcTime,pro.parent_pro_no proCode
from tb_new_pro pro
WHERE pro.is_pro='2' AND is_flag = '0'
<if test="type!=null and type!='' ">
and pro.pro_status in(2,3)
</if>
<if test="cityList!=null and cityList!=''">
AND pro.org_name IN (
<foreach collection="cityList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="proName!=null and proName!=''">
and pro.pro_name like concat('%',#{proName},'%')
</if>
</select>
<!--查询 施工数据的集合-->
<select id="getSgList2" resultType="com.sercurityControl.proteam.domain.vo.DutyChildVo">
select distinct pro.org_name orgName,pro.voltage_level voltageLevel,pro.pro_name proName,img_progress imageProcess, single_type singType,
IFNULL(build_scale_line,build_scale_power) buildScale,IFNULL(physical_quantity_line,physical_quantity_main_tran) physicalQuantity,
year_date yearDate,kg_date kgTime,tc_date tcTime,pro.parent_pro_no proCode
from tb_new_pro pro
LEFT JOIN jj_class_meetting cm on cm.prj_code=pro.parent_pro_no AND cm.current_constr_date=CURRENT_DATE() and cm.delete_flag=0
WHERE pro.is_pro='2' and pro.is_flag='0'
and cm.id is not null and pro_status not in(2,3)
<if test="cityList!=null and cityList!=''">
AND pro.org_name IN (
<foreach collection="cityList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="proName!=null and proName!=''">
and pro.pro_name like concat('%',#{proName},'%')
</if>
</select>
<select id="getWsgList2" resultType="com.sercurityControl.proteam.domain.vo.DutyChildVo">
select distinct pro.org_name orgName,pro.voltage_level voltageLevel,pro.pro_name proName,
img_progress imageProcess,single_type singType,
IFNULL(build_scale_line,build_scale_power) buildScale,IFNULL(physical_quantity_line,physical_quantity_main_tran) physicalQuantity,
year_date yearDate,kg_date kgTime,tc_date tcTime,pro.parent_pro_no proCode,cm.single_project_code signCode
from tb_new_pro pro
LEFT JOIN jj_class_meetting cm on cm.prj_code=pro.parent_pro_no AND cm.current_constr_date=CURRENT_DATE() and cm.delete_flag=0
WHERE pro.is_pro='2' AND pro.is_flag = '0' and pro.pro_status not in(2,3)
and cm.id is null
<if test="cityList!=null and cityList!=''">
AND pro.org_name IN (
<foreach collection="cityList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="proName!=null and proName!=''">
and pro.pro_name like concat('%',#{proName},'%')
</if>
</select>
<select id="getWeekList" resultType="com.sercurityControl.proteam.domain.vo.DutyChildVo">
SELECT so.city_name as orgName,jwp.bidding_section_name as bidName,jsi.single_project_name as projectName,
jwp.single_project_code ,
jsp.re_assessment_risk_level as riskLevel,jdc.value as workType,jt.working_team_name as teamName,
jsp.work_site_name as workSiteName,
jsp.work_content as workContent,
jsp.work_procedure workName,
(case
when jsp.re_assessment_risk_level='2' then '二级'
when jsp.re_assessment_risk_level='3' then '三级'
when jsp.re_assessment_risk_level='4' then '四级'
when jsp.re_assessment_risk_level='5' then '五级'
ELSE '其他' end
) riskLev,jwp.team_id teamId,
concat(jwp.planned_start_date,'至',jwp.planned_end_date) times,
jwp.planned_start_date as startTime,
jwp.planned_end_date as endTime
FROM jj_weeks_plan jwp
left JOIN jj_single_info jsi on jsi.single_project_code=jwp.single_project_code
left join jj_risk_precaution jsp on jsp.id=jwp.risk_precaution_id and jsp.delete_flag=0
LEFT JOIN sys_org so ON so.org_id=jwp.build_unit_code
left join jj_data_code jdc on jdc.code_value=jsp.work_type and jdc.code='WORK_TYPE'
left join jj_team jt on jt.id =jwp.team_id
WHERE (DATE_FORMAT(jwp.planned_start_date, '%Y-%m-%d') BETWEEN #{startTime} and #{endTime}
or DATE_FORMAT(jwp.planned_end_date, '%Y-%m-%d') BETWEEN #{startTime} and #{endTime}) AND jwp.plan_status = '04' AND jwp.delete_flag = '0'
<if test="cityList!=null and cityList!=''">
AND so.city_name IN (
<foreach collection="cityList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="proName!=null and proName!=''">
and jsi.single_project_name like concat('%',#{proName},'%')
</if>
<if test="code!=null and code!='' and code!=0">
and jsp.re_assessment_risk_level=#{code}
</if>
AND jsp.re_assessment_risk_level IN ('2','3','4','5')
</select>
<!--值长-日计划穿透页面-日计划列表-->
<select id="getDayList" resultType="com.sercurityControl.proteam.domain.vo.DutyChildVo">
select tti.bidding_section_name projectName,so.city_name orgName, tti.ticket_name jobName,
tti.working_team_name teamName,tti.id ticketId
from jj_ticket tti
left join sys_org so on so.org_id=tti.build_unit_code
left join jj_class_meetting cm on tti.id=cm.ticket_id and cm.current_constr_date=curdate() AND cm.delete_flag='0'
<if test='code=="3" or code=="4"'>
left join t_user_handle tuh on tuh.fzr_num=tti.ticket_no and tuh.type=9
</if>
where tti.ticket_status='05' AND tti.delete_flag=0
and curdate() BETWEEN DATE_FORMAT(tti.planned_start_date, '%Y-%m-%d') and DATE_FORMAT(tti.planned_end_date, '%Y-%m-%d')
<if test='code=="1"'>
and cm.id is not null
</if>
<if test='code=="2"'>
and cm.id is null
</if>
<if test='code=="3"'>
and tuh.id is NOT null
</if>
<if test='code=="4"'>
and tuh.id is null and cm.id is null
</if>
<if test="cityList!=null and cityList!=''">
AND so.city_name IN (
<foreach collection="cityList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="proName!=null and proName!=''">
and tti.bidding_section_name like concat('%',#{proName},'%')
</if>
</select>
<!--查询周集合集合-->
<select id="getWeeksList" resultType="com.sercurityControl.proteam.domain.query.RiskPrecaution">
select distinct jrp.work_site_name workSite,jrp.work_type ,jdc.`value` workType,
jrp.work_content workContent,jrp.work_procedure workGx
from jj_weeks_plan jwp
left join jj_risk_precaution jrp on jwp.risk_precaution_id=jrp.id
left join jj_data_code jdc on jrp.work_type=jdc.code_value and jdc.code='WORK_TYPE'
WHERE jwp.ticket_id like concat('%',#{ticketId},'%') AND jrp.work_content is not null
</select>
<select id="getMainRisk" resultType="java.lang.String">
select
concat(replenish_content_1,IFNULL(replenish_content_2,''),IFNULL(replenish_content_3,'')
,IFNULL(replenish_content_4,''),IFNULL(replenish_content_5,'')
,IFNULL(replenish_content_6,'')
) replenishContent
from jj_info
where delete_flag=0 and ext_type='40' and ref_id=#{ticketId}
ORDER BY sort_no asc
LIMIT 1
</select>
<select id="getUnit" resultType="com.sercurityControl.proteam.domain.vo.DutyChildVo">
select jcm.supervision_unit_name jlUnit -- 监理单位
,ju.unit_name sgUnit -- 施工单位
from jj_class_meetting jcm
left join jj_class_metting_info jcmi on jcmi.class_id=jcm.id
left join jj_unit ju on ju.unified_social_credit_id=jcm.constr_unified_social_credit_id and ju.delete_flag=0
where jcm.single_project_code=#{proCode} and ju.unit_name is not null
<if test="teamId!=null and teamId!=''">
and jcmi.team_id=#{teamId}
</if>
limit 1
</select>
<select id="getTeamNum" resultType="java.lang.String">
select IFNULL(count(1),0) num
from jj_team_people
where delete_flag=0 and team_id=#{teamId}
</select>
<select id="getWeekUs" resultType="com.sercurityControl.proteam.domain.WeekRiskData">
SELECT jtp.real_name relName,jtp.position_code relCode
FROM jj_team_people jtp
where jtp.delete_flag=0 and jtp.position_code in ('0900101','0900102')
and jtp.team_id=#{teamId}
</select>
<select id="getWeekList2" resultType="com.sercurityControl.proteam.domain.vo.DutyChildVo">
SELECT so.city_name as orgName,jwp.bidding_section_name as bidName,jsi.single_project_name as projectName,
jwp.single_project_code ,
jsp.re_assessment_risk_level as riskLevel,jdc.value as workType,jwi.team_name as teamName,
jsp.work_site_name as workSiteName,
jsp.work_content as workContent,
jsp.work_procedure workName,
(case
when jsp.re_assessment_risk_level='2' then '二级'
when jsp.re_assessment_risk_level='3' then '三级'
when jsp.re_assessment_risk_level='4' then '四级'
when jsp.re_assessment_risk_level='5' then '五级'
ELSE '其他' end
) riskLev,jwp.team_id teamId,
concat(jwp.planned_start_date,'至',jwp.planned_end_date) times,
jwp.planned_start_date as startTime,
jwp.planned_end_date as endTime,
jwi.jl_unit jlUnit, jwi.sg_unit sgUnit, jwi.team_leader teamLeader, jwi.bzaqy bzaqy, jwi.team_num teamNum
FROM jj_weeks_plan jwp
left JOIN jj_single_info jsi on jsi.single_project_code=jwp.single_project_code
left join jj_risk_precaution jsp on jsp.id=jwp.risk_precaution_id and jsp.delete_flag=0
LEFT JOIN sys_org so ON so.org_id=jwp.build_unit_code
left join jj_data_code jdc on jdc.code_value=jsp.work_type and jdc.code='WORK_TYPE'
left join jj_weeks_info jwi on jwi.id=jwp.id
WHERE (DATE_FORMAT(jwp.planned_start_date, '%Y-%m-%d') BETWEEN #{startTime} and #{endTime}
or DATE_FORMAT(jwp.planned_end_date, '%Y-%m-%d') BETWEEN #{startTime} and #{endTime}) AND jwp.plan_status = '04' AND jwp.delete_flag = '0'
<if test="cityList!=null and cityList!=''">
AND so.city_name IN (
<foreach collection="cityList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="proName!=null and proName!=''">
and jsi.single_project_name like concat('%',#{proName},'%')
</if>
<if test="code!=null and code!='' and code!=0">
and jsp.re_assessment_risk_level=#{code}
</if>
AND jsp.re_assessment_risk_level IN ('2','3','4','5')
</select>
<!--日计划列表--->
<select id="getNewDayList" resultType="com.sercurityControl.proteam.domain.vo.NewDayPlanVo">
SELECT jh_id AS jhid,
jh_bh AS jhbh,
bzdw_mc AS bzdwmc,
bzbm_mc AS bzbmmc,
bzr_mc AS bzrmc,
bz_rq AS bzrq,
C.data_name AS dydj,
D.data_name AS sszy,
E.data_name AS zylb,
B.data_name AS gzxz,
gz_dd AS gzdd,
gz_nr AS gznr,
jh_kgsj AS jhkgsj,
jh_wgsj AS jhwgsj,
A.data_name AS dwfx,
CASE WHEN sf_bcf = 'Y' OR sf_bcf = '是' THEN '是'
WHEN sf_bcf = 'N' OR sf_bcf = '否' THEN '否' ELSE '' END AS sfbcf,
yjh_bh AS yjhbh,
CASE WHEN sf_zdqqy = 'Y' OR sf_zdqqy = '是' THEN '是'
WHEN sf_zdqqy = 'N' OR sf_zdqqy = '否' THEN '否' ELSE '' END AS sfzdqqy,
CASE WHEN sf_td = 'Y' OR sf_td = '是' THEN '是'
WHEN sf_td = 'N' OR sf_td = '否' THEN '否' ELSE '' END AS sftd,
CASE WHEN sf_xyxckc = 'Y' OR sf_xyxckc = '是' THEN '是'
WHEN sf_xyxckc = 'N' OR sf_xyxckc = '否' THEN '否' ELSE '' END AS sfxyxckc,
CASE WHEN sf_yxscya = 'Y' OR sf_yxscya = '是' THEN '是'
WHEN sf_yxscya = 'N' OR sf_yxscya = '否' THEN '否' ELSE '' END AS sfyxscya,
H.data_name AS bzxz,
bz_mc AS bzmc,
fzr_mc AS fzr_mc,
fzr_dh AS fzr_dh,
fzr_sfzh AS fzr_sfzh,
jh_cyrs AS jh_cyrs,
gcxm_mc AS gcxmmc,
CASE WHEN status = '2' OR status = '4' OR status = '5' OR status = '7' OR status = '10' THEN '已执行'
WHEN status NOT IN ('2', '4', '5', '7', '10') THEN '未执行'
WHEN status IS NULL THEN ''
END AS status,
CASE WHEN data_source = '01' OR data_source = 'PMS2.0' THEN 'PMS2.0'
WHEN data_source = '02' OR data_source = '生产实时管控平台' THEN '生产实时管控平台'
WHEN data_source = '03' OR data_source = 'PMS3.0' THEN 'PMS3.0'
WHEN data_source = '06' OR data_source = '风险管控监督平台' THEN '风险管控监督平台'
WHEN data_source = '09' OR data_source = 'E基建2.0' THEN 'E基建2.0'
WHEN data_source = 'HFRT' OR data_source = '外部' THEN '外部'
WHEN data_source = 'I6000' OR data_source = 'I6000' THEN 'I6000'
WHEN data_source = 'JJGK' OR data_source = 'E基建1.0' THEN 'E基建1.0'
WHEN data_source = 'PWGK' OR data_source = '配网精益化' THEN '配网精益化'
WHEN data_source = 'WWAPP' OR data_source = '风控移动端' THEN '风控移动端'
WHEN data_source = 'YXXCZY' OR data_source = '营销现场作业' THEN '营销现场作业'
ELSE '' END AS sjly
FROM ps_jjrjh psj
LEFT JOIN (
SELECT pd.data_code,pd.data_name
FROM ps_dict pd
LEFT JOIN ps_dict pd2 ON pd.parent_id = pd2.id
WHERE pd.del_flag = '0' AND pd2.data_code = 'rz_dwfx'
) A ON psj.dw_fx = A.data_code
LEFT JOIN (
SELECT pd.data_code,pd.data_name
FROM ps_dict pd
LEFT JOIN ps_dict pd2 ON pd.parent_id = pd2.id
WHERE pd.del_flag = '0' AND pd2.data_code = 'rz_gzxz'
) B ON psj.gz_xz = B.data_code
LEFT JOIN (
SELECT pd.data_code,pd.data_name
FROM ps_dict pd
LEFT JOIN ps_dict pd2 ON pd.parent_id = pd2.id
WHERE pd.del_flag = '0' AND pd2.data_code = 'rz_dydj'
) C ON psj.dy_dj = C.data_code
LEFT JOIN (
SELECT pd.data_code,pd.data_name
FROM ps_dict pd
LEFT JOIN ps_dict pd2 ON pd.parent_id = pd2.id
WHERE pd.del_flag = '0' AND pd2.data_code = 'rz_sszy'
) D ON psj.ss_zy = D.data_code
LEFT JOIN (
SELECT pd.data_code,pd.data_name
FROM ps_dict pd
LEFT JOIN ps_dict pd2 ON pd.parent_id = pd2.id
WHERE pd.del_flag = '0' AND pd2.data_code = 'rz_zylb'
) E ON psj.zy_lb = E.data_code
LEFT JOIN (
SELECT pd.data_code,pd.data_name
FROM ps_dict pd
LEFT JOIN ps_dict pd2 ON pd.parent_id = pd2.id
WHERE pd.del_flag = '0' AND pd2.data_code = 'rz_bzxz'
) H ON psj.bz_xz = H.data_code
<where>
<if test="proName!=null and proName!=''">
AND INSTR(gcxm_mc,#{proName}) > 0
</if>
<if test="teamName!=null and teamName!=''">
AND INSTR(bz_mc,#{teamName}) > 0
</if>
<if test="status!='' and status!=null">
<if test="status == 0">
AND `status` NOT IN ('2','4','5','7','10')
</if>
<if test="status == 1">
AND `status` IN ('2','4','5','7','10')
</if>
</if>
<if test="startTime!=null and startTime!='' and endTime!='' and endTime!=null">
AND DATE_FORMAT(jh_kgsj,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
</if>
<if test="riskLevels!=null and riskLevels.size() > 0">
AND A.data_name IN (
<foreach collection="riskLevels" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="buildCodes!=null and buildCodes.size() > 0">
AND bzdw_mc IN (
<foreach collection="buildCodes" item="item" separator=",">
#{item}
</foreach>
)
</if>
AND jh_bs = 'D'
</where>
ORDER BY
(CASE WHEN status = '2' OR status = '4' OR status = '5' OR status = '7' OR status = '10' THEN '已执行'
ELSE '未执行' END) DESC,FIELD(A.data_name, '二级', '三级', '四级', '五级','')
</select>
<!--编制单位名称列表-->
<select id="getBuildCodes" resultType="java.util.Map">
SELECT sd.name,sd.code
FROM sys_dist sd
LEFT JOIN sys_dist sd2 ON sd.p_id = sd2.id
WHERE sd2.code = 'bz_unit'
</select>
</mapper>