bns_jjsp_service/securityControl-modules/securityControl-proteam/target/classes/mapper/DutyChildMapper.xml

288 lines
14 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 safety_project_status='01' and is_stop='0'then '待建'
when is_stop='1' then '停工'
when is_work='1' then '在施'
when safety_project_status='04' and is_stop='0' then '投产'
when safety_project_status='05' and is_stop='0' 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.org_id 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 safety_project_status='01' AND is_stop=0 then '待建'
when is_stop='1' then '停工'
when is_work='1' then '在施'
when safety_project_status='04' AND is_stop=0 then '投产'
when safety_project_status='05' AND is_stop=0 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') and is_stop=0
<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 safety_project_status='01' then '待建'
when safety_project_status='05' and is_work='1' then '在施'
when safety_project_status='05' and is_stop='1' 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') and is_stop=0
<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,
jtp.real_name teamLeader ,jtp2.real_name bzaqy
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
left join jj_team_people jtp on jt.id=jtp.team_id and jtp.delete_flag=0 and jtp.position_code='0900101'
left join jj_team_people jtp2 on jt.id=jtp2.team_id and jtp2.delete_flag=0 and jtp2.position_code='0900102'
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=#{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>
</mapper>