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

727 lines
35 KiB
XML
Raw Permalink Normal View History

2025-01-16 18:13:22 +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.mapper.EarlyMapper">
<insert id="updateFzrData" parameterType="com.sercurityControl.proteam.domain.EarlyEntity">
insert into
t_team_people_bj (
<if test="fzrNum!=null and fzrNum!=''">
FZR_NUM
</if>
<if test='isHl!="" and isHl!=null'>
,IS_HL
</if>
<if test='time!="" and time!=null'>
,UPDATE_TIME
</if>
<if test='type!="" and type!=null'>
,type
</if>) values (
<if test="fzrNum!=null and fzrNum!=''">
#{fzrNum}
</if>
<if test='isHl!="" and isHl!=null'>
,#{isHl}
</if>
<if test='time!="" and time!=null'>
,#{time}
</if>
<if test='type!="" and type!=null'>
,#{type}
</if>
)
</insert>
<insert id="addUserHandel" parameterType="com.sercurityControl.proteam.domain.vo.UserHandleVo">
replace into t_user_handle (
id,fzr_num,is_hl,update_time,type,remark, user,state
<if test="createTime!=null and createTime!=''">
,create_time
</if>
)values (#{id},#{fzrNum},#{isHl},#{updateTime},#{type},#{remark},#{user},#{state}
<if test="createTime!=null and createTime!=''">
,#{createTime}
</if>
)
</insert>
<select id="getHandelNum" resultType="Integer" parameterType="com.sercurityControl.proteam.domain.vo.UserHandleVo">
select count(1)
from t_user_handle
where fzr_num=#{fzrNum} and type=#{type}
<if test="id!=null and id!=''">
and id!=#{id}
</if>
</select>
<!--当日未施工-->
<select id="getNoWorkByDayNum" resultType="java.lang.Integer">
select count(1)
from jj_ticket jtt
LEFT JOIN jj_class_metting_info jcmi on jcmi.team_id=jtt.team_id and jcmi.work_day=CURRENT_DATE()
left join jj_class_meetting jcm on jcm.id=jcmi.class_id and jcm.current_constr_date=CURRENT_DATE() AND jcm.delete_flag=0
left join sys_org so on so.org_id=jtt.build_unit_code
where jtt.ticket_status='05' AND jtt.delete_flag=0
and jcm.id is null and DATE_FORMAT(curdate(), '%Y-%m-%d') BETWEEN jtt.planned_start_date and jtt.planned_end_date
<if test="isSup == 3">
AND jtt.build_unit_code = #{currentUserOrgId}
</if>
</select>
<!--当日未施工列表-->
<select id="getNoWorkByDay" resultType="com.sercurityControl.proteam.domain.EarlyEntity"
parameterType="com.sercurityControl.proteam.domain.EarlyEntity">
select jtt.working_team_name teamName,jtt.single_project_name proName,jtt.build_unit_code orgId,
jtt.bidding_section_code bidCode ,
jtt.id ,so.abb_name org ,jtt.ticket_status,jtp.real_name fzrName,jtp.mobile phone,jcm.id classId ,'1' AS type,
jtt.ticket_no ticketNo,jtt.planned_start_date planStartTime,jtt.planned_end_date planEndTime,
jtp.id_card fzrNum
from jj_ticket jtt
LEFT JOIN jj_class_metting_info jcmi on jcmi.team_id=jtt.team_id and jcmi.work_day=CURRENT_DATE()
left join jj_class_meetting jcm on jcm.id=jcmi.class_id and jcm.current_constr_date=CURRENT_DATE() AND jcm.delete_flag=0
left join sys_org so on so.org_id=jtt.build_unit_code
left join jj_ticket_people jtp on jtp.ticket_id=jtt.id and jtp.position_code='0900101' and jtp.position_flag='1'
where jtt.ticket_status='05' AND jtt.delete_flag=0
and jcm.id is null and DATE_FORMAT(curdate(),'%Y-%m-%d') BETWEEN jtt.planned_start_date and jtt.planned_end_date
<if test="org!= null and org!= ''">
AND so.org_id IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="fzrName!= null and fzrName!= ''">
AND jtp.real_name LIKE CONCAT('%',#{fzrName},'%')
</if>
<if test="proName!= null and proName!= ''">
AND jtt.single_project_name LIKE CONCAT('%',#{proName},'%')
</if>
</select>
<!--新进班组-->
<select id="getNewTeamNum" resultType="java.lang.Integer">
select count(1)
from jj_team jtm
where DATE_FORMAT(jtm.create_time,'%Y-%m-%d')=CURRENT_DATE() AND jtm.team_status='01'
and jtm.delete_flag=0
<if test="isSup == 3">
AND jtm.build_unit_code = #{currentUserOrgId}
</if>
</select>
<!--新进班组列表集合-->
<select id="getNewTeam" resultType="com.sercurityControl.proteam.domain.EarlyEntity"
parameterType="com.sercurityControl.proteam.domain.EarlyEntity">
select jtm.id ,constr_unit_id,jtm.build_unit_code,working_team_name teamName,so.city_name org ,
working_team_attribute,IFNULL(jbp.BIDDING_SECTION_NAME,'') proName,IFNULL(jtp.real_name,'') fzrName,
ifnull(jur.mobile,'') phone,jtp.id_card fzrNum,
jtm.working_team_type,DATE_FORMAT(jtm.create_time,'%Y-%m-%d') createDay,
'2' AS type, IFNULL(tpb.is_hl,'') AS isHl,ju.unit_name sgdw
from jj_team jtm
left join jj_team_people jtp on jtp.team_id=jtm.id and jtp.position_code='0900101'
LEFT JOIN jj_user jur on jur.id=jtp.personnel_id
left join jj_unit ju on ju.unified_social_credit_id=jtm.constr_unit_id
left join sys_org so on so.org_id=jtm.build_unit_code
LEFT JOIN t_team_people_bj tpb ON tpb.fzr_num = jtm.id AND tpb.type='1' and DATE_FORMAT( tpb.update_time,
'%Y-%m-%d' ) = DATE_FORMAT( curdate(), '%Y-%m-%d' )
left join jj_bidding_project jbp on jbp.bidding_section_code=jtm.bidding_section_code
where DATE_FORMAT(jtm.create_time,'%Y-%m-%d')=CURRENT_DATE() AND jtm.team_status='01'
and jtm.delete_flag=0
<if test="org != null and org != ''">
AND so.org_id IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="fzrName!= null and fzrName!= ''">
AND jtp.real_name LIKE CONCAT('%',#{fzrName},'%')
</if>
<if test="proName!= null and proName != ''">
AND jbp.BIDDING_SECTION_NAME LIKE CONCAT('%',#{proName},'%')
</if>
</select>
<!--七日未施工班组-->
<select id="getNoWorkBySevenNum" resultType="java.lang.Integer">
select COUNT(1)
FROM jj_team jtm
left join jj_ticket jtt on jtt.team_id=jtm.id and jtt.delete_flag=0
left join jj_class_meetting jcm on jcm.ticket_id=jtt.id
and jcm.delete_flag=0 and jcm.current_constr_date>=(CURDATE() - INTERVAL 6 DAY)
WHERE jcm.id is null and jtm.delete_flag=0 and jtm.team_status='01'
and DATE_FORMAT(jtm.create_time, '%Y-%m-%d') BETWEEN (CURDATE() - INTERVAL 7 DAY) and CURDATE()
<if test="isSup == 3">
AND jtm.build_unit_code = #{currentUserOrgId}
</if>
</select>
<!--七日未施工列表-->
<select id="getNoWorkBySeven" resultType="com.sercurityControl.proteam.domain.EarlyEntity"
parameterType="com.sercurityControl.proteam.domain.EarlyEntity">
select DISTINCT jtm.id ,jtm.working_team_name teamName,jtm.build_unit_code,jtp.id_card fzrNum,
IFNULL(jtp.real_name,'') fzrName,IFNULL(ju.mobile,'') phone,
IFNULL(jbp.BIDDING_SECTION_NAME,'') proName,'3' AS type ,so.city_name org,jtm.create_time createDay,
jtt.assessment_risk_level riskLevel
FROM jj_team jtm
left join sys_org so on so.org_id=jtm.build_unit_code
left join jj_bidding_project jbp on jbp.bidding_section_code=jtm.bidding_section_code
left join jj_team_people jtp on jtp.team_id=jtm.id and jtp.position_code='0900101'
LEFT JOIN jj_user ju on ju.id=jtp.personnel_id
left join jj_ticket jtt on jtt.team_id=jtm.id and jtt.delete_flag=0
LEFT JOIN t_team_people_bj tpb ON tpb.fzr_num = jtm.id AND tpb.type='2' and DATE_FORMAT(tpb.update_time,
'%Y-%m-%d' ) = DATE_FORMAT(curdate(), '%Y-%m-%d' )
left join jj_class_meetting jcm on jcm.ticket_id=jtt.id
and jcm.delete_flag=0 and jcm.current_constr_date>=(CURDATE() - INTERVAL 6 DAY)
WHERE jcm.id is null and jtm.delete_flag=0 and jtm.team_status='01'
and DATE_FORMAT(jtm.create_time, '%Y-%m-%d') BETWEEN (CURDATE() - INTERVAL 7 DAY) and CURDATE()
<if test="isSup == 3">
AND jtm.build_unit_code = #{currentUserOrgId}
</if>
<if test="org != null and org != ''">
AND jtm.build_unit_code IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="fzrName != null and fzrName != ''">
AND jtp.real_name LIKE CONCAT('%',concat(#{fzrName}),'%')
</if>
<if test="proName != null and proName != ''">
AND jbp.BIDDING_SECTION_NAME LIKE CONCAT('%',concat(#{proName}),'%')
</if>
</select>
<!--重点关注班组-->
<select id="getFocusWorkNum" resultType="java.lang.Integer">
select COUNT(1)
from jj_team jtm
left join jj_team_info jtmi on jtm.id=jtmi.team_id
left join jj_class_metting_info jcmi on jcmi.team_id=jtm.id
left join jj_class_meetting jcm on jcm.id=jcmi.class_id
LEFT JOIN t_class_metting_check tcmc ON jcm.id = tcmc.class_id
where jtmi.import_team='1' and jcm.current_constr_date=CURRENT_DATE()
<if test="isSup == 1">
AND (tcmc.quality_user = 'AU' OR tcmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND tcmc.check_user = #{currentUserId}
</if>
<if test="isSup == 3">
AND jtm.build_unit_code = #{currentUserOrgId}
</if>
</select>
<!--重点关注班组集合-->
<select id="getFocusWork" resultType="com.sercurityControl.proteam.domain.EarlyEntity"
parameterType="com.sercurityControl.proteam.domain.EarlyEntity">
select jtm.working_team_name teamName,jcm.id classId, jtm.build_unit_code,so.city_name org,jcmi.work_content content ,jtm.bidding_section_code bidCode
,jcmi.work_manage fzrName,jcmi.work_manage_phone phone,jcmi.work_manage_num fzrNum,jcm.bidding_section_name proName,
jtm.id ,'6' AS type, IFNULL(tpb.is_hl,'') AS isHl,jtm.id teamId,
jcm.work_start_time startTime,jcm.current_constr_headcount userNum,
CASE jcm.current_construction_status WHEN '01' THEN '开工'
WHEN '02' THEN '暂停'
WHEN '03' THEN '完工'
END AS state,
IFNULL(jcm.re_assessment_risk_level,'') AS riskLevel
from jj_team jtm
left join jj_team_info jtmi on jtm.id=jtmi.team_id
left join jj_class_metting_info jcmi on jcmi.team_id=jtm.id
left join jj_class_meetting jcm on jcm.id=jcmi.class_id
left join sys_org so on so.org_id=jtm.build_unit_code
LEFT JOIN t_class_metting_check tcmc ON jcm.id = tcmc.class_id
LEFT JOIN t_team_people_bj tpb ON tpb.fzr_num = jtm.id AND tpb.type='5' and DATE_FORMAT(tpb.update_time,
'%Y-%m-%d') = DATE_FORMAT( curdate(), '%Y-%m-%d' )
where jtmi.import_team='1' and jcm.current_constr_date=CURRENT_DATE()
<if test="isSup == 2">
AND tcmc.check_user = #{currentUserId}
</if>
<if test="isSup == 1">
AND (tcmc.quality_user = 'AU' OR tcmc.quality_user IS NULL)
</if>
<if test="isSup == 3">
AND jtm.build_unit_code = #{currentUserOrgId}
</if>
<if test="org != null and org != ''">
AND so.org_id IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="fzrName != null and fzrName != ''">
AND jcmi.work_manage LIKE CONCAT('%',#{fzrName},'%')
</if>
<if test="proName != null and proName != ''">
AND jcm.bidding_section_name LIKE CONCAT('%',concat(#{proName}),'%')
</if>
</select>
<!--工序变化-->
<select id="getTeamByWorkNum" resultType="java.lang.Integer">
SELECT count(1)
FROM jj_class_meetting jcm
LEFT JOIN t_class_metting_check tcmc ON tcmc.class_id = jcm.id
left join sys_user su on tcmc.check_user=su.id
left join t_class_metting_warn cmw on cmw.class_id=jcm.id
WHERE cmw.warn_type like '%工序变化%' AND jcm.delete_flag=0
and jcm.current_constr_date=CURRENT_DATE()
<!--督查人员-->
<if test="isSup == 1">
AND (tcmc.quality_user = 'AU' OR tcmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND tcmc.check_user=#{currentUserId}
</if>
<if test="isSup == 3">
AND jcm.build_unit_code = #{currentUserOrgId}
</if>
</select>
<!--工序变化列表-->
<select id="getTeamByWork" resultType="com.sercurityControl.proteam.domain.EarlyEntity"
parameterType="com.sercurityControl.proteam.domain.EarlyEntity">
SELECT jcm.id classId,so.city_name org , jcm.bidding_section_code bidCode,
jcm.bidding_section_name proName,jcm.re_assessment_risk_level riskLevel,IFNULL(jcmi.work_manage,'') fzrName,
IFNULL(jcmi.work_manage_num,'') fzrNum,
jcmi.work_manage_phone phone,jcm.current_constr_headcount dNum,jcmi.work_content content,
'5' AS type,jcmi.team_id teamId,jcmi.team_name teamName,
IFNULL(cmw.t_gx,'') AS tgx,
IFNULL(cmw.y_gx,'') AS ygx,IFNULL(cmw.t_zylx ,'') AS tzylx, IFNULL(cmw.y_zylx ,'') AS yzylx,
IFNULL(tpb.is_hl,'') AS isHl,
IFNULL(jcm.re_assessment_risk_level,'') AS riskLevel,
tuh.id handleId, tuh.user,tuh.create_time handleTime,tuh.state handleState,tuh.remark handelRemark,
tub. scheduling_name userName,su.user_name handleUser
FROM jj_class_meetting jcm
LEFT JOIN t_class_metting_check tcmc ON tcmc.class_id = jcm.id
left join t_user_handle tuh on tuh.fzr_num=jcm.id and tuh.type='4'
left join tb_user_banding tub on tuh.user=tub.login_user_id and tub.banding_date=CURRENT_DATE()
left join sys_user su on tcmc.check_user=su.id
left join jj_class_metting_info jcmi ON jcmi.class_id=jcm.id
left join t_class_metting_warn cmw on cmw.class_id=jcm.id
left join sys_org so on so.org_id=jcm.build_unit_code
LEFT JOIN t_team_people_bj tpb ON tpb.fzr_num = jcm.id AND tpb.type='4' and DATE_FORMAT(
tpb.update_time, '%Y-%m-%d' ) = DATE_FORMAT( curdate(), '%Y-%m-%d' )
WHERE cmw.warn_type like '%工序变化%' AND jcm.delete_flag=0
<if test="times!=null and times!=''">
and jcm.current_constr_date BETWEEN #{startTime} AND #{endTime}
</if>
<if test="times==null or times==''">
and jcm.current_constr_date=CURRENT_DATE()
</if>
<if test="isSup == 1">
AND (tcmc.quality_user = 'AU' OR tcmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND tcmc.check_user = #{currentUserId}
</if>
<if test="isSup == 3">
AND jcm.build_unit_code = #{currentUserOrgId}
</if>
<if test="org != null and org != ''">
AND jcm.build_unit_code IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="riskLevel != null and riskLevel != ''">
AND jcm.re_assessment_risk_level IN (
<foreach collection="riskList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="fzrName != null and fzrName != ''">
AND jcmi.work_manage LIKE CONCAT('%',#{fzrName},'%')
</if>
<if test="proName != null and proName != ''">
AND jcm.bidding_section_name LIKE CONCAT('%',#{proName},'%')
</if>
</select>
<!--作业类型变化-->
<select id="getTeamByJobNum" resultType="java.lang.Integer">
SELECT count(1)
FROM jj_class_meetting jcm
LEFT JOIN t_class_metting_check tcmc ON tcmc.class_id = jcm.id
left join sys_user su on tcmc.check_user=su.id
left join t_class_metting_warn cmw on cmw.class_id=jcm.id
WHERE cmw.warn_type like '%作业类型变化%' AND jcm.delete_flag=0
and jcm.current_constr_date=CURRENT_DATE()
<!--督查人员-->
<if test="isSup == 1">
AND (tcmc.quality_user = 'AU' OR tcmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND tcmc.check_user=#{currentUserId}
</if>
<if test="isSup == 3">
AND jcm.build_unit_code = #{currentUserOrgId}
</if>
</select>
<!--作业类型变化-->
<select id="getTeamByJob" resultType="com.sercurityControl.proteam.domain.EarlyEntity"
parameterType="com.sercurityControl.proteam.domain.EarlyEntity">
SELECT jcm.id classId,so.city_name org , jcm.bidding_section_code bidCode,
jcm.bidding_section_name proName,jcm.re_assessment_risk_level riskLevel,
jcmi.work_manage_phone phone,jcm.current_constr_headcount dNum,jcmi.work_content content,
IFNULL(jcmi.work_manage,'') fzrName, IFNULL(jcmi.work_manage_num,'') fzrNum,
'6' AS type,jcmi.team_id teamId,jcmi.team_name teamName,
IFNULL(cmw.t_gx,'') AS tgx,
IFNULL(cmw.y_gx,'') AS ygx,IFNULL(cmw.t_zylx ,'') AS tzylx, IFNULL(cmw.y_zylx ,'') AS yzylx,
IFNULL(tpb.is_hl,'') AS isHl,
IFNULL(jcm.re_assessment_risk_level,'') AS riskLevel,
tuh.id handleId, tuh.user,tuh.create_time handleTime,tuh.state handleState,tuh.remark handelRemark,
tub. scheduling_name userName,su.user_name handleUser
FROM jj_class_meetting jcm
LEFT JOIN t_class_metting_check tcmc ON tcmc.class_id = jcm.id
left join t_user_handle tuh on tuh.fzr_num=jcm.id and tuh.type='5'
left join tb_user_banding tub on tuh.user=tub.login_user_id and tub.banding_date=CURRENT_DATE()
left join sys_user su on tcmc.check_user=su.id
left join jj_class_metting_info jcmi ON jcmi.class_id=jcm.id
left join t_class_metting_warn cmw on cmw.class_id=jcm.id
left join sys_org so on so.org_id=jcm.build_unit_code
LEFT JOIN t_team_people_bj tpb ON tpb.fzr_num = jcm.id AND tpb.type='8' and DATE_FORMAT(
tpb.update_time, '%Y-%m-%d' ) = DATE_FORMAT( curdate(), '%Y-%m-%d' )
WHERE cmw.warn_type like '%作业类型变化%' AND jcm.delete_flag=0
<if test="times!=null and times!=''">
and jcm.current_constr_date BETWEEN #{startTime} AND #{endTime}
</if>
<if test="times==null or times==''">
and jcm.current_constr_date=CURRENT_DATE()
</if>
<if test="isSup == 1">
AND (tcmc.quality_user = 'AU' OR tcmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND tcmc.check_user = #{currentUserId}
</if>
<if test="isSup == 3">
AND jcm.build_unit_code = #{currentUserOrgId}
</if>
<if test="org != null and org != ''">
AND jcm.build_unit_code IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="riskLevel != null and riskLevel != ''">
AND jcm.re_assessment_risk_level IN (
<foreach collection="riskList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="fzrName != null and fzrName != ''">
AND jcmi.work_manage LIKE CONCAT('%',#{fzrName},'%')
</if>
<if test="proName != null and proName != ''">
AND jcm.bidding_section_name LIKE CONCAT('%',#{proName},'%')
</if>
</select>
<!--球机异常-->
<select id="getBallByUnusualNum" resultType="java.lang.Integer">
select COUNT(1)
from jj_class_meetting jcm
left join t_class_metting_check tcmc on tcmc.class_id=jcm.id
left join jj_ball jbl on jcm.camera_id2=jbl.id and jbl.delete_flag=0
left join t_device td on td.t_code=jbl.camera_no and td.is_flag=0
left join jj_ball jbl2 on jcm.camera_id3=jbl2.id and jbl2.delete_flag=0
left join t_device td2 on td2.t_code=jbl2.camera_no and td2.is_flag=0
where jcm.delete_flag=0 and jcm.current_construction_status in('01')
AND (td.state = '0' or jcm.camera_id2 IS NULL) and jcm.current_constr_date=CURRENT_DATE()
AND (td2.state = '0' or jcm.camera_id3 IS NULL)
<if test="isSup == 1">
AND (tcmc.quality_user = 'AU' OR tcmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND tcmc.check_user = #{currentUserId}
</if>
<if test="isSup == 3">
AND jcm.build_unit_code = #{currentUserOrgId}
</if>
</select>
<!--球机异常-->
<select id="getBallByUnusual" resultType="com.sercurityControl.proteam.domain.EarlyEntity"
parameterType="com.sercurityControl.proteam.domain.EarlyEntity">
select jcm.id classId, jcm.build_unit_code ,so.city_name org,jcm.bidding_section_code bidCode,jcm.bidding_section_name proName ,
IFNULL(jcmi.work_content,'') AS content,
IFNULL(jcmi.work_manage,'') AS fzrName,
IFNULL(jcmi.work_manage_phone,'') AS phone,
jcmi.team_name teamName,
IF((jcm.camera_id2 IS NULL OR jcm.camera_id2 = '') and (jcm.camera_id3 IS NULL OR jcm.camera_id3 = '' ), '未绑定球机',
CASE td.state
WHEN '1' THEN '在线' WHEN '0' THEN '不在线' ELSE '不在线' END) AS isOnline, '7' AS type,
IFNULL(jcm.re_assessment_risk_level,'') AS riskLevel,
jcm.work_start_time startTime,jcm.current_constr_headcount userNum,
tuh.id handleId, tuh.user,tuh.create_time handleTime,tuh.state handleState,tuh.remark handelRemark,
tub. scheduling_name userName,su.user_name handleUser
from jj_class_meetting jcm
left join t_user_handle tuh on tuh.fzr_num=jcm.id and tuh.type='7'
left join tb_user_banding tub on tuh.user=tub.login_user_id and tub.banding_date=CURRENT_DATE()
left JOIN sys_org so on so.org_id=jcm.build_unit_code
left join t_class_metting_check tcmc on tcmc.class_id=jcm.id
left join sys_user su on tcmc.check_user=su.id
left join jj_class_metting_info jcmi ON jcm.id=jcmi.class_id
left join jj_ball jbl on jcm.camera_id2=jbl.id and jbl.delete_flag=0
left join t_device td on td.t_code=jbl.camera_no and td.is_flag=0
left join jj_ball jbl2 on jcm.camera_id3=jbl2.id and jbl2.delete_flag=0
left join t_device td2 on td2.t_code=jbl2.camera_no and td2.is_flag=0
where jcm.delete_flag=0 and jcm.current_construction_status in('01')
AND (td.state = '0' or jcm.camera_id2 IS NULL)
AND (td2.state = '0' or jcm.camera_id3 IS NULL)
<if test="times!=null and times!=''">
and jcm.current_constr_date BETWEEN #{startTime} AND #{endTime}
</if>
<if test="times==null or times==''">
and jcm.current_constr_date=CURRENT_DATE()
</if>
<if test="isSup == 1">
AND (tcmc.quality_user = 'AU' OR tcmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND tcmc.check_user = #{currentUserId}
</if>
<if test="isSup == 3">
AND jcm.build_unit_code = #{currentUserOrgId}
</if>
<if test="org != null and org != ''">
AND jcm.build_unit_code IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="riskLevel != null and riskLevel != ''">
AND jcm.re_assessment_risk_level IN (
<foreach collection="riskList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="fzrName != null and fzrName != ''">
AND jcmi.work_manage LIKE CONCAT('%',#{fzrName},'%')
</if>
<if test="proName != null and proName != ''">
AND jcm.bidding_section_name LIKE CONCAT('%',#{proName},'%')
</if>
</select>
<!--人数变化大-->
<select id="getTeamByPerNum" resultType="java.lang.Integer">
SELECT count(1)
FROM jj_class_meetting jcm
LEFT JOIN t_class_metting_check tcmc ON tcmc.class_id = jcm.id
left join sys_user su on tcmc.check_user=su.id
left join t_class_metting_warn cmw on cmw.class_id=jcm.id
WHERE cmw.warn_type like '%人数变化大%' AND jcm.delete_flag=0 AND jcm.current_constr_date=CURRENT_DATE()
<!--督查人员-->
<if test="isSup == 1">
AND (tcmc.quality_user = 'AU' OR tcmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND tcmc.check_user=#{currentUserId}
</if>
<if test="isSup == 3">
AND jcm.build_unit_code = #{currentUserOrgId}
</if>
</select>
<!--人数变化大 列表-->
<select id="getTeamByPer" resultType="com.sercurityControl.proteam.domain.EarlyEntity">
SELECT jcm.id classId,so.city_name org , jcm.bidding_section_code bidCode,
jcm.bidding_section_name proName,jcm.re_assessment_risk_level riskLevel,
IFNULL(jcmi.work_manage,'') fzrName,
IFNULL(jcmi.work_manage_num,'') fzrNum,
jcmi.work_manage_phone phone,jcm.current_constr_headcount dNum,jcmi.work_content content,
'4' AS type,jcmi.team_id teamId,jcmi.team_name teamName,
IFNULL(tpb.is_hl,'') AS isHl,
IFNULL(jcm.re_assessment_risk_level,'') AS riskLevel,
tuh.id handleId, tuh.user,tuh.create_time handleTime,tuh.state handleState,tuh.remark handelRemark,
tub. scheduling_name userName,su.user_name handleUser
FROM jj_class_meetting jcm
LEFT JOIN t_class_metting_check tcmc ON tcmc.class_id = jcm.id
left join t_user_handle tuh on tuh.fzr_num=jcm.id and tuh.type='3'
left join tb_user_banding tub on tuh.user=tub.login_user_id and tub.banding_date=CURRENT_DATE()
left join sys_user su on tcmc.check_user=su.id
left join jj_class_metting_info jcmi ON jcmi.class_id=jcm.id
left join t_class_metting_warn cmw on cmw.class_id=jcm.id
left join sys_org so on so.org_id=jcm.build_unit_code
LEFT JOIN t_team_people_bj tpb ON tpb.fzr_num = jcm.id AND tpb.type='3' and DATE_FORMAT(
tpb.update_time, '%Y-%m-%d' ) = DATE_FORMAT( curdate(), '%Y-%m-%d' )
WHERE cmw.warn_type like '%人数变化大%' AND jcm.delete_flag=0
AND jcm.current_constr_date=CURRENT_DATE()
<if test="times!=null and times!=''">
and jcm.current_constr_date BETWEEN #{startTime} AND #{endTime}
</if>
<if test="times==null or times==''">
and jcm.current_constr_date=CURRENT_DATE()
</if>
<if test="isSup == 1">
AND (tcmc.quality_user = 'AU' OR tcmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND tcmc.check_user = #{currentUserId}
</if>
<if test="isSup == 3">
AND jcm.build_unit_code = #{currentUserOrgId}
</if>
<if test="org != null and org != ''">
AND so.org_id IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="riskLevel != null and riskLevel != ''">
AND jcm.re_assessment_risk_level IN (
<foreach collection="riskList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="fzrName != null and fzrName != ''">
AND jcmi.work_manage LIKE CONCAT('%',#{fzrName},'%')
</if>
<if test="proName != null and proName != ''">
AND jcm.bidding_section_name LIKE CONCAT('%',#{proName},'%')
</if>
</select>
<!--查询 昨日施工人数-->
<select id="getWorkTeamPeopleNum" resultType="java.util.Map">
select IFNULL(jcm.current_constr_headcount,0) num
FROM jj_class_meetting jcm
left join jj_class_metting_info jcmi ON jcm.id=jcmi.class_id
WHERE jcm.current_constr_date = (curdate() - INTERVAL 1 DAY)
and jcm.delete_flag=0 and jcmi.work_manage_num=#{workManagerNum}
order by jcm.work_start_time desc
limit 1
</select>
<!--球机信号-->
<select id="getBallSignal" resultType="com.sercurityControl.proteam.domain.EarlyEntity">
select jcm.id classId, jcm.build_unit_code ,so.city_name org,jcm.bidding_section_code bidCode,jcm.bidding_section_name proName ,
IFNULL(jcmi.work_content,'') AS content,
IFNULL(jcmi.work_manage,'') AS fzrName,
IFNULL(jcmi.work_manage_phone,'') AS phone,
IF(jcm.camera_id IS NULL OR jcm.camera_id = '', '未绑定球机', CASE td.state
WHEN '1' THEN '在线' WHEN '0' THEN '不在线' ELSE '不在线' END) AS isOnline, '8' AS type,
IFNULL(jcm.re_assessment_risk_level,'') AS riskLevel,
tuh.id handleId, tuh.user,tuh.create_time handleTime,tuh.state handleState,tuh.remark handelRemark,
tub. scheduling_name userName,su.user_name handleUser
from jj_class_meetting jcm
left join t_user_handle tuh on tuh.fzr_num=jcm.id and tuh.type='8'
left join tb_user_banding tub on tuh.user=tub.login_user_id and tub.banding_date=CURRENT_DATE()
left JOIN sys_org so on so.org_id=jcm.build_unit_code
left join t_class_metting_check tcmc on tcmc.class_id=jcm.id
left join sys_user su on tcmc.check_user=su.id
left join jj_class_metting_info jcmi ON jcm.id=jcmi.class_id
left join jj_ball jbl on jcm.camera_id2=jbl.id and jbl.delete_flag=0
left join t_device td on td.t_code=jbl.camera_no and td.is_flag=0
where jcm.delete_flag=0 and jcm.current_construction_status in('01')
AND td.state = '1' AND (td.qj_xh IS NOT NULL OR
td.qj_xh !='') AND td.qj_xh &lt;= 30
<if test="times!=null and times!=''">
and jcm.current_constr_date BETWEEN #{startTime} AND #{endTime}
</if>
<if test="times==null or times==''">
and jcm.current_constr_date=CURRENT_DATE()
</if>
<if test="isSup == 1">
AND (tcmc.quality_user = 'AU' OR tcmc.quality_user IS NULL)
</if>
<!--督查人员-->
<if test="isSup == 2">
AND tcmc.check_user=#{currentUserId}
</if>
<if test="isSup == 3">
AND jcm.build_unit_code = #{currentUserOrgId}
</if>
<if test="org != null and org != ''">
AND so.org_id IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="proName != null and proName != ''">
AND INSTR(jcm.bidding_section_name,#{proName}) > 0
</if>
<if test="fzrName != null and fzrName != ''">
AND INSTR(jcmi.work_manage,#{fzrName}) > 0
</if>
</select>
<select id="getTickeList" resultType="com.sercurityControl.proteam.domain.EarlyEntity">
select jtt.working_team_name teamName,jtt.single_project_name proName,jtt.build_unit_code orgId,
jtt.bidding_section_code bidCode ,jtt.re_assessment_risk_level riskLevel,
jtt.id ,so.abb_name org ,jtt.ticket_status,jtp.real_name fzrName,jtp.mobile phone,jcm.id classId ,'9' AS type,
jtt.ticket_no ticketNo,jtt.planned_start_date planStartTime,jtt.planned_end_date planEndTime,
jtp.id_card fzrNum,jtt.team_id teamId,
tuh.id handleId,tuh.user,tuh.create_time handleTime,tuh.state handleState,tuh.remark handelRemark,
tub. scheduling_name userName,su.user_name handleUser
from jj_ticket jtt
LEFT JOIN jj_class_metting_info jcmi on jcmi.team_id=jtt.team_id and jcmi.work_day=CURRENT_DATE()
left join jj_class_meetting jcm on jcm.id=jcmi.class_id and jcm.current_constr_date=CURRENT_DATE() AND jcm.delete_flag=0
left join sys_org so on so.org_id=jtt.build_unit_code
left join jj_ticket_people jtp on jtp.ticket_id=jtt.id and jtp.position_code='0900101' and jtp.position_flag='1'
LEFT JOIN t_user_handle tuh on tuh.fzr_num=jtt.ticket_no and tuh.type='9'
LEFT join tb_user_banding tub on tuh.user=tub.login_user_id and tub.banding_date=CURRENT_DATE()
left join sys_user su on su.id=tuh.`user`
where jtt.ticket_status='05' AND jtt.delete_flag=0 and DATE_FORMAT(curdate(), '%Y-%m-%d') BETWEEN jtt.planned_start_date and jtt.planned_end_date
and jcm.id is null
<if test='type=="1"'>
order by jtt.bidding_section_code ASC
</if>
<if test='type=="2"'>
order by jtt.ticket_no ASC
</if>
<if test='type=="3"'>
order by jtt.single_project_name ASC
</if>
<if test='type=="4"'>
order by jtp.real_name ASC
</if>
<if test='type=="5"'>
order by jtt.re_assessment_risk_level ASC
</if>
<if test='type=="6"'>
order by jtt.build_unit_code desc
</if>
</select>
<!--球机信号弱-数量-->
<select id="getBallSignalNum" resultType="java.lang.Integer">
select COUNT(1)
from jj_class_meetting jcm
left join t_class_metting_check tcmc on tcmc.class_id=jcm.id
left join jj_ball jbl on jcm.camera_id2=jbl.id and jbl.delete_flag=0
left join t_device td on td.t_code=jbl.camera_no and td.is_flag=0
where jcm.delete_flag=0 and jcm.current_construction_status in('01')
AND td.state = '1' AND (td.qj_xh IS NOT NULL OR
td.qj_xh !='') AND td.qj_xh &lt;= 30 and jcm.current_constr_date=CURRENT_DATE()
<if test="isSup == 1">
AND (tcmc.quality_user = 'AU' OR tcmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND tcmc.check_user=#{currentUserId}
</if>
<if test="isSup == 3">
AND jcm.build_unit_code = #{currentUserOrgId}
</if>
</select>
<select id="getTicketContent" resultType="com.sercurityControl.proteam.domain.EarlyEntity">
select DISTINCT jsp.work_content content,jsp.work_site_name workSite,
jsp.work_procedure workType
from jj_weeks_plan jwp
left join jj_risk_precaution jsp on jsp.id=jwp.risk_precaution_id
where ticket_id like concat('%',concat(#{id},'%'))
and jwp.delete_flag=0 and jsp.delete_flag=0
</select>
</mapper>