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

1138 lines
50 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.dutyTask.mapper.SuperStatisticsMapper">
<!--新增违章类型-->
<insert id="addVoiType">
INSERT INTO sys_dist(id,`name`,code,is_flag,p_id,remarks) VALUES
(
NULL,#{code},'voi_category_child','0',#{pId},#{remarks}
)
</insert>
<!--新增违章依据-->
<insert id="addVoiInfo">
INSERT INTO t_notice_voi_info(id,noti_info,voi_type_id) VALUES
<foreach collection="list" item="item" separator=",">
(
NULL,#{item.notiInfo},#{item.voiTypeId}
)
</foreach>
</insert>
<!--添加违章整改信息-->
<insert id="addNoticeVioRect" useGeneratedKeys="true" keyProperty="id">
INSERT INTO t_notice_voi_rect (id,rect_explain,create_time,noti_id,create_date,rect_user,duty_unit,duty_user,rect_finsh_time,contact_phone)
VALUES (
null,#{rectExplain},#{createTime},#{notiId},#{createDate},#{rectUser},#{dutyUnit},#{dutyUser},#{rectFinshTime},#{contactPhone}
)
</insert>
<!--添加违章整改照片-->
<insert id="addNoticeVioRectImg">
INSERT INTO t_notice_voi_photo(id,image_path,image_type,noti_id,rect_id)
VALUES
<foreach collection="list" item="item" separator=",">
(
NULL,#{item.imagePath},#{item.imageType},#{item.notiId},#{item.id}
)
</foreach>
</insert>
<!--修改违章通知单记录-->
<update id="editNoticeVio">
UPDATE t_notice_voi SET ticket_no = #{ticketNo},pro_name = #{proName},create_time = #{createTime},
voi_type = #{voiType},voi_yj = #{voiYj},level_id = #{levelId},vio_users = #{vioUsers},`type` = #{type},
content = #{content},org = #{org},rec_requirement = #{recRequirement},voi_type_hand = #{voiTypeHand},status = #{voiStatus},remark = null,child_type = #{childType}
WHERE id = #{id}
</update>
<!--修改违章通知单记录-->
<update id="onlyEdit">
UPDATE t_notice_voi SET ticket_no = #{ticketNo},pro_name = #{proName},create_time = #{createTime},
voi_type = #{voiType},voi_yj = #{voiYj},level_id = #{levelId},vio_users = #{vioUsers},`type` = #{type},
content = #{content},org = #{org},rec_requirement = #{recRequirement},voi_type_hand = #{voiTypeHand},remark = null,child_type = #{childType}
WHERE id = #{id}
</update>
<!--修改违章人员-->
<update id="editNoticePeo">
<foreach collection="list" item="item" separator=";">
UPDATE t_notice_peo
<set>
score = #{item.score}
</set>
WHERE noti_id = #{id} AND id_number = #{item.idNumber}
</foreach>
</update>
<!--修改违章类型-->
<update id="updateVoiType">
UPDATE sys_dist SET `name` = #{code},remarks = #{remarks} WHERE id = #{id}
</update>
<!--删除违章通知图片-->
<delete id="delNoticeVioImg">
DELETE FROM t_notice_voi_photo WHERE noti_id = #{id} AND id IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</delete>
<!--删除违章人员-->
<delete id="delNoticePeo">
DELETE FROM t_notice_peo WHERE noti_id = #{id} AND id_number IN
<foreach collection="list" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</delete>
<delete id="delNoticePeos">
DELETE FROM t_notice_peo WHERE noti_id = #{id} and class_id=#{classId}
</delete>
<!--删除违章单、人员、图片、违章整改-->
<delete id="delNoticeVoiById">
<if test="type ==1 ">
DELETE FROM t_notice_voi WHERE id= #{id}
</if>
<if test="type == 2">
DELETE FROM t_notice_peo WHERE noti_id = #{id}
</if>
<if test="type == 3">
DELETE FROM t_notice_voi_photo WHERE noti_id = #{id}
</if>
<if test="type == 4">
DELETE FROM t_notice_voi_rect WHERE noti_id = #{id}
</if>
</delete>
<!--根据id删除违章依据-->
<update id="delVoiInfoById">
UPDATE t_notice_voi_info SET is_flag = 1 WHERE id = #{id}
</update>
<!--根据id删除违章类型-->
<update id="delVoiTypeById">
UPDATE sys_dist SET is_flag = '1' WHERE id = #{id}
</update>
<!--修改违章依据-->
<update id="updateVoiInfo">
UPDATE t_notice_voi_info SET noti_info = #{notiInfo} WHERE id = #{id}
</update>
<!--更新违章单状态-->
<update id="updateNoticeVio">
UPDATE t_notice_voi SET status = #{status},is_appeal = #{isAppeal},vio_users=#{vioUsers} WHERE id = #{id}
</update>
<!--违章反馈审核/违章申诉审核-->
<update id="rectCheck">
<if test="type == 1">
UPDATE t_notice_voi SET status = #{params.status},is_appeal = #{params.isAppeal},rec_time = #{params.createTime} WHERE id = #{params.notiId}
</if>
<if test="type == 2">
UPDATE t_notice_voi_rect SET check_opinion = #{params.checkOpinion} WHERE id = #{params.id}
</if>
</update>
<!--更新违章单数据-->
<update id="updateNoticeVoiInfo">
UPDATE t_notice_voi SET risk_level = #{riskLevel},team_name = #{teamName},bid_code = #{bidCode},sign_code = #{signCode} WHERE id = #{id}
</update>
<!--值长审核 违章单-->
<update id="checkVoiStatus">
UPDATE t_notice_voi SET status = #{status},remark = #{remark},resource = #{resource} WHERE id = #{id}
</update>
<!--违章单回撤-->
<update id="rebackVoiStatus">
UPDATE t_notice_voi SET status = '2' WHERE id = #{id}
</update>
<select id="getSuperStatisticsList"
resultType="com.sercurityControl.proteam.dutyTask.domain.NoticeVioEntity">
SELECT
tnv.id AS id,
tnv.id AS voiId,
tnv.class_id classId,
tnv.ticket_no AS ticketNo,
tnv.pro_name AS proName,
tnv.risk_level AS riskLevel,
so.city_name AS org,
tnv.`type` AS `type`,
tnv.`level_id` AS `levelId`,
tnv.content AS content,
tnv.iss_time AS issTime,
tnv.create_time AS createTime,
<if test="isSup == 1">
CASE tnv.sup_type WHEN '1' THEN IFNULL(tub.scheduling_name,su.user_name)
WHEN '2' THEN '地市自查' ELSE IFNULL(tub.scheduling_name,su.user_name) END AS issUser,
</if>
<if test="isSup == 2">
CASE tnv.sup_type WHEN '1' THEN '值班员'
WHEN '2' THEN '地市自查' ELSE '值班员' END AS issUser,
</if>
<if test="isSup == 3">
CASE tnv.sup_type WHEN '1' THEN '建设部安全管控'
WHEN '2' THEN '地市自查' ELSE '建设部安全管控' END AS issUser,
</if>
CASE tnv.`status` WHEN '1' THEN '未处理'
WHEN '2' THEN '已整改'
WHEN '3' THEN '已驳回'
WHEN '4' THEN '申诉中'
WHEN '5' THEN '整改已归档'
WHEN '6' THEN '申诉成功已归档'
WHEN '7' THEN '待审核'
WHEN '8' THEN '审核驳回'
WHEN '9' THEN '待下发'
END AS `status`,
tnv.`status` AS voiStatus,
tnv.voi_yj AS voiTerm,
tnv.sup_type AS supType,
tnv.rec_time AS recTime,
CASE sup_type WHEN '1' THEN '值班员' WHEN '2' THEN '地市自查' WHEN '3' THEN '手动下发' ELSE '值班员' END AS resource,
tnv.child_type AS childType,tnv.bid_code bidCode,tnv.remark2,tnv.sign_code signCode,
tnv.team_leader_number AS teamLeaderNumber
FROM t_notice_voi tnv
LEFT JOIN sys_org so ON tnv.org = so.org_id
LEFT JOIN sys_user su ON tnv.iss_user = su.id AND su.`status` = 0
LEFT JOIN tb_user_banding tub ON tnv.iss_user = tub.login_user_id AND tnv.create_day = tub.banding_date AND tub.is_flag = '0'
<where>
<if test="resource!=null and resource!=''">
<if test="resource=='3'">
and sup_type=#{resource}
</if>
</if>
<if test="resource==null or resource==''">
and sup_type!='3'
</if>
<if test="dataSource!=null and dataSource!=''">
AND sup_type=#{dataSource}
</if>
<if test='paramcode=="1"'>
and sup_type=1 and level_id='严重违章' and tnv.create_day=CURRENT_DATE() and tnv.status NOT in(6,8,9)
</if>
<if test='paramcode=="2"'>
and sup_type=1 and level_id='一般违章' and tnv.create_day=CURRENT_DATE() and tnv.status NOT in(6,8,9)
</if>
<if test='paramcode=="3"'>
and sup_type=1 and tnv.status NOT in(6,8,9) and tnv.create_day=CURRENT_DATE()
</if>
<if test='paramcode=="4"'>
and sup_type=1 and tnv.create_day=CURRENT_DATE() and tnv.status in(2,5)
</if>
<if test="xfUser!=null and xfUser!=''">
AND (su.user_name=#{xfUser} or tub.scheduling_name=#{xfUser} )
</if>
<if test="isSup == 2">
AND tnv.iss_user=#{currentUserId}
</if>
<if test="isSup == 3">
AND tnv.org = #{currentUserOrgId} AND tnv.`status` NOT IN ('7','8','9')
</if>
<if test="keyWord!='' and keyWord!=null">
AND (
INSTR(tnv.ticket_no,#{keyWord}) > 0 OR
INSTR(tnv.pro_name,#{keyWord}) > 0 OR
INSTR(IFNULL(tub.scheduling_name,su.user_name),#{keyWord}) > 0
)
</if>
<if test="org!='' and org!=null">
AND tnv.org IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="wzType!='' and wzType!=null">
AND tnv.`type` IN (
<foreach collection="wzTypeList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="ticketNo!='' and ticketNo!=null">
AND INSTR(tnv.ticket_no,#{ticketNo}) > 0
</if>
<if test="levelId!='' and levelId!=null">
AND tnv.`level_id` IN (
<foreach collection="levelIdList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="classId!='' and classId!=null">
AND tnv.`class_id` = #{classId}
</if>
<if test="createTime!='' and createTime!=null and endTime!='' and endTime!=null">
AND tnv.create_time BETWEEN #{createTime} AND #{endTime}
</if>
<if test="proName!='' and proName!=null">
AND tnv.bid_code IN (
<foreach collection="proNameList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="riskLevel!='' and riskLevel!=null">
AND tnv.risk_level IN (
<foreach collection="riskLevelList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="issUser!='' and issUser!=null and isSup==1">
AND INSTR(CASE tnv.sup_type WHEN '1' THEN IFNULL(tub.scheduling_name,su.user_name)
WHEN '2' THEN '地市自查' ELSE IFNULL(tub.scheduling_name,su.user_name) END,#{issUser}) > 0
</if>
<if test="issUser!='' and issUser!=null and isSup==2">
AND INSTR(CASE tnv.sup_type WHEN '1' THEN '值班员'
WHEN '2' THEN '地市自查' ELSE '值班员' END,#{issUser}) > 0
</if>
<if test="issUser!='' and issUser!=null and isSup==3">
AND INSTR(CASE tnv.sup_type WHEN '1' THEN '建设部安全管控'
WHEN '2' THEN '地市自查' ELSE '建设部安全管控' END,#{issUser}) > 0
</if>
<if test="status!='' and status!=null">
AND tnv.`status` IN (
<foreach collection="statusList" item="item" separator=",">
#{item}
</foreach>
)
</if>
</where>
ORDER BY tnv.iss_time DESC ,tnv.`status`
</select>
<!--根据违章单id获取违章单信息-->
<select id="getNoticeVoiById"
resultType="com.sercurityControl.proteam.dutyTask.domain.NoticeVioEntity">
SELECT
tnv.id AS id,
tnv.ticket_no AS ticketNo,
CASE tnv.`status` WHEN '1' THEN '未处理'
WHEN '2' THEN '已整改'
WHEN '3' THEN '已驳回'
WHEN '4' THEN '申诉中'
WHEN '5' THEN '整改已归档'
WHEN '6' THEN '申诉已归档'
WHEN '7' THEN '待审核'
WHEN '8' THEN '审核驳回'
END AS `chinaStatus`,
tnv.pro_name AS proName,
tnv.org AS org,
tnv.`type` AS `type`,
tnv.voi_type AS voiType,
tnv.voi_type_hand AS voiTypeHand,
tnv.voi_yj AS voiYj,
tnv.level_id AS levelId,
tnv.content AS content,
tnv.create_time AS createTime,
tnv.`status` AS `status`,
tnv.vio_users AS vioUsers,
tnv.rec_requirement AS recRequirement,
tnv.class_id AS classId,
a.imgPath AS imgPath,
a.imgId AS imgId,
b.idNumber AS idNumber,
b.score AS score,
b.peoId AS peoId,
tnv.remark,
tnv.is_appeal AS isAppeal,
tnv.child_type AS childType
FROM t_notice_voi tnv
LEFT JOIN (
SELECT tnvp.noti_id,ANY_VALUE(GROUP_CONCAT(tnvp.image_path)) AS imgPath,ANY_VALUE(GROUP_CONCAT(tnvp.id)) AS imgId
FROM t_notice_voi_photo tnvp
LEFT JOIN t_notice_voi tnv ON tnv.id = tnvp.noti_id
WHERE tnvp.noti_id = #{id} AND tnvp.image_type = '1'
GROUP BY tnvp.noti_id
)a ON a.noti_id = tnv.id
LEFT JOIN (
SELECT tnp.noti_id,ANY_VALUE(GROUP_CONCAT(tnp.id_number)) AS idNumber, ANY_VALUE(GROUP_CONCAT(tnp.score)) AS score,ANY_VALUE(GROUP_CONCAT(tnp.id)) AS peoId
FROM t_notice_peo tnp
LEFT JOIN t_notice_voi tnv ON tnv.id = tnp.noti_id
WHERE tnp.noti_id = #{id}
GROUP BY tnp.noti_id
)b ON b.noti_id = tnv.id
WHERE tnv.id = #{id}
</select>
<!--违章类型列表-->
<select id="getVoiTypeList" resultType="com.sercurityControl.proteam.dutyTask.domain.VoiTypeEntity">
SELECT id,`name`,remarks
FROM sys_dist
WHERE is_flag = '0' AND code = 'voi_category_child'
<if test="code!='' and code!=null">
AND id IN (
<foreach collection="codeList" item="item" separator=",">
#{item}
</foreach>
)
</if>
</select>
<!--违章类型是否存在-->
<select id="voiTypeIsExist" resultType="java.lang.Integer">
SELECT COUNT(*) FROM sys_dist WHERE code = 'voi_category_child' AND is_flag = '0' AND `name` = #{name}
</select>
<!--违章类型父id-->
<select id="getVoiTypePid" resultType="java.lang.Integer">
SELECT id FROM sys_dist WHERE code = 'voi_category' AND is_flag = '0'
</select>
<!--根据id获取违章类型-->
<select id="getVoiTypeById" resultType="com.sercurityControl.proteam.dutyTask.domain.VoiTypeEntity">
SELECT id,`name`,remarks
FROM sys_dist
WHERE is_flag = '0' AND code = 'voi_category_child' AND id = #{id}
</select>
<select id="getVoiInfoList" resultType="com.sercurityControl.proteam.dutyTask.domain.VoiInfoEntity">
SELECT id,noti_info AS notiInfo
FROM t_notice_voi_info
WHERE is_flag = '0' AND voi_type_id = #{voiTypeId}
<if test="notiInfo!='' and notiInfo!=null">
AND INSTR(noti_info,#{notiInfo})
</if>
</select>
<!--违章依据是否存在-->
<select id="voiInfoIsExist" resultType="java.lang.Integer">
SELECT COUNT(*) FROM t_notice_voi_info WHERE is_flag = 0 AND voi_type_id = #{voiTypeId} AND noti_info = #{notiInfo}
</select>
<!--根据id获取违章依据-->
<select id="getVoiInfoById" resultType="com.sercurityControl.proteam.dutyTask.domain.VoiInfoEntity">
SELECT id,noti_info AS notiInfo
FROM t_notice_voi_info
WHERE is_flag = '0' AND id = #{id}
</select>
<!--违章依据是否包含违章类型-->
<select id="isHasVoiInfo" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM t_notice_voi_info
WHERE is_flag = '0' AND voi_type_id = #{id}
</select>
<!--违章单选择作业票-->
<select id="getTicketNo" resultType="java.util.Map">
SELECT
tcm.build_unit_code AS org,
tcm.id AS classId,
tcm.ticket_no AS ticketNo,
tcm.bidding_section_name AS proName,
tcm.re_assessment_risk_level AS riskLevel,
jcmi.team_name AS teamName,
tcm.bidding_section_code AS bidCode,
tcm.single_project_code AS signCode
FROM jj_class_meetting tcm
LEFT JOIN jj_class_metting_info jcmi on tcm.id=jcmi.class_id
LEFT JOIN t_class_metting_check tcmc ON tcmc.class_id = tcm.id AND tcmc.create_time = CURRENT_DATE
WHERE tcm.current_constr_date = CURRENT_DATE AND tcm.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.quality_user = 'AU' OR tcmc.quality_user IS NULL)
</if>
<if test="isSup == 3">
AND tcm.build_unit_code = #{org}
</if>
<if test="keyWord!='' and keyWord!=null">
AND (
INSTR(ticket_no,#{keyWord}) > 0 or
INSTR(bidding_section_code,#{keyWord}) > 0 or
INSTR(single_project_code,#{keyWord}) > 0
)
</if>
</select>
<!--地市监控中心-整改填报(违章单基本信息,以及历史整改填报信息)-->
<select id="getNoticeVoiRectById"
resultType="com.sercurityControl.proteam.dutyTask.domain.NoticeVioEntity">
SELECT
tnv.id AS id,
tnv.ticket_no AS ticketNo,
tnv.pro_name AS proName,
so.city_name AS org,
tnv.`type` AS `type`,
IFNULL(sd.`name`,tnv.voi_type_hand) AS voiType,
tnv.voi_yj AS voiYj,
tnv.level_id AS levelId,
tnv.content AS content,
tnv.create_time AS createTime,
CASE tnv.`status` WHEN '1' THEN '未处理'
WHEN '2' THEN '已整改'
WHEN '3' THEN '已驳回'
WHEN '4' THEN '申诉中'
WHEN '5' THEN '整改已归档'
WHEN '6' THEN '申诉已归档'
WHEN '7' THEN '待审核'
WHEN '8' THEN '审核驳回'
END AS `status`,
tnv.vio_users AS vioUsers,
tnv.rec_requirement AS recRequirement,
tnv.class_id AS classId,
tnv.bid_code jlUnit,
tnv.remark2 workContent,
tnv.sign_code sgUnit,
a.imgPath AS imgPath,
tnv.is_appeal AS isAppeal,
tnv.sup_type AS supType
FROM t_notice_voi tnv
LEFT JOIN sys_org so ON tnv.org = so.org_id
LEFT JOIN sys_dist sd ON tnv.voi_type = sd.id AND sd.is_flag = '0' AND sd.`code` = 'voi_category_child'
LEFT JOIN (
SELECT tnvp.noti_id,ANY_VALUE(GROUP_CONCAT(tnvp.image_path)) AS imgPath
FROM t_notice_voi_photo tnvp
LEFT JOIN t_notice_voi tnv ON tnv.id = tnvp.noti_id
WHERE tnvp.noti_id = #{id} AND tnvp.image_type = '1'
GROUP BY tnvp.noti_id
)a ON a.noti_id = tnv.id
WHERE tnv.id = #{id}
</select>
<select id="getNoticeVoPeople" resultType="com.sercurityControl.proteam.dutyTask.domain.UserPeopleVo">
select noti_id,class_id notiId,name userName,id_number idNumber,score,id
from
t_notice_peo
WHERE noti_id = #{id}
</select>
<!--整改/申诉信息-->
<select id="getVoiRectList" resultType="com.sercurityControl.proteam.dutyTask.domain.NoticeVoiRectEntity">
SELECT
tnvr.id,
ANY_VALUE(tnvr.rect_explain) AS rectExplain,
ANY_VALUE(tnvr.check_opinion) AS checkOpinion,
ANY_VALUE(tnvr.duty_unit) AS dutyUnit,
ANY_VALUE(tnvr.duty_user) AS dutyUser,
ANY_VALUE(tnvr.create_time) AS rectFinshTime,
ANY_VALUE(tnvr.contact_phone) AS contactPhone,
ANY_VALUE(GROUP_CONCAT(tnvp.image_path)) AS imagePath
FROM t_notice_voi_rect tnvr
LEFT JOIN t_notice_voi_photo tnvp ON tnvr.id = tnvp.rect_id
WHERE tnvr.noti_id = #{id}
GROUP BY tnvr.id
ORDER BY tnvr.create_time
</select>
<!--违章整改通知单(远程督查)-->
<select id="getVoiNotice" resultType="com.sercurityControl.proteam.dutyTask.domain.NoticeVioEntity">
SELECT
tnv.id AS id,
tnv.ser_no AS serNo,
tnv.class_id AS classId,
tnv.pro_name AS proName,
tnv.team_name AS teamName,
so.abb_name AS org,
tnv.`type` AS `type`,
IFNULL(sd.`name`,tnv.voi_type_hand) AS voiType,
tnv.voi_yj AS voiYj,
IFNULL(CONCAT('【',tnv.level_id,'】',tnv.content),'手动下发违章') AS content,
tnv.create_time AS createTime,
tnv.`status` AS `status`,
tnv.vio_users AS vioUsers,
tnv.remark2 workContent,
tnv.bid_code jlUnit,
tnv.sign_code sgUnit,
tnv.rec_requirement AS recRequirement,
tnv.class_id AS classId,
a.imgPath AS imgPath,
'国网安徽电力基建安全质量智慧监控中心' AS issuingUnit,
tnv.remark
FROM t_notice_voi tnv
-- LEFT JOIN t_class_metting tcm ON tnv.class_id = tcm.class_id AND tcm.del_flag = '0'
LEFT JOIN sys_org so ON tnv.org = so.org_id
LEFT JOIN sys_dist sd ON tnv.voi_type = sd.id AND sd.is_flag = '0' AND sd.`code` = 'voi_category_child'
LEFT JOIN (
SELECT tnvp.noti_id,ANY_VALUE(GROUP_CONCAT(tnvp.image_path)) AS imgPath
FROM t_notice_voi_photo tnvp
LEFT JOIN t_notice_voi tnv ON tnv.id = tnvp.noti_id
WHERE tnvp.noti_id = #{id} AND tnvp.image_type = '1'
GROUP BY tnvp.noti_id
)a ON a.noti_id = tnv.id
WHERE tnv.id = #{id}
</select>
<!--违章整改反馈单-->
<select id="getVoiNoticeRect"
resultType="com.sercurityControl.proteam.dutyTask.domain.NoticeVoiRectEntity">
SELECT
tnvr.id,
ANY_VALUE(tnvr.rect_explain) AS rectExplain,
ANY_VALUE(tnvr.check_opinion) AS checkOpinion,
ANY_VALUE(tnvr.duty_unit) AS dutyUnit,
ANY_VALUE(tnvr.duty_user) AS dutyUser,
ANY_VALUE(tnvr.rect_finsh_time) AS rectFinshTime,
ANY_VALUE(tnvr.contact_phone) AS contactPhone,
ANY_VALUE(GROUP_CONCAT(tnvp.image_path)) AS imagePath
FROM t_notice_voi_rect tnvr
LEFT JOIN t_notice_voi_photo tnvp ON tnvr.id = tnvp.rect_id AND image_type = '2'
WHERE tnvr.noti_id = #{id}
GROUP BY tnvr.id
ORDER BY tnvr.create_time DESC
LIMIT 1
</select>
<select id="getOrgNumAndRate" 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 tnv.org,COUNT(tnv.org) AS num
FROM t_notice_voi tnv
-- LEFT JOIN t_class_metting tcm ON tnv.class_id = tcm.class_id AND tcm.del_flag = '0'
-- LEFT JOIN t_class_metting_check tcmc ON tnv.class_id = tcmc.class_id
LEFT JOIN sys_org so ON tnv.org = so.org_id
LEFT JOIN sys_user su ON tnv.iss_user = su.id AND su.`status` = 0
LEFT JOIN tb_user_banding tub ON tnv.iss_user = tub.login_user_id AND tnv.create_day = tub.banding_date AND tub.is_flag = '0'
<where>
<if test="isSup == 2">
tnv.iss_user = #{currentUserId}
</if>
<if test="isSup == 3">
AND tnv.org = #{currentUserOrgId} AND tnv.`status` NOT IN ('7','8')
</if>
<if test="keyWord!='' and keyWord!=null">
AND (
INSTR(tnv.ticket_no,#{keyWord}) > 0 OR
INSTR(tnv.pro_name,#{keyWord}) > 0 OR
INSTR(IFNULL(tub.scheduling_name,su.user_name),#{keyWord}) > 0
)
</if>
<if test="ticketNo!='' and ticketNo!=null">
AND INSTR(tnv.ticket_no,#{ticketNo}) > 0
</if>
<if test="levelId!='' and levelId!=null">
AND tnv.`level_id` IN (
<foreach collection="levelIdList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="classId!='' and classId!=null">
AND tnv.`class_id` = #{classId}
</if>
<if test="createTime!='' and createTime!=null and endTime!='' and endTime!=null">
AND tnv.create_time BETWEEN #{createTime} AND #{endTime}
</if>
<if test="proName!='' and proName!=null">
AND tnv.bid_code IN (
<foreach collection="proNameList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="riskLevel!='' and riskLevel!=null">
AND tnv.risk_level IN (
<foreach collection="riskLevelList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="issUser!='' and issUser!=null and isSup==1">
AND INSTR(CASE tnv.sup_type WHEN '1' THEN IFNULL(tub.scheduling_name,su.user_name)
WHEN '2' THEN '地市自查' ELSE IFNULL(tub.scheduling_name,su.user_name) END,#{issUser}) > 0
</if>
<if test="issUser!='' and issUser!=null and isSup==2">
AND INSTR(CASE tnv.sup_type WHEN '1' THEN '值班员'
WHEN '2' THEN '地市自查' ELSE '值班员' END,#{issUser}) > 0
</if>
<if test="issUser!='' and issUser!=null and isSup==3">
AND INSTR(CASE tnv.sup_type WHEN '1' THEN '建设部安全管控'
WHEN '2' THEN '地市自查' ELSE '建设部安全管控' END,#{issUser}) > 0
</if>
<if test="status!='' and status!=null">
AND tnv.`status` IN (
<foreach collection="statusList" item="item" separator=",">
#{item}
</foreach>
)
</if>
</where>
GROUP BY tnv.org
)a ON a.org = so.org_id
ORDER BY num DESC
</select>
<select id="getVoiRecordList" resultType="com.sercurityControl.proteam.dutyTask.domain.NoticeVioEntity">
SELECT
tnv.id AS id,
tnv.ticket_no AS ticketNo,
tnv.pro_name AS proName,
tnv.risk_level AS riskLevel,
so.city_name AS org,
tnv.`type` AS `type`,
tnv.`level_id` AS `levelId`,
tnv.content AS content,
tnv.create_time AS createTime,
<if test="isSup == 1">
CASE tnv.sup_type WHEN '1' THEN IFNULL(tub.scheduling_name,su.user_name)
WHEN '2' THEN '地市自查' ELSE IFNULL(tub.scheduling_name,su.user_name) END AS issUser,
</if>
<if test="isSup == 2">
CASE tnv.sup_type WHEN '1' THEN '值班员'
WHEN '2' THEN '地市自查' ELSE '值班员' END AS issUser,
</if>
<if test="isSup == 3">
CASE tnv.sup_type WHEN '1' THEN '建设部安全管控'
WHEN '2' THEN '地市自查' ELSE '建设部安全管控' END AS issUser,
</if>
CASE tnv.`status` WHEN '1' THEN '未处理'
WHEN '2' THEN '已整改'
WHEN '3' THEN '已驳回'
WHEN '4' THEN '申诉中'
WHEN '5' THEN '整改已归档'
WHEN '6' THEN '申诉成功已归档'
WHEN '7' THEN '待审核'
WHEN '8' THEN '审核驳回'
WHEN '9' THEN '待下发'
END AS `status`,
tnv.class_id AS classId,
tnv.sup_type AS supType,
tnv.`status` AS voiStatus,
tnv.rec_time AS recTime
FROM t_notice_voi tnv
LEFT JOIN sys_org so ON tnv.org = so.org_id
LEFT JOIN sys_user su ON tnv.iss_user = su.id AND su.`status` = 0
LEFT JOIN tb_user_banding tub ON tnv.iss_user = tub.login_user_id AND tnv.create_day = tub.banding_date AND tub.is_flag = '0'
WHERE tnv.class_id = #{classId} AND tnv.create_time = CURRENT_DATE
AND tnv.`status` NOT IN ('7','8') AND (tnv.sup_type IS NULL OR tnv.sup_type = '1')
ORDER BY tnv.iss_time DESC ,tnv.`status`
</select>
<!--获取违章单数据-->
<select id="getNoticeVoiData" resultType="com.sercurityControl.proteam.dutyTask.domain.NoticeVioEntity">
SELECT tnv.id,
tcm.class_id AS classId,
tcm.risk_level AS riskLevel,
tcm.team_name AS teamName,
tcm.sign_code AS signCode,
tcm.bid_code AS bidCode
FROM t_notice_voi tnv
LEFT JOIN t_class_metting tcm ON tnv.class_id = tcm.class_id AND tcm.del_flag = '0'
WHERE tnv.create_time >= '2023-06-14' AND tnv.risk_level IS NULL
</select>
<select id="getViolationTypeList" resultType="java.util.Map">
SELECT COUNT(*) AS num
FROM t_notice_voi tnv
LEFT JOIN sys_org so ON tnv.org = so.org_id
LEFT JOIN sys_user su ON tnv.iss_user = su.id AND su.`status` = 0
LEFT JOIN tb_user_banding tub ON tnv.iss_user = tub.login_user_id AND tnv.create_day = tub.banding_date AND tub.is_flag = '0'
<where>
<if test="type == 2">
tnv.type = #{statisticsType}
</if>
<if test="type == 1">
AND tnv.level_id = #{statisticsType}
</if>
<if test="isSup == 2">
AND tnv.iss_user = #{currentUserId}
</if>
<if test="isSup == 3">
AND tnv.org = #{currentUserOrgId}
</if>
<if test="keyWord!='' and keyWord!=null">
AND (
INSTR(tnv.ticket_no,#{keyWord}) > 0 OR
INSTR(tnv.pro_name,#{keyWord}) > 0 OR
INSTR(IFNULL(tub.scheduling_name,su.user_name),#{keyWord}) > 0
)
</if>
<if test="org!='' and org!=null">
AND tnv.org IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="ticketNo!='' and ticketNo!=null">
AND INSTR(tnv.ticket_no,#{ticketNo}) > 0
</if>
<if test="levelId!='' and levelId!=null">
AND tnv.`level_id` IN (
<foreach collection="levelIdList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="classId!='' and classId!=null">
AND tnv.`class_id` = #{classId}
</if>
<if test="createTime!='' and createTime!=null and endTime!='' and endTime!=null">
AND tnv.create_time BETWEEN #{createTime} AND #{endTime}
</if>
<if test="proName!='' and proName!=null">
AND tnv.bid_code IN (
<foreach collection="proNameList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="riskLevel!='' and riskLevel!=null">
AND tnv.risk_level IN (
<foreach collection="riskLevelList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="issUser!='' and issUser!=null and isSup==1">
AND INSTR(CASE tnv.sup_type WHEN '1' THEN IFNULL(tub.scheduling_name,su.user_name)
WHEN '2' THEN '地市自查' ELSE IFNULL(tub.scheduling_name,su.user_name) END,#{issUser}) > 0
</if>
<if test="issUser!='' and issUser!=null and isSup==2">
AND INSTR(CASE tnv.sup_type WHEN '1' THEN '值班员'
WHEN '2' THEN '地市自查' ELSE '值班员' END,#{issUser}) > 0
</if>
<if test="issUser!='' and issUser!=null and isSup==3">
AND INSTR(CASE tnv.sup_type WHEN '1' THEN '建设部安全管控'
WHEN '2' THEN '地市自查' ELSE '建设部安全管控' END,#{issUser}) > 0
</if>
<if test="status!='' and status!=null">
AND tnv.`status` IN (
<foreach collection="statusList" item="item" separator=",">
#{item}
</foreach>
)
</if>
AND tnv.`status` NOT IN ('7','8','9') AND (tnv.sup_type IS NULL OR tnv.sup_type = '1')
</where>
</select>
<!--今日站班会-工程累计违章-->
<select id="getProVoiRecordList" resultType="com.sercurityControl.proteam.dutyTask.domain.NoticeVioEntity">
SELECT
tnv.id AS id,
tnv.ticket_no AS ticketNo,
tnv.pro_name AS proName,
tnv.risk_level AS riskLevel,
so.city_name AS org,
tnv.`type` AS `type`,
tnv.`level_id` AS `levelId`,
tnv.content AS content,
tnv.create_time AS createTime,
<if test="isSup == 1">
CASE tnv.sup_type WHEN '1' THEN IFNULL(tub.scheduling_name,su.user_name)
WHEN '2' THEN '地市自查' ELSE IFNULL(tub.scheduling_name,su.user_name) END AS issUser,
</if>
<if test="isSup == 2">
CASE tnv.sup_type WHEN '1' THEN '值班员'
WHEN '2' THEN '地市自查' ELSE '值班员' END AS issUser,
</if>
<if test="isSup == 3">
CASE tnv.sup_type WHEN '1' THEN '建设部安全管控'
WHEN '2' THEN '地市自查' ELSE '建设部安全管控' END AS issUser,
</if>
CASE tnv.`status` WHEN '1' THEN '未处理'
WHEN '2' THEN '已整改'
WHEN '3' THEN '已驳回'
WHEN '4' THEN '申诉中'
WHEN '5' THEN '整改已归档'
WHEN '6' THEN '申诉成功已归档'
WHEN '7' THEN '待审核'
WHEN '8' THEN '审核驳回'
WHEN '9' THEN '待下发'
END AS `status`,
tnv.class_id AS classId,
tnv.sup_type AS supType,
tnv.`status` AS voiStatus,
tnv.rec_time AS recTime,
tnv.create_time createTime
FROM t_notice_voi tnv
LEFT JOIN sys_org so ON tnv.org = so.org_id
LEFT JOIN sys_user su ON tnv.iss_user = su.id AND su.`status` = 0
LEFT JOIN tb_user_banding tub ON tnv.iss_user = tub.login_user_id AND tnv.create_day = tub.banding_date AND tub.is_flag = '0'
WHERE tnv.bid_code = #{bidCode}
<if test="createTime!='' and createTime!=null and endTime!='' and endTime!=null">
AND tnv.create_time BETWEEN #{createTime} AND #{endTime}
</if>
<if test="keyWord!='' and keyWord!=null">
AND (
INSTR(tnv.ticket_no,#{keyWord}) > 0 OR
INSTR(tnv.pro_name,#{keyWord}) > 0 OR
INSTR(IFNULL(tub.scheduling_name,su.user_name),#{keyWord}) > 0
)
</if>
AND tnv.`status` NOT IN ('7','8') AND (tnv.sup_type IS NULL OR tnv.sup_type = '1')
ORDER BY tnv.iss_time DESC ,tnv.`status`
</select>
<!--获取 施工单位、监理单位、班组负责人及电话-->
<select id="getBasicInfo" resultType="java.util.Map">
select jcmi.work_content workContent,jcm.id,
CONCAT(jcmi.work_manage," ",jcmi.work_manage_phone) AS contactPhone,
ju.unit_name sgdw,
jcm.supervision_unit_name jlUnit ,
tnp.yz_manager AS yz,
tnp.sg_manager AS sg,
tnp.jl_manager AS jl
from jj_class_meetting jcm
LEFT JOIN jj_class_metting_info jcmi on jcm.id=jcmi.class_id
LEFT JOIN tb_new_pro tnp ON jcm.single_project_name = tnp.pro_name AND tnp.is_pro = '2'
left join jj_unit ju on ju.unified_social_credit_id=jcm.constr_unified_social_credit_id and ju.delete_flag=0
WHERE jcm.id=#{classId}
</select>
<!--获取违章照片-->
<select id="getVoiImgs" resultType="java.lang.String">
SELECT image_path FROM t_notice_voi_photo WHERE noti_id = #{id} AND image_type = '1'
</select>
<!--获取违章单 施工单位、监理单位、作业内容及施工部位-->
<select id="getNoticeSheet2" resultType="com.sercurityControl.proteam.dutyTask.domain.NoticeVioEntity">
select jcmi.work_content workContent,jcm.id,
ju.unit_name sgUnit,
jcm.supervision_unit_name jlUnit
from jj_class_meetting jcm
LEFT JOIN jj_class_metting_info jcmi on jcm.id=jcmi.class_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.id=#{classId}
</select>
<!--违章审核记录列表-->
<select id="getVoiCheckLists" resultType="com.sercurityControl.proteam.dutyTask.domain.NoticeVioEntity">
SELECT tnv.id AS id,
tnv.ticket_no AS ticketNo,
tnv.pro_name AS proName,
tnv.risk_level AS riskLevel,
so.city_name AS org,
tnv.`type` AS `type`,
tnv.`level_id` AS `levelId`,
tnv.content AS content,
tnv.create_time AS createTime,
IFNULL(tub.scheduling_name,su.user_name) AS issUser,
CASE tnv.`status` WHEN '7' THEN '待审核'
WHEN '8' THEN '审核驳回'
ELSE '审核通过' END AS `status`,
tnv.remark
FROM t_notice_voi tnv
LEFT JOIN sys_org so ON tnv.org = so.org_id
LEFT JOIN sys_user su ON tnv.iss_user = su.id AND su.`status` = 0
LEFT JOIN tb_user_banding tub ON tnv.iss_user = tub.login_user_id AND tnv.create_day = tub.banding_date AND tub.is_flag = '0'
WHERE tnv.is_flag = '0' AND tnv.sup_type = '1'
<if test="createTime!='' and createTime!=null and endTime!='' and endTime!=null">
AND tnv.create_time BETWEEN #{createTime} AND #{endTime}
</if>
<if test="issUser!='' and issUser!=null">
AND INSTR(IFNULL(tub.scheduling_name,su.user_name),#{issUser}) > 0
</if>
<if test="issUser!='' and issUser!=null">
AND INSTR(IFNULL(tub.scheduling_name,su.user_name),#{issUser}) > 0
</if>
<if test="org!='' and org!=null">
AND tnv.org = #{org}
</if>
<if test="keyWord!='' and keyWord!=null">
AND (
INSTR(tnv.ticket_no,#{keyWord}) > 0 OR
INSTR(tnv.pro_name,#{keyWord}) > 0
)
</if>
ORDER BY tnv.iss_time DESC
</select>
<!--违章子类型下拉选-->
<select id="getTypeChildList" resultType="java.util.Map">
SELECT sd2.name AS name,
sd2.id
FROM sys_dist sd
LEFT JOIN sys_dist sd2 ON sd.id = sd2.p_id AND sd2.is_flag = 0
<where>
<if test="typeId !=null and typeId!=''">
AND sd.name = #{typeId}
</if>
AND INSTR(sd.code,'_voi') > 0
</where>
</select>
<!--获取班组长-->
<select id="getTeamLeader" resultType="java.lang.String">
<if test="type == 1">
SELECT IFNULL(CONCAT(jtp.real_name,IFNULL(ju.mobile,'')),'-') leaderName
FROM jj_team jt
left join jj_team_people jtp on jt.id=jtp.team_id
LEFT JOIN jj_user ju ON ju.personnel_id=jtp.personnel_id and ju.delete_flag=0
WHERE jt.id = #{param}
limit 1
</if>
<if test="type == 2">
select IFNULL(CONCAT(jcmi.work_manage,IFNULL(jcmi.work_manage_phone,'')),'-') leaderName
FROM jj_class_meetting jcm
left join jj_class_metting_info jcmi on jcm.id=jcmi.class_id
WHERE jcm.id = #{param}
limit 1
</if>
</select>
<!--获取班组长的身份证号-->
<select id="getTeamLeaderNumber" resultType="java.lang.String">
SELECT team_id
FROM jj_class_metting_info WHERE class_id = #{param}
</select>
<!--获取违章等级数量、违章类型数量、违章子类型数量-->
<select id="getTeamVoiNum" resultType="java.util.Map">
<if test="type == 1">
SELECT tnv.level_id AS level,tnv.type,child_type AS childType
FROM t_notice_voi tnv
WHERE team_id = #{teamId} AND tnv.`status` NOT IN ('7','8') AND (tnv.sup_type IS NULL OR tnv.sup_type = '1')
</if>
</select>
<!--获取违章等级、违章类型-->
<select id="getVoiDist" resultType="java.lang.String">
SELECT sd2.name AS name,
sd2.id
FROM sys_dist sd
LEFT JOIN sys_dist sd2 ON sd.id = sd2.p_id AND sd2.is_flag = 0
WHERE sd.code = #{param}
</select>
<!--获取班组历史违章记录-->
<select id="getTeamVoiHistory" resultType="com.sercurityControl.proteam.dutyTask.domain.NoticeVioEntity">
SELECT tnv.level_id AS levelId,
tnv.type,
child_type AS childType,
tnv.team_name AS teamName,
tcm.work_manage AS workManager,
tcm.work_manage_phone AS workManagerPhone,
tnv.content
FROM t_notice_voi tnv
LEFT JOIN jj_class_metting_info tcm on tnv.class_id = tcm.class_id
WHERE tnv.team_id = #{teamId} AND tnv.`status` NOT IN ('7','8') AND (tnv.sup_type IS NULL OR tnv.sup_type = '1')
</select>
<!--获取违章子类型-->
<select id="getChildTypeList" resultType="java.util.Map">
SELECT
tnv.level_id AS level,tnv.type,child_type AS childType
FROM t_notice_voi tnv
LEFT JOIN sys_org so ON tnv.org = so.org_id
LEFT JOIN sys_user su ON tnv.iss_user = su.id AND su.`status` = 0
LEFT JOIN tb_user_banding tub ON tnv.iss_user = tub.login_user_id AND tnv.create_day = tub.banding_date AND tub.is_flag = '0'
<where>
<if test="isSup == 2">
tnv.iss_user = #{currentUserId} AND tnv.`status` NOT IN ('7','8') AND (tnv.sup_type IS NULL OR tnv.sup_type = '1')
</if>
<if test="isSup == 3">
AND tnv.org = #{currentUserOrgId} AND tnv.`status` NOT IN ('7','8') AND (tnv.sup_type IS NULL OR tnv.sup_type = '1')
</if>
<if test="keyWord!='' and keyWord!=null">
AND (
INSTR(tnv.ticket_no,#{keyWord}) > 0 OR
INSTR(tnv.pro_name,#{keyWord}) > 0 OR
INSTR(IFNULL(tub.scheduling_name,su.user_name),#{keyWord}) > 0
)
</if>
<if test="org!='' and org!=null">
AND tnv.org IN (
<foreach collection="orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="ticketNo!='' and ticketNo!=null">
AND INSTR(tnv.ticket_no,#{ticketNo}) > 0
</if>
<if test="levelId!='' and levelId!=null">
AND tnv.`level_id` IN (
<foreach collection="levelIdList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="classId!='' and classId!=null">
AND tnv.`class_id` = #{classId}
</if>
<if test="createTime!='' and createTime!=null and endTime!='' and endTime!=null">
AND tnv.create_time BETWEEN #{createTime} AND #{endTime}
</if>
<if test="proName!='' and proName!=null">
AND tnv.bid_code IN (
<foreach collection="proNameList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="riskLevel!='' and riskLevel!=null">
AND tnv.risk_level IN (
<foreach collection="riskLevelList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="issUser!='' and issUser!=null and isSup==1">
AND INSTR(CASE tnv.sup_type WHEN '1' THEN IFNULL(tub.scheduling_name,su.user_name)
WHEN '2' THEN '地市自查' ELSE IFNULL(tub.scheduling_name,su.user_name) END,#{issUser}) > 0
</if>
<if test="issUser!='' and issUser!=null and isSup==2">
AND INSTR(CASE tnv.sup_type WHEN '1' THEN '值班员'
WHEN '2' THEN '地市自查' ELSE '值班员' END,#{issUser}) > 0
</if>
<if test="issUser!='' and issUser!=null and isSup==3">
AND INSTR(CASE tnv.sup_type WHEN '1' THEN '建设部安全管控'
WHEN '2' THEN '地市自查' ELSE '建设部安全管控' END,#{issUser}) > 0
</if>
<if test="status!='' and status!=null">
AND tnv.`status` IN (
<foreach collection="statusList" item="item" separator=",">
#{item}
</foreach>
)
</if>
AND tnv.`status` NOT IN ('7','8')
</where>
</select>
<!--获取违章通知 -> 提醒主任数据-->
<select id="getVioNoticeByDirector"
resultType="com.sercurityControl.proteam.dutyTask.domain.NoticeVioEntity">
SELECT
tnv.id AS id,
tnv.id AS voiId,
tnv.class_id classid,
tnv.ticket_no AS ticketNo,
tnv.pro_name AS proName,
tnv.risk_level AS riskLevel,
so.city_name AS org,
tnv.`type` AS `type`,
tnv.`level_id` AS `levelId`,
tnv.content AS content,
tnv.create_time AS createTime,
IFNULL(tub.scheduling_name,su.user_name) AS issUser,
CASE tnv.`status` WHEN '1' THEN '未处理'
WHEN '2' THEN '已整改'
WHEN '3' THEN '已驳回'
WHEN '4' THEN '申诉中'
WHEN '5' THEN '整改已归档'
WHEN '6' THEN '申诉成功已归档'
WHEN '7' THEN '待审核'
WHEN '8' THEN '审核驳回'
WHEN '9' THEN '待下发'
END AS `status`,
tnv.`status` AS voiStatus,
tnv.voi_yj AS voiTerm,
tnv.sup_type AS supType,
tnv.rec_time AS recTime,
CASE sup_type WHEN '1' THEN '值班员' WHEN '2' THEN '地市自查' WHEN '3' THEN '手动下发' ELSE '值班员' END AS resource,
tnv.child_type AS childType,tnv.bid_code bidCode,tnv.remark2,tnv.sign_code signCode,
tnv.team_leader_number AS teamLeaderNumber
FROM t_notice_voi tnv
LEFT JOIN sys_org so ON tnv.org = so.org_id
LEFT JOIN sys_user su ON tnv.iss_user = su.id AND su.`status` = 0
LEFT JOIN tb_user_banding tub ON tnv.iss_user = tub.login_user_id AND tnv.create_day = tub.banding_date AND tub.is_flag = '0'
<where>
<if test="isDirector == 1">
tnv.resource = '1'
</if>
<if test="isDirector == 0">
AND tnv.resource = '-1'
</if>
</where>
ORDER BY tnv.iss_time DESC ,tnv.`status`
</select>
<!--违章统计-->
<select id="getVioStatistics" resultType="com.sercurityControl.proteam.dutyTask.domain.VioStatisticsVo">
SELECT so.org_id AS orgId,
so.city_name AS orgName,
IFNULL(a.classNum,0) AS classNum,
IFNULL(b.vioNum,0) AS vioNum
FROM sys_org so
LEFT JOIN (
SELECT jjcm.build_unit_code,COUNT(jjcm.build_unit_code) AS classNum
FROM jj_class_meetting jjcm
<where>
<if test="isSup == 3">
AND jjcm.build_unit_code = #{currentUserOrgId}
</if>
AND jjcm.current_constr_date BETWEEN #{startTime} AND #{endTime} AND jjcm.delete_flag = 0
</where>
GROUP BY jjcm.build_unit_code
) a ON so.org_id = a.build_unit_code
LEFT JOIN (
SELECT tnv.org,COUNT(tnv.org) AS vioNum
FROM t_notice_voi tnv
<where>
<if test="isSup == 3">
AND tnv.org = #{currentUserOrgId}
</if>
AND tnv.sup_type = '1' AND tnv.create_time BETWEEN #{startTime} AND #{endTime} AND tnv.`status` NOT IN('7','8','9') AND tnv.is_flag = '0'
</where>
GROUP BY tnv.org
) b ON so.org_id = b.org
ORDER BY IFNULL(a.classNum,0) DESC,IFNULL(b.vioNum,0) DESC
</select>
<!--查询配置的违章统计的锁定状态-->
<select id="getLockStatus" 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 = 'lock_status' AND sd.is_flag = '0' AND sd2.name IS NOT NULL
</select>
<select id="getPassWord" resultType="java.lang.String">
SELECT pwd FROM sys_user su WHERE id = #{id}
</select>
</mapper>