IntelligentRecognition/ah-jjsp-service/.svn/pristine/85/85b53f97f8b14b1b04d23bafff6...

720 lines
35 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.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="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,
jtp.id_card fzrNum
from jj_ticket jtt
left join jj_class_meetting jcm on jcm.ticket_id=jtt.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'
where jtt.ticket_status='05' AND jtt.delete_flag=0
and jcm.id is null
<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="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,jbp.bid_name proName,jtp.real_name fzrName,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
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.personnel_id=jtp.personnel_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_bid_project jbp on jbp.bid_no=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.bid_name LIKE CONCAT('%',#{proName},'%')
</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,jtp.real_name,ju.mobile phone,
jbp.bid_name proName ,'3' AS type ,so.city_name org
FROM jj_team jtm
left join sys_org so on so.org_id=jtm.build_unit_code
left join jj_bid_project jbp on jbp.bid_no=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.personnel_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'
<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.bid_name LIKE CONCAT('%',concat(#{proName}),'%')
</if>
</select>
<select id="getFocusWork" resultType="com.sercurityControl.proteam.domain.EarlyEntity"
parameterType="com.sercurityControl.proteam.domain.EarlyEntity">
select jcm.id classId, jtm.build_unit_code,so.city_name org,jcmi.work_content content ,jtm.bidding_section_code bidCode
,jcmi.work_manage,jcmi.work_manage_phone phone,jcmi.work_manage_num fzrNum,jtt.bidding_section_name proName,
jtm.id ,'6' AS type, IFNULL(tpb.is_hl,'') AS isHl,jtm.id teamId
from jj_team jtm
left join jj_team_info jtmi on jtm.id=jtmi.team_id
left join jj_ticket jtt on jtt.team_id=jtm.id and jtt.delete_flag=0
left join sys_org so on so.org_id=jtm.build_unit_code
left join jj_class_meetting jcm on jcm.ticket_id=jtt.id AND jcm.delete_flag=0
LEFT JOIN t_class_metting_check tcmc ON jcm.id = tcmc.class_id
left join jj_class_metting_info jcmi on jcmi.class_id=jcm.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 jtt.bidding_section_name LIKE CONCAT('%',concat(#{proName}),'%')
</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,jcmi.work_manage fzrNum,
jcmi.work_manage_phone phone,jcm.current_constr_headcount dNum,jcmi.work_content content,
'5' AS type,jcmi.team_id teamId,
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,
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 cm.org 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_manager LIKE CONCAT('%',#{fzrName},'%')
</if>
<if test="proName != null and proName != ''">
AND jcm.bidding_section_name LIKE CONCAT('%',#{proName},'%')
</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 fzrNum,
jcmi.work_manage_phone phone,jcm.current_constr_headcount dNum,jcmi.work_content content,
'5' AS type,jcmi.team_id teamId,
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,
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 cm.org 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_manager LIKE CONCAT('%',#{fzrName},'%')
</if>
<if test="proName != null and proName != ''">
AND jcm.bidding_section_name LIKE CONCAT('%',#{proName},'%')
</if>
</select>
<select id="getTeamByJob2" resultType="com.sercurityControl.proteam.domain.EarlyEntity"
parameterType="com.sercurityControl.proteam.domain.EarlyEntity">
select IFNULL(cm.class_id,'' ) AS classId,IFNULL(cm.puid,'') AS puid,IFNULL(td.t_code,'') AS tCode,
IFNULL(td.tw_code ,'')AS twCode,IFNULL(td.td_code,'') AS tdCode,IFNULL(td.pass_way,'') AS passWay, IFNULL(cm.bid_code,'') AS bidCode,
IFNULL(cw.t_zylx ,'') AS tzylx,IFNULL(cw.y_zylx ,'') AS yzylx,'6' AS type, so.org_id, IFNULL(so.city_name,'') AS org,
IFNULL(cm.bid_name ,'') AS proName,IFNULL(cm.risk_level,'') AS riskLevel,IFNULL(cm.work_manager,'') AS fzrName,
IFNULL(cm.work_manager_phone ,'') AS phone, IFNULL(cm.team_name,'') AS teamName,IFNULL(cw.warn_type,'') AS warnType,
IFNULL(cm.work_manager_num,'') AS fzrNum, IFNULL(tpb.is_hl,'') AS isHl,
tuh.id handleId, tuh.user,tuh.create_time handleTime,tuh.state handleState,tuh.remark handelRemark,
tub. scheduling_name userName,su.user_name handleUser
FROM t_class_metting cm
left join t_user_handle tuh on tuh.fzr_num=cm.class_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_org so on so.org_id=cm.org
left join t_class_metting_warn cw ON cm.class_id=cw.class_id
LEFT JOIN t_device td on td.mac_id = cm.mac_id AND td.is_flag='0'
LEFT JOIN t_class_metting_check tcmc ON cm.class_id = tcmc.class_id
left join sys_user su on tcmc.check_user=su.id
LEFT JOIN t_team_people_bj tpb ON tpb.fzr_num = cm.work_manager_num AND tpb.type='8' and DATE_FORMAT(
tpb.update_time, '%Y-%m-%d' ) = DATE_FORMAT( curdate(), '%Y-%m-%d' )
WHERE cm.del_flag=0
and cw.warn_type like '%作业类型变化%'
<if test="times!=null and times!=''">
and cm.work_day BETWEEN #{startTime} AND #{endTime}
</if>
<if test="times==null or times==''">
and cm.work_day=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 cm.org = #{currentUserOrgId}
</if>
<if test="org != null and org != ''">
AND cm.org IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="riskLevel != null and riskLevel != ''">
AND cm.risk_level IN (
<foreach collection="riskList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="fzrName != null and fzrName != ''">
AND cm.work_manager LIKE CONCAT('%',#{fzrName},'%')
</if>
<if test="proName != null and proName != ''">
AND cm.bid_name LIKE CONCAT('%',#{proName},'%')
</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,
IF(jcm.camera_id IS NULL OR jcm.camera_id = '', '未绑定球机', CASE td.state
WHEN '1' THEN '在线' WHEN '0' THEN '不在线' ELSE '不在线' END) AS isOnline, '7' 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='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_id=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','03')
AND (td.state = '0' or jcm.camera_id 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_manager LIKE CONCAT('%',#{fzrName},'%')
</if>
<if test="proName != null and proName != ''">
AND jcm.bidding_section_name LIKE CONCAT('%',#{proName},'%')
</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,jcmi.work_manage fzrNum,
jcmi.work_manage_phone phone,jcm.current_constr_headcount dNum,jcmi.work_content content,
'4' AS type,jcmi.team_id teamId,
IFNULL(tpb.is_hl,'') AS isHl,
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
<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 cm.org = #{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_manager LIKE CONCAT('%',#{fzrName},'%')
</if>
<if test="proName != null and proName != ''">
AND jcm.bidding_section_name LIKE CONCAT('%',#{proName},'%')
</if>
</select>
<select id="getNoWorkByDayNum" resultType="java.lang.Integer">
select count(1)
from jj_ticket jtt
left join jj_class_meetting jcm on jcm.ticket_id=jtt.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
<if test="isSup == 3">
AND jtt.build_unit_code = #{currentUserOrgId}
</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="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'
<if test="isSup == 3">
AND jtm.build_unit_code = #{currentUserOrgId}
</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_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
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="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="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="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_id=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','03')
AND (td.state = '0' or jcm.camera_id IS NULL) 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="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
<!--督查人员-->
<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="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
</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_id=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','03')
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_manager,#{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 org,jtt.bidding_section_code bidCode ,
jtt.id ,so.abb_name ,jtt.ticket_status,jtp.real_name fzrName,
jtp.mobile phone,jcm.id ,'9' AS type,jtt.ticket_no classId,
jtt.ticket_no ticketNo,jtt.re_assessment_risk_level riskLevel,
jtp.id_card fzrNum,
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_meetting jcm on jcm.ticket_id=jtt.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 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`
left join jj_ticket_people jtp on jtp.ticket_id=jtt.id and jtp.position_code='0900101'
where jtt.ticket_status='05' AND jtt.delete_flag=0
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>
limit 8
</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_id=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','03')
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>
</mapper>