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

1460 lines
68 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.HomeDataMapper">
<select id="getProNum" resultType="java.lang.Integer">
SELECT
count( jbp.bid_no ) AS num
FROM
jj_bid_project jbp
<where>
<if test="orgId != null and orgId != ''">
jbp.build_no=#{orgId}
</if>
<if test="isStop == null">
AND jbp.status = '0'
</if>
<if test="isStop == 1">
and (jbp.is_stop = '1' OR CONCAT(jbp.is_stop,'1') = '1')
</if>
<if test="proType == '01'">
AND jbp.pro_type IN ('00','01')
</if>
<if test="proType == '03'">
AND jbp.pro_type IN ('03','05')
</if>
<if test="proType == '' ">
AND jbp.pro_type IN ('00','01','03','05')
</if>
</where>
</select>
<select id="getProNumByWork" resultType="java.lang.Integer"
parameterType="java.lang.String">
select count(a.bid_no) from
(SELECT jbp.bid_no FROM t_class_metting jz
LEFT JOIN jj_bid_project jbp on jz.bid_code=jbp.bid_no
where jz.work_day=#{workDate} and jz.del_flag='0'
<if test="orgId != null and orgId != ''">
and jbp.build_no=#{orgId}
</if>
<if test="proType == '01'">
AND jbp.pro_type IN ('00','01')
</if>
<if test="proType == '03'">
AND jbp.pro_type IN ('03','05')
</if>
<if test="proType == '' ">
AND jbp.pro_type IN ('00','01','03','05')
</if>
GROUP BY jbp.bid_no)a
</select>
<select id="getProList" resultType="com.sercurityControl.proteam.domain.ProData"
parameterType="com.sercurityControl.proteam.domain.ProData">
select jbp.bid_no as bidCode,so.city_name as buildUnit,jbp.bid_name as bidName,
IFNULL(sd2.`name`,jbp.pro_type) as proType,jbp.jL_dw as jlUnit,jbp.sg_dw as workUnit,if(jbp.is_stop =
1,'已停工','未停工') as isStop,
if(jz.bid_code is null,'未施工','在施工') as proStatus
from jj_bid_project jbp
LEFT JOIN (
SELECT DISTINCT tcm.bid_code
FROM t_class_metting tcm
WHERE tcm.work_day=CURRENT_DATE() AND tcm.del_flag='0'
)jz ON jbp.bid_no = jz.bid_code
left join sys_dist sd on sd.code='pro_type'
left join sys_dist sd2 on sd2.p_id=sd.id and sd2.code=jbp.pro_type
LEFT JOIN sys_org so on so.org_id=jbp.build_no
<where>
<if test="buildCode!=null and buildCode!=''">
jbp.build_no IN (
<foreach collection="buildCodeList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="buildUnit != null and buildUnit != ''">
and jbp.build_unit LIKE CONCAT('%',#{buildUnit},'%')
</if>
<if test="bidName != null and bidName != ''">
and jbp.bid_name LIKE CONCAT('%',#{bidName},'%')
</if>
<if test="proType == '01'">
AND jbp.pro_type IN ('00','01')
</if>
<if test="proType == '03'">
AND jbp.pro_type IN ('03','05')
</if>
<if test="proType == '' ">
AND jbp.pro_type IN ('00','01','03','05')
</if>
<if test='proStatus=="1"'>
and jz.bid_code is not null
</if>
<if test='proStatus=="0"'>
and jz.bid_code is null
</if>
<if test="isStop != null and isStop != ''">
<if test='isStop==0'>
and jbp.is_stop=#{isStop}
</if>
<if test='isStop==1'>
and (jbp.is_stop=#{isStop} OR CONCAT(jbp.is_stop,'1') = '1')
</if>
</if>
</where>
</select>
<select id="getDayPlan" resultType="com.sercurityControl.proteam.domain.DayPlanNum"
parameterType="com.sercurityControl.proteam.domain.DayPlanNum">
</select>
<!--综合展示-周风险echarts数据-->
<select id="getWeekPlanDayNum" resultType="com.sercurityControl.proteam.domain.vo.StatEntity"
parameterType="com.sercurityControl.proteam.domain.WeekRiskData">
SELECT so.city_name AS `name`,
IFNULL(SUM(a.num),0) AS num,
IFNULL(SUM(a.num2),0) AS num2,
IFNULL(SUM(a.totalNum),0) AS totalNum
FROM sys_org so
LEFT JOIN (
SELECT jwp.build_unit_code AS org,
COUNT(IF(jjrp.re_assessment_risk_level = '2',1,NULL)) AS num,
COUNT(IF(jjrp.re_assessment_risk_level = '3',1,NULL)) AS num2,
COUNT(*) AS totalNum
FROM jj_weeks_plan jwp
LEFT JOIN jj_risk_precaution jjrp ON jwp.risk_precaution_id = jjrp.id AND jjrp.delete_flag = 0
LEFT JOIN (
select distinct prj_type,single_project_code,delete_flag
from jj_single_info where delete_flag=0
) jsi on jsi.single_project_code=jwp.single_project_code
WHERE #{curryDay} BETWEEN DATE_FORMAT(jwp.planned_start_date, '%Y-%m-%d') AND DATE_FORMAT(jwp.planned_end_date, '%Y-%m-%d')
AND jjrp.re_assessment_risk_level IN ('2','3') AND jwp.plan_status in('04','4') AND jwp.delete_flag = '0'
<if test='proType!=null and proType!=""'>
AND jsi.prj_type=#{proType}
</if>
GROUP BY jwp.build_unit_code,jjrp.re_assessment_risk_level
)a ON so.org_id = a.org
GROUP BY so.city_name
</select>
<!--综合展示-周计划穿透页面-周计划列表 20240905-->
<select id="getWeekPlanListByTime" resultType="com.sercurityControl.proteam.domain.WeekRiskData"
parameterType="com.sercurityControl.proteam.domain.WeekRiskData">
SELECT so.city_name AS buildUnit,
jsi.single_project_name AS proName,
jwp.single_project_code AS proCode,
jsp.re_assessment_risk_level AS riskType,
(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
) riskLevel,
jdc.value AS workType,
so.city_name cityName,
jsp.work_procedure workGx,jsp.work_site_name workSite,
jt.working_team_name AS workTeam,jwp.team_id teamId,
jsp.work_site_name AS workPosition,
jsp.work_content AS workContent,
concat(jwp.planned_start_date,'至',jwp.planned_end_date) times,
DATE_FORMAT(jwp.planned_start_date, '%Y-%m-%d') AS planStartTime,
DATE_FORMAT(jwp.planned_end_date, '%Y-%m-%d') AS planEndTime,
jwp.risk_precaution_id AS riskPrecautionId
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>
jwp.plan_status in('4','04') AND jwp.delete_flag = '0' AND jsp.re_assessment_risk_level IN ('2','3','4','5')
<if test="curryDay != null and curryDay != ''">
AND #{curryDay} BETWEEN DATE_FORMAT(jwp.planned_start_date, '%Y-%m-%d') AND DATE_FORMAT(jwp.planned_end_date, '%Y-%m-%d')
</if>
<if test="buildUnitCode!=null and buildUnitCode!=''">
AND jwp.build_unit_code IN (
<foreach collection="buildUnitCodeList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="proName != null and proName != ''">
AND INSTR(jwp.bidding_section_name,#{proName}) > 0
</if>
<if test="workType != null and workType != ''">
AND INSTR(jdc.value,#{workType}) > 0
</if>
<if test="workTeam != null and workTeam != ''">
AND INSTR(jt.working_team_name,#{workTeam}) > 0
</if>
<if test="riskType != null and riskType != ''">
AND jsp.re_assessment_risk_level = #{riskType}
</if>
</where>
</select>
<select id="getRiskMap" resultType="com.sercurityControl.proteam.domain.RiskMapData"
parameterType="com.sercurityControl.proteam.domain.RiskMapData">
select jcm.bidding_section_name proName,jcm.re_assessment_risk_level riskType,jcmi.work_manage workManage
,jcmi.work_manage_phone workManagePhone,jcmi.work_content workContent,jcmi.team_name foreman,
td.state as ballStatus,jcm.tool_box_talk_Latitude lat,jcm.tool_box_talk_longitude lon,
jcm .build_unit_code buildCode,IFNULL(cmw.num,0) num
from jj_class_meetting jcm
LEFT JOIN t_class_metting_warn cmw on jcm.id=cmw.class_id
left join jj_class_metting_info jcmi on jcmi.class_id=jcm.id
left join jj_ball jbl on jbl.id=jcm.camera_id2
left join t_device td on td.t_code=jbl.camera_no
where jcm.current_constr_date=CURRENT_DATE() AND jcm.delete_flag = '0'
<if test="riskType != null and riskType != ''">
and jcm.re_assessment_risk_level = #{riskType}
</if>
</select>
<select id="getWeatherMap" resultType="com.sercurityControl.proteam.domain.WeatherMapData">
select name as cictyName,REAL_TIME_TEMP as currentTemp,weather as weather,
CONCAT(TEMP_MIN,'~',TEMP_MAX) as dayTemp,REAL_TIME_WEATHER as weatherStatus,org.lon,org.lat
from t_weather tw
LEFT JOIN sys_org org on tw.`NAME`=org.city_name
where create_time=#{currentDay}
and HOURS=#{hour}
</select>
<select id="getWeatherAlert" resultType="java.lang.String">
select content
from t_wather_warn tww
LEFT JOIN sys_org org on tww.city= concat(org.city_name,'市')
where tww.state = '1'
<if test="currentDay == null || currentDay == ''">
and TO_DAYS(tww.create_time)=TO_DAYS(now())
</if>
<if test="currentDay != null and currentDay != ''">
and TO_DAYS(tww.create_time)=TO_DAYS(#{currentDay})
</if>
<if test="orgId != null and orgId != ''">
and org.org_id= #{orgId}
</if>
</select>
<select id="getWeatherAlertPlus" resultType="java.util.Map">
select content,date_format(create_time,'%Y-%m-%d') currentDay
from t_wather_warn tww
LEFT JOIN sys_org org on tww.city= concat(org.city_name,'市')
where 1 =1
<if test="currentDay == null || currentDay == ''">
and TO_DAYS(tww.create_time)=TO_DAYS(now())
</if>
<if test="currentDay != null and currentDay != ''">
and TO_DAYS(tww.create_time)=TO_DAYS(#{currentDay})
</if>
<if test="orgId != null and orgId != ''">
and org.org_id= #{orgId}
</if>
</select>
<!--综合展示-作业票数量统计-->
<select id="getTicketNumByType" resultType="com.sercurityControl.proteam.domain.TicketTypeNum"
parameterType="com.sercurityControl.proteam.domain.TicketTypeNum">
SELECT tti.re_assessment_risk_level AS ticketType,
count(1) AS riskNum
FROM jj_ticket tti
WHERE tti.ticket_status='05' AND tti.delete_flag=0
GROUP BY tti.re_assessment_risk_level
</select>
<select id="getTicketNumByCicty" resultType="com.sercurityControl.proteam.domain.TicketCityNum"
parameterType="com.sercurityControl.proteam.domain.TicketCityNum">
select org.city_name as cictyName, count(a.id) as ticketNum FROM
sys_org org
LEFT JOIN
(select tti.*
from t_ticket_info tti
LEFT JOIN jj_bid_project jbp on tti.bid_no=jbp.bid_no
where tti.job_type=#{ticketType} AND tti.flag = '1'
<if test="dateType == 3">
AND (STR_TO_DATE( #{ticketDate}, '%Y-%m-%d' ) BETWEEN STR_TO_DATE( tti.job_plan_start_time, '%Y-%m-%d' ) AND
STR_TO_DATE( tti.job_plan_end_time, '%Y-%m-%d' ) )
</if>
<if test="dateType != 3">
AND STR_TO_DATE( tti.job_plan_end_time, '%Y-%m-%d' ) &gt;= #{format}
AND STR_TO_DATE( tti.job_plan_start_time, '%Y-%m-%d' ) &lt;= #{ticketDate}
</if>
)a on a.build_org_no=org.org_id
GROUP BY org.org_id
</select>
<!--综合展示-二级穿透-作业票列表-->
<select id="getTicketList" resultType="com.sercurityControl.proteam.domain.TicketData"
parameterType="com.sercurityControl.proteam.domain.TicketData">
SELECT DISTINCT so.city_name AS buildName,
tti.build_unit_code AS buildCode,
tti.ticket_name AS ticketName,
tti.ticket_no AS ticketNo,
tti.assessment_risk_level AS riskType,
tti.re_assessment_risk_level AS riskRetestType,
tti.ticket_type AS ticketType,
tti.id,
tti.single_project_name AS signName,
tti.single_project_code AS signCode,
jtp.real_name AS foreman
FROM jj_ticket tti
LEFT JOIN jj_team jt on tti.team_id=jt.id
left join jj_team_people jtp on jtp.team_id=jt.id AND jtp.position_code = '0900101' and jtp.delete_flag=0
LEFT JOIN sys_org so on so.org_id=tti.build_unit_code
<where>
tti.ticket_status = '05' AND tti.delete_flag =0
<if test="buildCode!=null and buildCode!=''">
AND tti.build_unit_code IN (
<foreach collection="buildCodeList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="ticketName != null and ticketName != ''">
AND INSTR(tti.ticket_name,#{ticketName}) > 0
</if>
<if test="ticketNo != null and ticketNo != ''">
AND INSTR(tti.ticket_no,#{ticketNo}) > 0
</if>
<if test="signName != null and signName != ''">
AND INSTR(tti.single_project_name,#{signName}) > 0
</if>
<if test="foreman != null and foreman != ''">
AND INSTR(jtp.real_name,#{foreman}) > 0
</if>
<if test="riskType!=null and riskType!=''">
AND tti.re_assessment_risk_level IN (
<foreach collection="riskTypeList" item="item" separator=",">
#{item}
</foreach>
)
</if>
</where>
</select>
<!--日考勤统计-->
<select id="getDayAttendanceNum" resultType="com.sercurityControl.proteam.domain.PersonNum">
select pt.personType,count(tpa.id_card) as personNum
FROM t_person_attendance tpa
LEFT JOIN t_class_metting_people tcmp on tpa.id_card=tcmp.id_number AND tcmp.create_day=#{currentDay}
LEFT JOIN t_class_metting jzb on tcmp.class_id=jzb.class_id AND jzb.work_day=#{currentDay}
left JOIN
(select value as id,name as personType from p_code where code_type='00000003') pt on pt.id=tcmp.people_type
where tpa.att_date=#{currentDay} AND pt.personType IS NOT NULL
GROUP BY pt.personType
</select>
<!--实时在场-->
<select id="getRealTimeNum" resultType="com.sercurityControl.proteam.domain.PersonNum">
select count(DISTINCT tpa.id_card) personNum,pt.people_type_name personType
from t_person_attendance tpa
INNER JOIN(
select distinct bak_ic, people_type_name,single_no
from jj_person
)pt on pt.bak_ic=tpa.id_card and pt.single_no=tpa.sing_code
INNER join jj_fix_ybz fy on fy.single_no=tpa.sing_code AND fy.`status` ='1' and fy.is_tc = '1'
WHERE fy.single_no IS NOT NULL and tpa.att_date=#{currentDay}
GROUP BY pt.people_type_name
</select>
<select id="getPersonListByAtt" resultType="com.sercurityControl.proteam.domain.PersonData"
parameterType="com.sercurityControl.proteam.domain.PersonData">
select tpa.person_name as personName,IFNULL(pt.personType,'其他作业人员') personType,tcmp.age,jzb.bid_name as
proName,tpa.id_card idNumber,
jzb.team_name as teamName,jzb.work_manager as workManage,jzb.work_manager_phone as foremanPhone
FROM t_person_attendance tpa
LEFT JOIN t_class_metting_people tcmp on tpa.id_card=tcmp.id_number AND tcmp.create_day=#{currentDay}
LEFT JOIN t_class_metting jzb on tcmp.class_id=jzb.class_id AND jzb.work_day=#{currentDay}
LEFT JOIN
(select value as id,name as personType
from p_code where code_type='00000003' ) pt on pt.id=tcmp.people_type
where tpa.att_date=#{currentDay}
<if test="personName != null and personName != ''">
and tpa.person_name like concat('%',#{personName},'%')
</if>
<if test="teamName != null and teamName != ''">
and jzb.team_name like concat('%',#{teamName},'%')
</if>
<if test="proName != null and proName != ''">
and jzb.bid_name like concat('%',#{proName},'%')
</if>
<if test="personType==1">
and pt.personType in ('副班长', '工作负责人', '班长兼指挥', '班组安全员')
</if>
<if test="personType==2">
and pt.personType in ('牵张机械操作手', '其他技术人员', '班组技术兼质检员', '特殊工种作业人员', '班组技术员兼质检员')
</if>
<if test="personType==3">
and pt.personType not in ('副班长', '工作负责人', '班长兼指挥', '班组安全员', '牵张机械操作手', '其他技术人员', '班组技术兼质检员', '特殊工种作业人员',
'班组技术员兼质检员')
</if>
<if test="peoType != null and peoType != ''">
and pt.personType like concat('%',#{peoType},'%')
</if>
</select>
<!--首页-人员统计穿透页面-站班会人员列表-->
<select id="getPersonList" resultType="com.sercurityControl.proteam.domain.PersonData"
parameterType="com.sercurityControl.proteam.domain.PersonData">
SELECT jcmp.real_name AS personName,
jdc.`value` AS personType,
jcmp.id_card AS idNumber,
jcm.bidding_section_name AS proName,
jtt.working_team_name AS teamName,
jcm.id AS classId
FROM jj_class_meeting_people jcmp
LEFT JOIN jj_class_meetting jcm ON jcm.id = jcmp.tool_box_talk_id
LEFT JOIN jj_data_code jdc ON IFNULL(jcmp.position_code,'0900107') = jdc.code_value AND jdc.`code` = 'POSITION_CODE'
LEFT JOIN jj_ticket jtt ON jcm.ticket_id = jtt.id
LEFT JOIN jj_user jju ON jcmp.personnel_id = jju.id AND jju.delete_flag = 0
WHERE DATE_FORMAT(jcm.current_constr_date, '%Y-%m-%d') = #{currentDay} AND jcmp.delete_flag = 0 AND jcm.delete_flag = 0 AND jcmp.position_flag = 1
<if test="personName != null and personName != ''">
AND INSTR(jcmp.real_name,#{personName}) > 0
</if>
<if test="teamName != null and teamName != ''">
AND INSTR(jtt.working_team_name,#{teamName}) > 0
</if>
<if test="proName != null and proName != ''">
AND INSTR(jcm.bidding_section_name,#{proName}) > 0
</if>
<if test="personType!=null and personType!=''">
AND jdc.code_value = #{personType}
</if>
<if test="warehousing!=null and warehousing!='' and warehousing== 1">
AND jju.id IS NOT NULL
</if>
<if test="warehousing!=null and warehousing!='' and warehousing== 2">
AND jju.id IS NULL
</if>
</select>
<select id="getPersonListByZc" resultType="com.sercurityControl.proteam.domain.PersonData"
parameterType="com.sercurityControl.proteam.domain.PersonData">
select DISTINCT tpa.id_card, IFNULL(pt.people_type_name,'其他作业人员') personType,tpa.person_name personName,fy.single_name proName,
fy.build_org_name,pt.team_name teamName,pt. phone foremanPhone
from t_person_attendance tpa
INNER JOIN(
select distinct bak_ic, people_type_name,single_no,team_name,phone
from jj_person
)pt on pt.bak_ic=tpa.id_card and pt.single_no=tpa.sing_code
INNER join jj_fix_ybz fy on fy.single_no=tpa.sing_code
WHERE fy.single_no IS NOT NULL AND fy.`status` ='1' and fy.is_tc = '1' AND tpa.att_date=#{currentDay}
<if test="personName != null and personName != ''">
and tpa.`person_name` like concat('%',#{personName},'%')
</if>
<if test="teamName != null and teamName != ''">
and pt.team_name like concat('%',#{teamName},'%')
</if>
<if test="proName != null and proName != ''">
and fy.single_name like concat('%',#{proName},'%')
</if>
<if test="personType==1">
and pt.people_type_name in ('副班长', '工作负责人', '班长兼指挥', '班组安全员')
</if>
<if test="personType==2">
and pt.people_type_name in ('牵张机械操作手', '其他技术人员', '班组技术兼质检员', '特殊工种作业人员', '班组技术员兼质检员')
</if>
<if test="personType==3">
and pt.people_type_name not in ('副班长', '工作负责人', '班长兼指挥', '班组安全员', '牵张机械操作手', '其他技术人员', '班组技术兼质检员', '特殊工种作业人员',
'班组技术员兼质检员')
</if>
</select>
<select id="getRiskByDate" resultType="com.sercurityControl.proteam.domain.RiskDay">
select jzb.re_assessment_risk_level as riskType ,count(id) as riskNum
from jj_class_meetting jzb
LEFT JOIN jj_bid_project jbp on jzb.build_unit_code=jbp.bid_no
where jzb.current_constr_date=#{date} and jzb.build_unit_code=#{orgId}
GROUP BY jzb.re_assessment_risk_level
</select>
<!--日计划总数、已执行总数-->
<select id="getDayPlanNum" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM jj_day_plan tdp
INNER JOIN jj_bid_project jbp ON tdp.build_unit_code = jbp.bid_no
<where>
jbp.pro_type IN ('00','01','03','05')
<if test="dayType == 3">
AND work_time = (curdate() - INTERVAL 0 DAY)
</if>
<if test="dayType == 2">
AND work_time = (curdate() - INTERVAL 1 DAY)
</if>
<if test="dayType == 1">
AND work_time = (curdate() - INTERVAL 2 DAY)
</if>
<if test="proType == '01'">
AND jbp.pro_type IN ('00','01')
</if>
<if test="proType == '03'">
AND jbp.pro_type IN ('03','05')
</if>
</where>
UNION ALL
SELECT COUNT(*)
FROM t_daily_plan tdp
INNER JOIN jj_bid_project jbp ON tdp.bid_id = jbp.bid_no
INNER JOIN t_class_metting tcm ON tdp.bzz_bak_ic = tcm.work_manager_num AND tcm.del_flag = '0'
<where>
jbp.pro_type IN ('00','01','03','05')
<if test="dayType == 3">
AND tdp.work_time = (curdate() - INTERVAL 0 DAY)
AND tcm.work_day = (curdate() - INTERVAL 0 DAY)
</if>
<if test="dayType == 2">
AND tdp.work_time = (curdate() - INTERVAL 1 DAY)
AND tcm.work_day = (curdate() - INTERVAL 1 DAY)
</if>
<if test="dayType == 1">
AND tdp.work_time = (curdate() - INTERVAL 2 DAY)
AND tcm.work_day = (curdate() - INTERVAL 2 DAY)
</if>
<if test="proType == '01'">
AND jbp.pro_type IN ('00','01')
</if>
<if test="proType == '03'">
AND jbp.pro_type IN ('03','05')
</if>
</where>
</select>
<!--日计划总数 / 已执行总数-->
<select id="getNewDayPlanNum" resultType="java.lang.Integer">
SELECT COUNT(*) AS num
FROM jj_day_plan jjdp
LEFT JOIN (
select distinct prj_type,single_project_code,delete_flag
from jj_single_info where delete_flag=0
) jsi on jsi.single_project_code=jjdp.single_project_code
WHERE DATE_FORMAT(jjdp.planned_start_date, '%Y-%m-%d') = CURRENT_DATE AND jjdp.exec_status NOT IN (2) AND jjdp.plan_status = '04' AND jjdp.delete_flag = 0
<if test="proType!=null and proType!=''">
and jsi.prj_type=#{proType}
</if>
UNION ALL
SELECT COUNT(*) AS num
FROM jj_day_plan jjdp
LEFT JOIN (
select distinct prj_type,single_project_code,delete_flag
from jj_single_info where delete_flag=0
) jsi on jsi.single_project_code=jjdp.single_project_code
WHERE DATE_FORMAT(jjdp.planned_start_date, '%Y-%m-%d') = CURRENT_DATE AND jjdp.exec_status = 1 AND jjdp.plan_status = '04' AND jjdp.delete_flag = 0
<if test="proType!=null and proType!=''">
and jsi.prj_type=#{proType}
</if>
</select>
<!--地市-日计划数量-->
<select id="getDayPlanOrgNum" resultType="java.util.Map">
SELECT so.org_id AS orgId,
so.city_name AS cityName,
COUNT(IF(jbp.id IS NOT NULL,1,NULL)) AS totalNum,
COUNT(IF(tcm.work_manager_num IS NOT NULL,1,NULL)) AS executedNum
FROM sys_org so
LEFT JOIN t_daily_plan tdp ON so.org_id = tdp.build_org_no
<if test="dayType == 3">
AND tdp.work_time = (curdate() - INTERVAL 0 DAY)
</if>
<if test="dayType == 2">
AND tdp.work_time = (curdate() - INTERVAL 1 DAY)
</if>
<if test="dayType == 1">
AND tdp.work_time = (curdate() - INTERVAL 2 DAY)
</if>
LEFT JOIN jj_bid_project jbp ON tdp.bid_id = jbp.bid_no AND jbp.pro_type IN ('00','01','03','05')
<if test="proType == '01'">
AND jbp.pro_type IN ('00','01')
</if>
<if test="proType == '03'">
AND jbp.pro_type IN ('03','05')
</if>
LEFT JOIN t_class_metting tcm ON tdp.bzz_bak_ic = tcm.work_manager_num AND tcm.del_flag = '0' AND jbp.pro_type
IN ('01','03')
<if test="proType!='' and proType!=null">
AND jbp.pro_type = #{proType}
</if>
<if test="dayType == 3">
AND tcm.work_day = (curdate() - INTERVAL 0 DAY)
</if>
<if test="dayType == 2">
AND tcm.work_day = (curdate() - INTERVAL 1 DAY)
</if>
<if test="dayType == 1">
AND tcm.work_day = (curdate() - INTERVAL 2 DAY)
</if>
GROUP BY so.org_id
ORDER BY totalNum DESC,executedNum DESC
</select>
<!--日计划总数 / 已执行总数 echarts 数据-->
<select id="getNewDayPlanOrgNum" resultType="java.util.Map">
SELECT so.org_id AS orgId,
so.city_name AS cityName,
IFNULL(a.totalNum,0) AS totalNum,
IFNULL(a.executedNum,0) AS executedNum
FROM sys_org so
LEFT JOIN (
SELECT jjdp.build_unit_code AS org,
COUNT(jjdp.build_unit_code) AS totalNum,
COUNT(IF(exec_status = 1,1,NULL)) AS executedNum
FROM jj_day_plan jjdp
LEFT JOIN (
select distinct prj_type,single_project_code,delete_flag
from jj_single_info
where delete_flag=0
) jsi on jsi.single_project_code=jjdp.single_project_code
WHERE DATE_FORMAT(jjdp.planned_start_date, '%Y-%m-%d') = CURRENT_DATE AND jjdp.exec_status NOT IN (2) AND jjdp.plan_status = '04' AND jjdp.delete_flag = 0
<if test="proType!=null and proType!=''">
and jsi.prj_type=#{proType}
</if>
GROUP BY jjdp.build_unit_code
) a ON so.org_id = a.org
ORDER BY IFNULL(a.totalNum,0) DESC
</select>
<select id="getAttendanceNum" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM t_person_attendance tpa
LEFT JOIN jj_bid_project jbp ON tpa.bid_code = jbp.bid_no
WHERE jbp.build_no = #{orgId} AND tpa.att_date = curdate()
UNION ALL
SELECT COUNT(*)
FROM t_class_metting_people tcmp
LEFT JOIN t_class_metting tcm ON tcmp.class_id = tcm.class_id AND tcm.work_day = curdate()
WHERE tcm.org = #{orgId} AND tcmp.create_day = curdate()
</select>
<!--地市工程数量和占比-->
<select id="getOrgNumAndRateByPro" resultType="java.util.Map">
SELECT so.org_id AS `code`, so.city_name AS `name` ,IFNULL(a.num,0) AS num
FROM sys_org so
LEFT JOIN (
SELECT b.buildNo,COUNT(b.buildNo) AS num FROM (
SELECT DISTINCT jfy.single_no AS singleNo,jfy.build_org_no AS buildNo
FROM jj_fix_ybz jfy
<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="bidName != null and bidName != ''">
AND INSTR(jfy.single_name,#{bidName}) > 0
</if>
<if test="proType !=null and proType!=''">
AND jfy.single_type = #{proType}
</if>
</where>
) b
GROUP BY b.buildNo
)a ON a.buildNo = so.org_id
ORDER BY num DESC
</select>
<select id="getOrgNumAndRateByProNew" resultType="java.util.Map">
SELECT so.org_id AS `code`, so.city_name AS `name` ,IFNULL(a.num,0) AS num
FROM sys_org so
LEFT JOIN (
SELECT b.buildNo,COUNT(b.buildNo) AS num FROM (
SELECT jfy.org AS singleNo,jfy.org AS buildNo
FROM tb_new_pro jfy
where jfy.is_pro='2'
<if test="type !=null and type != ''">
and jfy.pro_status = #{type}
</if>
<if test="type ==null and type == ''">
and jfy.pro_status = '-1'
</if>
<if test="bidName != null and bidName != ''">
AND INSTR(jfy.pro_name,#{bidName}) > 0
</if>
) b
GROUP BY b.buildNo
)a ON a.buildNo = so.org_id
ORDER BY num DESC
</select>
<!--地市周风险数量和占比-->
<select id="getOrgNumAndRateByWeek" resultType="java.util.Map">
select city_name,IFNULL(wn.num ,0) NUM
from sys_org so
left join (
select count(1) num,build_unit_code build_no
FROM jj_weeks_plan
where #{curryDay} between planned_start_date and planned_end_date
<if test='weekType==3'>
and (re_assessment_risk_level in ('三级','3') )
</if>
<if test='weekType==2'>
(re_assessment_risk_level='二级' or re_assessment_risk_level='2' )
</if>
GROUP BY build_unit_code
)wn on wn.build_no=so.org_id
ORDER BY num desc
</select>
<!--地市周风险数量和占比-二级页面-->
<select id="getOrgNumAndRateByWeekChild" resultType="java.util.Map">
SELECT so.org_id AS `code`, so.city_name AS `name` ,IFNULL(a.num,0) AS num
FROM sys_org so
LEFT JOIN (
SELECT jwp.build_unit_code AS org, COUNT(jwp.build_unit_code) AS num
FROM jj_weeks_plan jwp
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>
jwp.plan_status = '04' AND jwp.delete_flag = '0'
<if test="curryDay != null and curryDay != ''">
AND #{curryDay} BETWEEN DATE_FORMAT(jwp.planned_start_date, '%Y-%m-%d') AND DATE_FORMAT(jwp.planned_end_date, '%Y-%m-%d')
</if>
<if test="proName != null and proName != ''">
AND INSTR(jwp.bidding_section_name,#{proName}) > 0
</if>
<if test="workType != null and workType != ''">
AND INSTR(jdc.value,#{workType}) > 0
</if>
<if test="workTeam != null and workTeam != ''">
AND INSTR(jt.working_team_name,#{workTeam}) > 0
</if>
<if test="riskType != null and riskType != ''">
AND jsp.re_assessment_risk_level = #{riskType}
</if>
</where>
GROUP BY jwp.build_unit_code
) a ON so.org_id = a.org
ORDER BY IFNULL(a.num,0) DESC
</select>
<!--地市作业票数量和占比-二级页面-->
<select id="getOrgNumAndRateByTicket" resultType="java.util.Map">
SELECT so.org_id AS `code`, so.city_name AS `name` ,IFNULL(a.num,0) AS num
FROM sys_org so
LEFT JOIN (
SELECT tti.build_unit_code build_org_no,COUNT(tti.build_unit_code) AS num
FROM jj_ticket tti
LEFT JOIN sys_org so ON so.org_id = tti.build_unit_code
LEFT JOIN jj_ticket_people jjtp ON tti.id = jjtp.ticket_id AND jjtp.position_code = '0900101' AND jjtp.delete_flag = '0'
WHERE tti.ticket_status = '05' AND tti.delete_flag = 0
<if test="ticketName != null and ticketName != ''">
AND INSTR(tti.ticket_name,#{ticketName}) > 0
</if>
<if test="ticketNo != null and ticketNo != ''">
AND INSTR(tti.ticket_no,#{ticketNo}) > 0
</if>
<if test="signName != null and signName != ''">
AND INSTR(tti.single_project_name,#{signName}) > 0
</if>
<if test="foreman != null and foreman != ''">
AND INSTR(jjtp.real_name,#{foreman}) > 0
</if>
<if test="riskType!=null and riskType!=''">
AND tti.re_assessment_risk_level IN (
<foreach collection="riskTypeList" item="item" separator=",">
#{item}
</foreach>
)
</if>
GROUP BY tti.build_unit_code
)a ON a.build_org_no = so.org_id
ORDER BY num DESC
</select>
<!-- 工程统计 -->
<select id="getNewProNumByType" resultType="java.lang.Integer">
select count(1) num
from tb_new_pro
WHERE is_pro='2' AND pro_status='1' and is_flag='0'
<if test="orgId!='' and orgId!=null">
AND org = #{orgId}
</if>
union all
select count(1) num
from tb_new_pro
WHERE is_pro='2' AND pro_status='1' and is_flag='0' and year_date=#{year}
<if test="orgId!='' and orgId!=null">
AND org = #{orgId}
</if>
union all
select count(1)
from tb_new_pro
WHERE is_pro='2' AND pro_status='2' and is_flag='0' and year_date=#{year}
<if test="orgId!='' and orgId!=null">
AND org = #{orgId}
</if>
union all
select count(1)
from tb_new_pro
WHERE is_pro='2' AND pro_status='3' and is_flag='0' and year_date=#{year}
<if test="orgId!='' and orgId!=null">
AND org = #{orgId}
</if>
union all
select count(1) num
from tb_new_pro
WHERE is_pro='2' AND pro_status='0' and is_flag='0' and year_date=#{year}
<if test="orgId!='' and orgId!=null">
AND org = #{orgId}
</if>
</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="getClassMettingData" parameterType="com.sercurityControl.proteam.domain.ClassMettingStaVo" resultType="com.sercurityControl.proteam.domain.ClassMettingStaVo">
<if test="type == 2">
SELECT so.city_name name ,ifnull(num,0) num
from sys_org so
LEFT join(
select jcm.build_unit_code org_id,COUNT(jcm.id) num
from jj_class_meetting jcm
where jcm.current_constr_date=#{curryDay} AND jcm.delete_flag=0
GROUP BY jcm.build_unit_code
)cm on cm.org_id=so.org_id
ORDER BY num desc
</if>
<if test="type==1">
SELECT ifNull(COUNT(id),0) num,'二级' name
FROM jj_class_meetting where current_constr_date=#{curryDay} and re_assessment_risk_level in ('2','二级') AND delete_flag = '0'
union ALL
SELECT ifNull(COUNT(id),0),'三级' name
FROM jj_class_meetting where current_constr_date=#{curryDay} and re_assessment_risk_level in ('3','三级') AND delete_flag = '0'
union ALL
SELECT ifNull(COUNT(id),0),'四级' name
FROM jj_class_meetting where current_constr_date=#{curryDay} and re_assessment_risk_level in ('4','四级') AND delete_flag = '0'
union ALL
SELECT ifNull(COUNT(id),0),'五级' name
FROM jj_class_meetting where current_constr_date=#{curryDay} and re_assessment_risk_level in ('5','五级') AND delete_flag = '0'
</if>
</select>
<select id="getClassMettingList" parameterType="com.sercurityControl.proteam.domain.ClassMettingStaVo" resultType="com.sercurityControl.proteam.domain.ProData">
SELECT jcm.current_constr_date curryDay,jcmi.work_manage_phone workManagePhone,
jcmi.work_manage workManage, jcm.bidding_section_name proName,
CASE jcm.current_construction_status WHEN '01' THEN '开工'
WHEN '02' THEN '暂停'
WHEN '03' THEN '完工'
END AS state,
jcm.re_assessment_risk_level riskLevel,
jcmi.work_content workContent,
so.city_name AS orgName
FROM jj_class_meetting jcm
left join jj_class_metting_info jcmi on jcm.id=jcmi.class_id
left join sys_org so on jcm.build_unit_code =so.org_id
where jcm.current_constr_date=#{curryDay} AND jcm.delete_flag = '0'
<if test="orgList!=null and orgList!=''">
AND jcm.build_unit_code IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="riskList!=null and riskList!=''">
AND jcm.re_assessment_risk_level IN (
<foreach collection="riskList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="keyWord!=null and keyWord!=''">
AND (
INSTR(jcmi.work_manage,#{keyWord}) > 0 OR
INSTR(jcm.bidding_section_name,#{keyWord}) > 0
)
</if>
<if test="state!=null and state!=''">
AND current_construction_status = #{state}
</if>
ORDER BY jcm.current_construction_status ASC,jcm.re_assessment_risk_level DESC
</select>
<!--地市站班会数量和占比-二级页面-->
<select id="getOrgNumAndRateByClass" resultType="java.util.Map">
SELECT so.org_id AS `code`, so.city_name AS `name` ,IFNULL(a.num,0) AS num
FROM sys_org so
LEFT JOIN (
SELECT jcm.build_unit_code org,COUNT(jcm.id) AS num
FROM jj_class_meetting jcm
left join jj_class_metting_info jcmi on jcm.id=jcmi.class_id
WHERE delete_flag = '0' AND current_constr_date=#{curryDay}
<if test="orgList!=null and orgList!=''">
AND jcm.build_unit_code IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="riskList!=null and riskList!=''">
AND jcm.re_assessment_risk_level IN (
<foreach collection="riskList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="keyWord!=null and keyWord!=''">
AND (
INSTR(jcmi.work_manage,#{keyWord}) > 0 OR
INSTR(jcm.bidding_section_name,#{keyWord}) > 0
)
</if>
<if test="state!=null and state!=''">
AND current_construction_status = #{state}
</if>
GROUP BY build_unit_code
)a ON a.org = so.org_id
ORDER BY num DESC
</select>
<!--查询日计划数据-->
<select id="getDailPlanList" parameterType="com.sercurityControl.proteam.domain.DailyPlanVo" resultType="com.sercurityControl.proteam.domain.DailyPlanVo">
SELECT plan.create_time createTime,so.city_name orgName,plan.bid_name bidName,plan.job_num jobNum,plan.zypfzr,plan.aqjhr
,plan.zybw,plan.zygx,plan.zynr,plan.fxdj,concat( plan.dqztsgjd,'%') dqztsgjd,plan.bzmc,concat(plan.bzz_name,plan.bzz_lxfs) bzzName,
plan.bzaqy,plan.bzzjy,plan.work_gk_content workGkContent,plan.work_time workTime,concat( plan.xmjl,plan.xmjl_lxfs) xmjl
FROM t_daily_plan plan
left join sys_org so on so.org_id=plan.build_org_no
<if test="planType!=null and planType!='' ">
left join t_class_metting cm on cm.work_manager_num=plan.bzz_bak_ic and cm.work_day=plan.work_time
</if>
<where>
<if test="planType!=null and planType!='' ">
<if test="planType=='01' ">
and cm.class_id is not null
</if>
<if test="planType=='02' ">
and cm.class_id is null
</if>
</if>
<if test="workTime!=null and workTime!=''">
and plan.work_time=#{workTime}
</if>
<if test="orgList!=null and orgList!=''">
and plan.build_org_no in(
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="keyWord!=null and keyWord!=''">
and (
plan.xmjl like concat('%',#{keyWord},'%') or
plan.xmjl_lxfs like concat('%',#{keyWord},'%') or
plan.zynr like concat('%',#{keyWord},'%') or
plan.zybw like concat('%',#{keyWord},'%') or
plan.fxdj like concat('%',#{keyWord},'%') or
plan.zygx like concat('%',#{keyWord},'%') or
plan.work_gk_content like concat('%',#{keyWord},'%') or
plan.bzzjy like concat('%',#{keyWord},'%') or
plan.bzaqy like concat('%',#{keyWord},'%') or
plan.bzz_name like concat('%',#{keyWord},'%') or
plan.bzz_lxfs like concat('%',#{keyWord},'%') or
plan.job_num like concat('%',#{keyWord},'%') or
plan.work_time like concat('%',#{keyWord},'%')
)
</if>
</where>
</select>
<select id="getNewDailPlanList1" parameterType="com.sercurityControl.proteam.domain.DailyPlanHome" resultType="com.sercurityControl.proteam.domain.DailyPlanHome">
SELECT jtt.bidding_section_name,so.city_name orgName,jtt.re_assessment_risk_level riskLevel,
concat(jio.replenish_content_1,IFNULL(jio.replenish_content_2,''),IFNULL(replenish_content_3,'')
,IFNULL(jio.replenish_content_4,''),IFNULL(jio.replenish_content_5,'')
,IFNULL(jio.replenish_content_6,''),IFNULL(jio.replenish_content_7,'')
) jobManRisk,jtt.id ticketId,jtt.bidding_section_name projectName,
jtt.working_team_name jobTeam
from jj_ticket jtt
LEFT JOIN sys_org so on so.org_id=jtt.build_unit_code
left join jj_single_project jsp ON jsp.single_project_code=jtt.single_project_code
left join jj_info jio on jio.ref_id=jtt.id and jio.ext_type='40' and jio.content_type='3' -- 主要风险
WHERE jtt.delete_flag=0 and jtt.ticket_status='05'
<if test="orgList!=null and orgList!=''">
and jtt.build_unit_code in(
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="proType == '01'">
AND jsp.single_project_type IN ('00','1')
</if>
<if test="proType == '03'">
AND jsp.single_project_type IN ('3','05')
</if>
<if test="keyWord!=null and keyWord!=''">
and (
jtt.bidding_section_name like concat('%',#{keyWord},'%') or
tti.city_name like concat('%',#{keyWord},'%') or
jio.replenish_content_1 like concat('%',#{keyWord},'%') or
jio.replenish_content_2 like concat('%',#{keyWord},'%') or
jio.replenish_content_3 like concat('%',#{keyWord},'%') or
jio.replenish_content_4 like concat('%',#{keyWord},'%') or
jio.replenish_content_5 like concat('%',#{keyWord},'%') or
jio.replenish_content_6 like concat('%',#{keyWord},'%') or
jio.replenish_content_7 like concat('%',#{keyWord},'%')
)
</if>
</select>
<select id="getNewDailPlanList2" parameterType="com.sercurityControl.proteam.domain.DailyPlanHome" resultType="com.sercurityControl.proteam.domain.DailyPlanHome">
select jcmi.team_name teamName,jcmi.work_manage workManage, jcmi.work_content workContent,jcm.bidding_section_name proName,
jcmi.work_type workType,jcmi.work_gx workGx,jcm.re_assessment_risk_level riskLevel,so.city_name orgName
from jj_class_meetting jcm
left join sys_org so on jcm.build_unit_code=so.org_id
left join jj_class_metting_info jcmi on jcm.id=jcmi.class_id
left join jj_single_project jsp on jsp.single_project_code=jcm.single_project_code
where jcm.current_constr_date=current_date () AND jcm.delete_flag='0'
<if test="orgList!=null and orgList!=''">
and jcm.build_unit_code in(
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="proType == '01'">
AND jsp.single_project_type IN ('00','1')
</if>
<if test="proType == '03'">
AND jsp.single_project_type IN ('3','05')
</if>
<if test="keyWord!=null and keyWord!=''">
and (
jcmi.work_manage like concat('%',#{keyWord},'%') or
jcmi.team_name like concat('%',#{keyWord},'%') or
jcmi.work_content like concat('%',#{keyWord},'%') or
jcmi.work_type like concat('%',#{keyWord},'%') or
jcmi.work_gx like concat('%',#{keyWord},'%') or
jcm.bidding_section_name like concat('%',#{keyWord},'%')
)
</if>
</select>
<select id="getOrgNumAndRateByDailPlan" resultType="java.util.Map" parameterType="com.sercurityControl.proteam.domain.DailyPlanVo">
SELECT so.org_id AS code,
so.city_name AS name,
IFNULL(a.num,0) AS num
FROM sys_org so
LEFT JOIN (
SELECT jjdp.build_unit_code AS org,COUNT(jjdp.build_unit_code) AS num
FROM jj_day_plan jjdp
LEFT JOIN jj_ticket jjt ON jjdp.ticket_id = jjt.id AND jjt.delete_flag = 0
LEFT JOIN jj_class_metting_info jjcmi ON jjdp.tool_box_talk_id = jjcmi.class_id
WHERE DATE_FORMAT(jjdp.planned_start_date, '%Y-%m-%d') = CURRENT_DATE AND jjdp.exec_status NOT IN (2) AND jjdp.plan_status in('04','4') AND jjdp.delete_flag = 0
<if test="keyWord!=null and keyWord!=''">
AND (
INSTR(jjdp.bidding_section_name,#{keyWord}) > 0 OR
INSTR(jjt.working_team_name,#{keyWord}) > 0 OR
INSTR(jjcmi.real_name,#{keyWord}) > 0 OR
)
</if>
<if test="execStatus!=null and execStatus!=''">
AND IFNULL(jjdp.exec_status,0) = #{execStatus}
</if>
GROUP BY jjdp.build_unit_code
) a ON so.org_id = a.org
ORDER BY IFNULL(a.num,0) DESC
</select>
<select id="getWeekRiskNumByWeekTime" resultType="java.util.Map" parameterType="String" >
SELECT
COUNT(1) AS planNum ,
COUNT(IF(jsp.re_assessment_risk_level = '2',1,NULL)) AS twoRisk,
COUNT(IF(jsp.re_assessment_risk_level = '3' ,1,NULL)) AS threeRisk,
COUNT(IF((jsp.re_assessment_risk_level = '4' or wplan.re_assessment_risk_level = '5'),1,NULL)) AS foureRisk
FROM jj_weeks_plan wplan
LEFT JOIN jj_risk_precaution jsp on jsp.id=wplan.risk_precaution_id AND jsp.delete_flag = 0
WHERE (DATE_FORMAT(wplan.planned_start_date, '%Y-%m-%d') BETWEEN #{startTime} and #{endTime}
or DATE_FORMAT(wplan.planned_end_date, '%Y-%m-%d') BETWEEN #{startTime} and #{endTime}) AND wplan.plan_status in('04','4')
AND wplan.delete_flag = '0' AND jsp.re_assessment_risk_level IN ('2','3','4','5')
</select>
<select id="getWeekRiskByRiskLevel" parameterType="String" resultType="com.sercurityControl.proteam.domain.MapsValueVo">
select '合计' name ,COUNT(1) num
from jj_weeks_plan jwp
left join sys_org so ON so.org_id=jwp.build_unit_code
WHERE (jwp.planned_start_date BETWEEN #{startTime} and #{endTime}
or jwp.planned_end_date BETWEEN #{startTime} and #{endTime})
and jwp.re_assessment_risk_level=#{riskLevel}
union ALL
select so.city_name name ,COUNT(1) num
from jj_weeks_plan jwp
left join sys_org so ON so.org_id=jwp.build_unit_code
WHERE (jwp.planned_start_date BETWEEN #{startTime} and #{endTime}
or jwp.planned_end_date BETWEEN #{startTime} and #{endTime}) and jwp.re_assessment_risk_level=#{riskLevel}
GROUP BY jwp.build_unit_code
</select>
<select id="getNexWeekPro" parameterType="String" resultType="com.sercurityControl.proteam.domain.vo.WeekPlanVo">
select so.abb_name cityName,jsp.work_content workContent,jwp.bidding_section_name proName,
jdc.`value` workType
from jj_weeks_plan jwp
left join jj_risk_precaution jsp ON jsp.id=jwp.risk_precaution_id
left join jj_data_code jdc on jdc.code_value=jsp.work_type and jdc.`code`='WORK_TYPE'
left join sys_org so ON so.org_id=jwp.build_unit_code
WHERE (jwp.planned_start_date BETWEEN #{startTime} and #{endTime}
or jwp.planned_end_date BETWEEN #{startTime} and #{endTime}) and jwp.re_assessment_risk_level=#{riskLevel}
</select>
<select id="getAllRiskLevelNum" resultType="java.util.Map" parameterType="String" >
SELECT
COUNT(1) AS planNum ,
COUNT(IF(jsp.re_assessment_risk_level = '2',1,NULL)) AS twoRisk,
COUNT(IF(jsp.re_assessment_risk_level = '3' ,1,NULL)) AS threeRisk,
COUNT(IF((jsp.re_assessment_risk_level = '4' or wplan.re_assessment_risk_level = '5') ,1,NULL)) AS foureRisk
FROM jj_weeks_plan wplan
LEFT JOIN jj_risk_precaution jsp on jsp.id=wplan.risk_precaution_id AND jsp.delete_flag = 0
WHERE #{time} BETWEEN DATE_FORMAT(wplan.planned_start_date, '%Y-%m-%d') and DATE_FORMAT(wplan.planned_end_date, '%Y-%m-%d') AND wplan.plan_status in('04','4') AND wplan.delete_flag = '0' AND jsp.re_assessment_risk_level IN ('2','3','4','5')
</select>
<select id="getWzXx" parameterType="String" resultType="Integer">
select count(1)
FROM t_notice_voi
where (status=1 or status=3) and org=#{orgId} and is_flag=0 and sup_type='1'
</select>
<!--是否报岗-->
<select id="getIsBg" resultType="Integer" parameterType="String">
select count(1)
from t_job_application
WHERE curry_day=#{nowDay} and org_id=#{orgId}
</select>
<select id="getGtList" resultType="com.sercurityControl.proteam.dutyTask.domain.TowerVo">
select pro_name proName,gt_name towerName,lat,lon ,bid_no proNo
from t_pro_gt
where pro_no=#{proNo} AND is_flag = '0'
AND lat IS not null
</select>
<select id="getWorkInfo" resultType="com.sercurityControl.proteam.domain.WorkInfoVo">
select distinct jrp.work_site_name workSite,jrp.work_type 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="getClassPeopleNum"
resultType="com.sercurityControl.proteam.domain.vo.HomeDataVo$PersonnelCountVo">
SELECT * FROM (
SELECT jdc.`value` AS personTypeName,
ANY_VALUE(jdc.code_value) AS personType,
COUNT(1) AS num
FROM jj_class_meeting_people jcmp
LEFT JOIN jj_class_meetting jcm ON jcm.id = jcmp.tool_box_talk_id
LEFT JOIN jj_data_code jdc ON IFNULL(jcmp.position_code,'0900107') = jdc.code_value AND jdc.`code` = 'POSITION_CODE'
WHERE DATE_FORMAT(jcm.current_constr_date, '%Y-%m-%d') = CURRENT_DATE() AND jcmp.delete_flag = 0 AND jcm.delete_flag = 0 AND jcmp.position_flag = 1
GROUP BY jdc.`value`
) a
ORDER BY a.personType
</select>
<!--获取班组长-->
<select id="getTeamLeader" resultType="java.lang.String">
SELECT jcmp.real_name AS personName
FROM jj_class_meetting jcm
LEFT JOIN jj_class_meeting_people jcmp ON jcm.id = jcmp.tool_box_talk_id
WHERE jcm.id = #{classId} AND jcmp.position_code = '0900101' and jcmp.position_flag='1'
LIMIT 1
</select>
<!--获取施工日计划-->
<select id="getDayPlanLists" resultType="com.sercurityControl.proteam.domain.DailyPlanHome">
SELECT so.city_name AS orgName,
jjdp.bidding_section_name AS proName,
jjt.re_assessment_risk_level AS riskLevel,
jjt.working_team_name AS teamName,
jjrp.work_procedure AS workGx,
jjdc.name AS workType,
jjrp.work_content AS workContent,
jjcmi.work_manage AS workManage,
jjrp.work_site_name AS workSiteName,
jjdp.exec_status AS execStatus
FROM jj_day_plan jjdp
LEFT JOIN sys_org so ON jjdp.build_unit_code = so.org_id
LEFT JOIN jj_ticket jjt ON jjdp.ticket_id = jjt.id AND jjt.delete_flag = 0
LEFT JOIN jj_class_metting_info jjcmi ON jjdp.tool_box_talk_id = jjcmi.class_id
LEFT JOIN jj_risk_precaution jjrp ON jjdp.risk_precaution_id = jjrp.id AND jjrp.delete_flag = 0
LEFT JOIN jj_data_code jjdc ON jjrp.work_type = jjdc.code_value AND jjdc.code = 'WORK_TYPE'
WHERE DATE_FORMAT(jjdp.planned_start_date, '%Y-%m-%d') = CURRENT_DATE AND jjdp.exec_status NOT IN (2) AND jjdp.plan_status in('04','4') AND jjdp.delete_flag = 0
<if test="orgList!=null and orgList!=''">
AND jjdp.build_unit_code IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="keyWord!=null and keyWord!=''">
AND (
INSTR(jjdp.bidding_section_name,#{keyWord}) > 0 OR
INSTR(jjt.working_team_name,#{keyWord}) > 0 OR
INSTR(jjcmi.work_manage,#{keyWord}) > 0
)
</if>
<if test="execStatus!=null and execStatus!=''">
AND IFNULL(jjdp.exec_status,0) = #{execStatus}
</if>
</select>
<!--从日计划中查询作业内容-->
<select id="getWorkContent" resultType="java.lang.String">
SELECT jjrp.work_content
FROM jj_day_plan jjdp
LEFT JOIN jj_risk_precaution jjrp ON jjdp.risk_precaution_id = jjrp.id
WHERE jjdp.ticket_id = #{id}
</select>
<select id="getSingInfoByType" resultType="java.lang.Integer">
select count(distinct jj_single_info.single_project_code)
FROM jj_single_info
where safety_project_status='05' -- 在建
and delete_flag=0
<if test="proType!=null and proType!=''">
AND prj_type=#{proType}
</if>
<if test="orgId!='' and orgId!=null">
AND build_unit_code = #{orgId}
</if>
union ALL
select count(distinct single_project_code)
FROM jj_single_info
where delete_flag=0 AND is_work=1
<if test="proType!=null and proType!=''">
AND prj_type=#{proType}
</if>
<if test="orgId!='' and orgId!=null">
AND build_unit_code = #{orgId}
</if>
<if test="orgId!='' and orgId!=null">
AND build_unit_code = #{orgId}
</if>
union ALL
select count(distinct single_project_code)
FROM jj_single_info
where delete_flag=0 AND is_stop=1
<if test="proType!=null and proType!=''">
AND prj_type=#{proType}
</if>
<if test="orgId!='' and orgId!=null">
AND build_unit_code = #{orgId}
</if>
union ALL
select count(distinct single_project_code)
FROM jj_single_info
where safety_project_status='04' -- 投产
and delete_flag=0
<if test="proType!=null and proType!=''">
AND prj_type=#{proType}
</if>
<if test="orgId!='' and orgId!=null">
AND build_unit_code = #{orgId}
</if>
union ALL
select count(distinct single_project_code)
FROM jj_single_info
where safety_project_status='01' -- 待建
and delete_flag=0
<if test="proType!=null and proType!=''">
AND prj_type=#{proType}
</if>
</select>
<!--获取工程信息 -->
<select id="getNewProListByType" resultType="com.sercurityControl.proteam.domain.ProData">
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
from tb_new_pro pro
WHERE pro.is_pro='2' AND is_flag = '0'
<if test="yearDate!=null and yearDate!='' ">
AND year_date=#{yearDate}
</if>
<if test="type != null and type != ''">
AND pro_status = #{type}
</if>
<if test="type == null or type == ''">
AND pro_status = '-1'
</if>
<if test="buildCode!=null and buildCode!=''">
AND org IN (
<foreach collection="buildCodeList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="bidName != null and bidName != ''">
AND INSTR(pro_name,#{bidName}) > 0
</if>
</select>
<select id="getSingleInfoByType" resultType="com.sercurityControl.proteam.domain.ProData">
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' then '待建'
when is_stop='1' then '停工'
when is_work='1' 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="buildCode!=null and buildCode!=''">
AND jsi.build_unit_code IN (
<foreach collection="buildCodeList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="bidName!= null and bidName!= ''">
AND INSTR(single_project_name,#{bidName}) > 0
</if>
<if test="proStatus!=null and proStatus!= '' ">
AND safety_project_status=#{proStatus}
</if>
<if test="proType!=null and proType!= ''">
AND prj_type =#{proType}
</if>
<if test="isStop!=null and isStop!= ''">
AND is_stop =#{isStop}
</if>
<if test="isWork!=null and isWork!= ''">
AND is_work =#{isWork}
</if>
</select>
<select id="getUnit" resultType="com.sercurityControl.proteam.domain.WeekRiskData">
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="exportExcelByTicket"
resultType="com.sercurityControl.proteam.domain.ExportVo.WeekPlanExportVo">
SELECT jjwp.id,
so.city_name AS cityName,
jjt.single_project_code AS proCode,
jjt.single_project_name AS proName,
jjt.ticket_no AS ticketNo,
CASE jjt.re_assessment_risk_level WHEN '2' THEN '二级' WHEN '3' THEN '三级' WHEN '4' THEN '四级' WHEN '5' THEN '五级' END AS riskLevel,
jjwp.team_id AS teamId,
DATE_FORMAT(jjt.planned_start_date,'%Y-%m-%d %H:%i:%s') AS startTime,
DATE_FORMAT(jjt.planned_end_date,'%Y-%m-%d %H:%i:%s') AS endTime,
jjrp.work_content AS workContent,
jjrp.work_procedure AS workGx,
jjrp.work_site_name AS workSite
FROM jj_weeks_plan jjwp
LEFT JOIN jj_risk_precaution jjrp ON jjwp.risk_precaution_id = jjrp.id
LEFT JOIN jj_weeks_ticket jjwt ON jjwp.id = jjwt.week_id
LEFT JOIN jj_ticket jjt ON jjwt.ticket_id = jjt.id AND jjt.delete_flag = 0
LEFT JOIN sys_org so ON so.org_id = jjwp.build_unit_code
WHERE jjwp.plan_status = '04'
<if test="curryDay != null and curryDay != ''">
AND #{curryDay} BETWEEN DATE_FORMAT(jjwp.planned_start_date, '%Y-%m-%d') AND DATE_FORMAT(jjwp.planned_end_date, '%Y-%m-%d')
</if>
<if test="buildUnitCode!=null and buildUnitCode!=''">
AND jjwp.build_unit_code IN (
<foreach collection="buildUnitCodeList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="riskType != null and riskType != ''">
AND jjt.re_assessment_risk_level = #{riskType}
</if>
<if test="proName != null and proName != ''">
AND INSTR(jjwp.bidding_section_name,#{proName}) > 0
</if>
AND jjwp.delete_flag = '0'
AND jjwp.ticket_id IS NOT NULL
AND jjt.id IS NOT NULL
</select>
<!--获取监理单位-施工单位-->
<select id="getUnitMap" resultType="java.util.Map">
SELECT jcm.supervision_unit_name AS jlUnit,
ju.unit_name AS 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="getWorkPeoples" resultType="java.lang.String">
<if test="type == 1">
SELECT jtp.real_name AS realName
FROM jj_team_people jtp
WHERE jtp.team_id = #{teamId} AND jtp.position_code = '0900101' AND jtp.delete_flag = 0
</if>
<if test="type == 2">
SELECT jtp.real_name AS realName
FROM jj_team_people jtp
WHERE jtp.team_id = #{teamId} AND jtp.position_code = '0900102' AND jtp.delete_flag = 0
</if>
</select>
<!--获取班组人员数量-->
<select id="getTeamNumValue" resultType="java.lang.Integer">
SELECT COUNT(*) AS num
FROM jj_team_people jtp
WHERE jtp.team_id = #{teamId} AND jtp.delete_flag = 0
</select>
<!--判断是否需要报岗-->
<select id="isNeedBg" resultType="java.lang.String">
SELECT sd2.name
FROM sys_dist sd
LEFT JOIN sys_dist sd2 ON sd2.p_id = sd.id AND sd2.is_flag = '0'
WHERE sd.code = 'bg-status' AND sd.is_flag = '0' AND sd2.name IS NOT NULL
</select>
</mapper>