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

211 lines
9.7 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.CityLevelMapper">
<select id="getCityMaps" resultType="com.sercurityControl.proteam.domain.RiskMapData" parameterType="com.sercurityControl.proteam.domain.dto.LoginDto">
select jcm.bidding_section_name proName,
jcm.re_assessment_risk_level riskType,
jcmi.work_manage workManage,
CONCAT(SUBSTRING(IFNULL(jcmi.work_manage_phone,'18855456500'), 1, 3), '*****',
SUBSTRING(IFNULL(jcmi.work_manage_phone,'18855456500'), -4)) AS workManagePhone,
jcmi.work_content workContent,
jcmi.team_name foreman,jcm.current_construction_status,
jcm.tool_box_talk_Latitude lat,jcm.tool_box_talk_longitude lon,
jcm.build_unit_code buildCode
from jj_class_meetting jcm
left JOIN jj_class_metting_info jcmi on jcmi.class_id=jcm.id
<where>
jcm.current_constr_date=current_date() AND jcm.delete_flag = '0'
<if test='isSup=="3"'>
and jcm.build_unit_code=#{orgId}
</if>
</where>
</select>
<select id="getRiskMaps" parameterType="com.sercurityControl.proteam.domain.dto.LoginDto" resultType="com.sercurityControl.proteam.domain.vo.MapsVo">
select count(1) num,cm.re_assessment_risk_level AS status
from jj_class_meetting cm
where cm.current_constr_date=current_date() AND cm.delete_flag = '0'
<if test='isSup=="3"'>
and cm.build_unit_code=#{orgId}
</if>
GROUP BY re_assessment_risk_level
</select>
<!--获取工程数据-->
<select id="getProMaps2" parameterType="com.sercurityControl.proteam.domain.dto.LoginDto" resultType="com.sercurityControl.proteam.domain.vo.MapsVo">
select count(1) num,pro_status status
from tb_new_pro
where is_flag=0 and year_date=YEAR(CURRENT_DATE()) and is_pro='2'
<if test='isSup=="3"'>
and org=#{orgId}
</if>
GROUP BY pro_status
</select>
<select id="getTicketMaps" parameterType="com.sercurityControl.proteam.domain.dto.LoginDto" resultType="com.sercurityControl.proteam.domain.vo.MapsVo">
select count(1) num,ticket_type status
FROM jj_ticket tti
where tti.ticket_status = '05' AND tti.delete_flag = '0'
<if test='isSup=="3"'>
and tti.build_unit_code=#{orgId}
</if>
GROUP BY ticket_type
</select>
<!--作业许可-> 许可和不许可数量-->
<select id="getWorkPermitAndXhNum" resultType="java.util.Map" parameterType="com.sercurityControl.proteam.domain.dto.LoginDto">
SELECT
COUNT(IF(ttec.cancel_status = '1' AND tti.ticket_status IN ('04','05','09'),1,NULL)) AS permit,
COUNT(IF(ttec.cancel_status = '2',1,NULL)) AS notPermit,
COUNT(IF(ttec.cancel_status = '3',1,NULL)) AS cancel,
COUNT(IF(ttec.cancel_status = '1' AND tti.ticket_status in('06','09'),1,NULL)) AS notCancel
FROM tb_ticket_essen_condition ttec
LEFT JOIN jj_ticket tti ON tti.ticket_no = ttec.ticket_no AND tti.delete_flag = '0'
WHERE ttec.del_flag = '0' AND tti.re_assessment_risk_level IN ('2','3') AND ttec.cancel_status IN ('1','2','3')
<if test="isSup == 3">
AND tti.build_unit_code = #{orgId}
</if>
</select>
<!--周计划-->
<select id="getWeekRiskNumByWeekTime" resultType="java.util.Map" parameterType="com.sercurityControl.proteam.domain.dto.LoginDto" >
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'),1,NULL)) AS foureRisk,
COUNT(IF((jsp.re_assessment_risk_level = '5' ),1,NULL)) AS fiveRisk
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.delete_flag=0 and wplan.plan_status='04' and jsp.re_assessment_risk_level IN ('2','3','4','5')
<if test='isSup=="3"'>
and wplan.build_unit_code=#{orgId}
</if>
</select>
<!--风险统计-->
<select id="riskLevel" resultType="com.sercurityControl.proteam.domain.vo.MapsVo" parameterType="com.sercurityControl.proteam.domain.dto.LoginDto">
select count(1) num,current_constr_date AS status,any_value(re_assessment_risk_level) AS riskLevel
from jj_class_meetting cm
where cm.delete_flag=0
and current_constr_date in(
<foreach collection="dateTimes" item="item" separator=",">
#{item}
</foreach>
)
<if test='isSup=="3"'>
and cm.build_unit_code=#{orgId}
</if>
GROUP BY cm.current_constr_date,re_assessment_risk_level
ORDER BY current_constr_date ASC
</select>
<!--查询作业票数据-->
<select id="ticketInfo" resultType="com.sercurityControl.proteam.domain.vo.MapsVo" parameterType="com.sercurityControl.proteam.domain.dto.LoginDto">
select count(1) num ,ticket_type status
from jj_ticket tti
where #{dateTime} BETWEEN DATE_FORMAT(tti.planned_start_date,'%Y-%m-%d') AND DATE_FORMAT(tti.planned_end_date,'%Y-%m-%d')
AND tti.delete_flag = '0' AND tti.ticket_status IN ('05','06')
<if test='isSup=="3"'>
and build_unit_code=#{orgId}
</if>
GROUP BY ticket_type
</select>
<select id="workteam" resultType="com.sercurityControl.proteam.domain.vo.MapsVo">
select COUNT(DISTINCT jcmi.team_id) num,cm.current_constr_date status
from jj_class_meetting cm
left join jj_class_metting_info jcmi on cm.id=jcmi.class_id
where cm.delete_flag=0
and cm.current_constr_date in(
<foreach collection="dateTimes" item="item" separator=",">
#{item}
</foreach>
)
<if test='isSup=="3"'>
and cm.build_unit_code=#{orgId}
</if>
GROUP BY cm.current_constr_date
</select>
<!--人员查询统计-->
<select id="people" resultType="com.sercurityControl.proteam.domain.vo.MapsVo">
select count(cmp.id_card) num,cm.current_constr_date AS status
from jj_class_meetting cm
left join jj_class_meeting_people cmp on cm.id=cmp.tool_box_talk_id AND cmp.position_flag = 1 AND cmp.delete_flag = 0
where cm.delete_flag=0
and cm.current_constr_date in(
<foreach collection="dateTimes" item="item" separator=",">
#{item}
</foreach>
)
<if test='isSup=="3"'>
and cm.build_unit_code=#{orgId}
</if>
GROUP BY cm.current_constr_date
</select>
<!--人员统计站班会全部人员-->
<select id="getClassPeopleNum" resultType="com.sercurityControl.proteam.domain.PersonNum" parameterType="com.sercurityControl.proteam.domain.PersonNum">
select jdc.`value` personType,count(1) personNum
from jj_class_meeting_people jcmp
left join jj_data_code jdc on IFNULL(jcmp.position_code,'0900107')=jdc.code_value AND jdc.`code`='POSITION_CODE'
left join jj_class_meetting jcm on jcm.id =jcmp.tool_box_talk_id
WHERE jcm.current_constr_date =CURRENT_DATE() AND jcmp.delete_flag = 0 AND jcm.delete_flag = 0 AND jcmp.position_flag = 1
<if test='isSup=="3"'>
and jcm.build_unit_code=#{orgId}
</if>
GROUP BY jdc.`value`
</select>
<select id="getProMaps" resultType="java.lang.Integer">
SELECT IFNULL(COUNT(distinct single_project_code),0) num
from jj_single_info jsi
WHERE jsi.delete_flag=0
<if test='status!=null and status!=""'>
and safety_project_status =#{status}
</if>
<if test='isSup=="3"'>
and build_unit_code=#{orgId}
</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="getTodayWarnNumList" resultType="java.lang.Integer">
select IFNULL(count(1),0) NUM
from jj_warn_info
where type=1 and warn_day=CURRENT_DATE
union ALL
select count(1)
from jj_warn_info
where type=2 and warn_day=CURRENT_DATE
union ALL
select count(1)
from jj_warn_info
where type=3 and warn_day=CURRENT_DATE
union ALL
select count(1)
from jj_warn_info
where type=4 and warn_day=CURRENT_DATE
union ALL
select count(1)
from jj_warn_info
where type=5 and warn_day=CURRENT_DATE
union ALL
select count(1)
from jj_warn_info
where type=6 and warn_day=CURRENT_DATE
union ALL
select count(1)
from jj_warn_info
where type=7 and warn_day=CURRENT_DATE
</select>
</mapper>