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

205 lines
8.6 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.NewDutyMapper">
<select id="getPageList" resultType="com.sercurityControl.proteam.domain.vo.NewDutyVo">
select jcm.id classId,jcm.current_construction_status workDay,cmw.warn_type warnInfo,
jcmi.work_manage bzzName,jcmi.work_manage_phone bzzPhone,jcm.ticket_no ticketNo,cmc.is_pj isPj,
jcm.bidding_section_name bidName,jcm.bidding_section_code bidCode,cmc.is_check isXs,
jcm.current_constr_headcount sgnum,jcm.build_unit_code org,so.city_name orgName,jbl.camera_no tCode ,
CASE jcm.current_construction_status
WHEN '01' THEN '开工'
WHEN '02' THEN '暂停'
WHEN '03' THEN '完工'
WHEN '04' THEN '完工' END AS sgStatus,
jcmi.work_manage_num bzzNum,jcm.re_assessment_risk_level riskLevel,
td.mac_id macId,td.puid,td.state ballStatus,
jcmi.team_name teamName,jcmi.team_id teamId,
jcm.prj_name proName,
ju.unit_name sgdw, -- 施工单位
jcm.supervision_unit_name jldw, -- 监理单位,
jcm.single_project_type AS proType,
ju.id AS unitId
from jj_class_meetting jcm
LEFT join jj_class_metting_info jcmi on jcmi.class_id= jcm.id
left join sys_org so on so.org_id=jcm.build_unit_code
left join t_class_metting_check cmc on cmc.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 and td.is_flag=0
left join jj_unit ju on ju.unified_social_credit_id=jcm.constr_unified_social_credit_id -- and ju.unit_type=6 -- 施工单位
left join t_class_metting_warn cmw on cmw.class_id=jcm.id
WHERE jcm.delete_flag=0
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
and jcm.current_constr_date BETWEEN #{startTime} AND #{endTime}
</if>
<if test="isSup == 1">
AND (cmc.quality_user = 'AU' OR cmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND cmc.check_user = #{currentUserId}
</if>
<if test="riskLevel!=null and riskLevel!=''">
AND jcm.re_assessment_risk_level IN (
<foreach collection="riskLevelList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="isSup == 3">
AND jcm.build_unit_code = #{currentUserOrgId}
</if>
<if test="sgs!=null and sgs!=''">
AND jcm.current_construction_status IN (
<foreach collection="sgs" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="orgIds!=null and orgIds!=''">
AND jcm.build_unit_code IN (
<foreach collection="orgIds" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="keyWord!=null and keyWord!=''">
AND (
INSTR(cmw.warn_type,#{keyWord}) > 0 OR
INSTR(jcm.bidding_section_code,#{keyWord}) > 0 OR
INSTR(jcm.bidding_section_name,#{keyWord}) > 0 OR
INSTR(jt.team_name,#{keyWord}) > 0 OR
INSTR(td.td_code,#{keyWord}) > 0 OR
INSTR(td.mac_id,#{keyWord}) > 0 OR
INSTR(td.td_code,#{keyWord}) > 0 OR
INSTR(jcm.ticket_no,#{keyWord}) > 0 OR
INSTR(jcm.re_assessment_risk_level,#{keyWord}) > 0 OR
INSTR(jcmi.work_content,#{keyWord}) > 0 OR
INSTR(jcmi.work_manage_phone,#{keyWord}) > 0 OR
INSTR(so.city_name,#{keyWord}) > 0 OR
INSTR(jcmi.work_manage,#{keyWord}) > 0
)
</if>
ORDER BY jcm.re_assessment_risk_level asc , jcm.create_time DESC
</select>
<select id="getAllTask" resultType="java.lang.Integer">
select count(distinct cm.id)
from jj_class_meetting cm
left join t_class_metting_check cmc on cmc.class_id=cm.id
LEFT join sys_user su on su.id=cmc.check_user
where cm.delete_flag=0
<if test="workDay!=null and workDay!=''">
and cm.current_constr_date=current_date()
</if>
<if test="isSup == 1">
AND (cmc.quality_user = 'AU' OR cmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND cmc.check_user = #{currentUserId}
</if>
<if test="isSup == 3">
AND cm.build_unit_code = #{currentUserOrgId}
</if>
<if test="sgStatus!=null and sgStatus!=''">
AND cm.current_construction_status=#{sgStatus}
</if>
<if test="isXs!=null and isXs!=''">
AND cmc.is_check=#{isXs}
</if>
</select>
<select id="getHsNum" resultType="java.lang.Integer">
select IFNULL(count(1),0)
from jj_warn_info jwi
where warn_day=CURRENT_DATE()
and handle_user is not null
<if test="isSup == 2">
and jwi.user_id = #{currentUserId}
</if>
<if test="isSup == 3">
and jwi.org_id = #{currentUserOrgId}
</if>
</select>
<!--今日违章统计-->
<select id="getDutyWz" resultType="java.lang.Integer">
select count(1)
FROM t_notice_voi tnv
where tnv.create_time=current_date() AND tnv.status!='8'
and tnv.is_flag = '0' and tnv.sup_type='1'
<if test="isSup == 2 or isSup == 3">
AND tnv.iss_user = #{currentUserId}
</if>
<if test="sgs!=null and sgs!=''">
AND tnv.status IN (
<foreach collection="sgs" item="item" separator=",">
#{item}
</foreach>
)
</if>
</select>
<select id="getTaskList" resultType="java.lang.Integer">
select count(distinct cm.id) num
from jj_class_meetting cm
left join t_class_metting_check cmc on cmc.class_id=cm.id
where cm.delete_flag=0 and cm.current_constr_date!=current_date()
<if test="isSup == 1">
AND (cmc.quality_user = 'AU' OR cmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND cmc.check_user = #{currentUserId}
</if>
<if test="isSup == 3">
AND cm.build_unit_code = #{currentUserOrgId}
</if>
UNION ALL
select count(distinct cm.id)
from jj_class_meetting cm
left join t_class_metting_check cmc on cmc.class_id=cm.id
where cm.delete_flag=0 and cm.current_constr_date=current_date()
<if test="isSup == 1">
AND (cmc.quality_user = 'AU' OR cmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND cmc.check_user = #{currentUserId}
</if>
<if test="isSup == 3">
AND cm.build_unit_code = #{currentUserOrgId}
</if>
UNION ALL
select count(distinct cm.id)
from jj_class_meetting cm
left join t_class_metting_check cmc on cmc.class_id=cm.id
where cm.delete_flag=0 and cm.current_constr_date=current_date() and cm.current_construction_status=2
<if test="isSup == 1">
AND (cmc.quality_user = 'AU' OR cmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND cmc.check_user = #{currentUserId}
</if>
<if test="isSup == 3">
AND cm.build_unit_code = #{currentUserOrgId}
</if>
UNION ALL
select count(distinct cm.id)
from jj_class_meetting cm
left join t_class_metting_check cmc on cmc.class_id=cm.id
where cm.delete_flag=0 and cm.current_constr_date=current_date() AND cmc.is_check=1
<if test="isSup == 1">
AND (cmc.quality_user = 'AU' OR cmc.quality_user IS NULL)
</if>
<if test="isSup == 2">
AND cmc.check_user = #{currentUserId}
</if>
<if test="isSup == 3">
AND cm.build_unit_code = #{currentUserOrgId}
</if>
</select>
<!--判断是否是集体企业-->
<select id="collectiveUnit" resultType="java.lang.Integer">
SELECT COUNT(*) FROM jj_enterprise_unit WHERE unit_id = #{unitId}
</select>
</mapper>