2025-03-20 16:11:17 +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.bonus.material.warningAnalysis.mapper.UseMaintenanceWarningMapper">
|
|
|
|
|
|
|
|
|
|
<select id="getList" resultType="com.bonus.material.warningAnalysis.domain.UseMaintenanceWarningBean">
|
|
|
|
|
SELECT
|
|
|
|
|
mm.ma_id as maId,
|
|
|
|
|
mm.next_check_time as nextCheckTime,
|
2025-08-20 20:06:37 +08:00
|
|
|
mt3.type_name as materialType,
|
2025-03-20 16:11:17 +08:00
|
|
|
mt2.type_name as typeName,
|
|
|
|
|
mt.type_name as typeModelName,
|
|
|
|
|
mm.ma_code as maCode,
|
|
|
|
|
bu.unit_name as unitName,
|
|
|
|
|
bp.pro_name as projectName,
|
|
|
|
|
bai.agreement_code as agreementCode,
|
2025-08-20 20:06:37 +08:00
|
|
|
DATEDIFF(mm.next_check_time, CURDATE()) AS overDays,
|
|
|
|
|
sd.dept_name as impUnit
|
2025-03-20 16:11:17 +08:00
|
|
|
FROM
|
|
|
|
|
ma_machine mm
|
|
|
|
|
LEFT JOIN ma_type mt on mt.type_id=mm.type_id
|
|
|
|
|
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
|
2025-08-20 20:06:37 +08:00
|
|
|
LEFT JOIN ma_type mt3 on mt3.type_id=mt2.parent_id
|
|
|
|
|
LEFT JOIN ma_type mt4 on mt4.type_id=mt3.parent_id
|
2025-03-20 16:11:17 +08:00
|
|
|
LEFT JOIN slt_agreement_info sai on sai.ma_id=mm.ma_id and mm.type_id=sai.type_id and sai.`status`='0' and
|
|
|
|
|
sai.end_time is null
|
|
|
|
|
LEFT JOIN bm_agreement_info bai on bai.agreement_id=sai.agreement_id
|
|
|
|
|
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
|
|
|
|
AND bu.del_flag = '0'
|
|
|
|
|
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
|
|
|
|
AND bp.del_flag = '0'
|
2025-08-20 20:06:37 +08:00
|
|
|
LEFT JOIN sys_dept sd on sd.dept_id = bp.imp_unit
|
2025-03-20 16:11:17 +08:00
|
|
|
WHERE
|
2025-08-21 18:28:42 +08:00
|
|
|
mm.ma_status='2' and sai.is_slt = 0
|
2025-03-20 16:11:17 +08:00
|
|
|
and bp.pro_name is not null
|
2025-07-31 18:25:38 +08:00
|
|
|
AND mm.next_check_time BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 1 MONTH)
|
2025-03-20 16:11:17 +08:00
|
|
|
<if test="keyWord != null and keyWord != ''">
|
2025-08-20 20:06:37 +08:00
|
|
|
and (
|
|
|
|
|
mt4.type_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
mt3.type_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
mt2.type_name like concat('%', #{keyWord}, '%') or
|
2025-03-20 16:11:17 +08:00
|
|
|
mt.type_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
mm.ma_code like concat('%', #{keyWord}, '%') or
|
|
|
|
|
bu.unit_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
bp.pro_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
bai.agreement_code like concat('%', #{keyWord}, '%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
AND DATE_FORMAT( mm.next_check_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime}
|
|
|
|
|
</if>
|
2025-07-31 18:25:38 +08:00
|
|
|
<if test="typeId != null">
|
|
|
|
|
AND mt.type_id = #{typeId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="thirdTypeId != null">
|
|
|
|
|
AND mt2.type_id = #{thirdTypeId}
|
|
|
|
|
</if>
|
2025-03-20 16:11:17 +08:00
|
|
|
ORDER BY mm.next_check_time ASC
|
|
|
|
|
</select>
|
|
|
|
|
|
2025-08-21 18:28:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getWarningLastMonthList"
|
|
|
|
|
resultType="com.bonus.material.warningAnalysis.domain.UseMaintenanceWarningBean">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
proId as projectId,
|
|
|
|
|
projectName,
|
|
|
|
|
GROUP_CONCAT(DISTINCT typeName) as typeName ,
|
|
|
|
|
COUNT(DISTINCT maId) as warnNum
|
|
|
|
|
FROM
|
|
|
|
|
(
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
bp.external_id as proId,
|
|
|
|
|
mm.ma_id as maId,
|
|
|
|
|
mm.next_check_time as nextCheckTime,
|
|
|
|
|
mt3.type_name as materialType,
|
|
|
|
|
mt2.type_name as typeName,
|
|
|
|
|
mt.type_name as typeModelName,
|
|
|
|
|
mm.ma_code as maCode,
|
|
|
|
|
bu.unit_name as unitName,
|
|
|
|
|
bp.pro_name as projectName,
|
|
|
|
|
DATEDIFF(mm.next_check_time, CURDATE()) AS overDays
|
|
|
|
|
FROM
|
|
|
|
|
ma_machine mm
|
|
|
|
|
LEFT JOIN ma_type mt on mt.type_id=mm.type_id
|
|
|
|
|
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
|
|
|
|
|
LEFT JOIN ma_type mt3 on mt3.type_id=mt2.parent_id
|
|
|
|
|
LEFT JOIN ma_type mt4 on mt4.type_id=mt3.parent_id
|
|
|
|
|
LEFT JOIN slt_agreement_info sai on sai.ma_id=mm.ma_id and mm.type_id=sai.type_id
|
|
|
|
|
LEFT JOIN bm_agreement_info bai on bai.agreement_id=sai.agreement_id
|
|
|
|
|
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
|
|
|
|
AND bu.del_flag = '0'
|
|
|
|
|
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
|
|
|
|
AND bp.del_flag = '0'
|
|
|
|
|
LEFT JOIN sys_dept sd on sd.dept_id = bp.imp_unit
|
|
|
|
|
WHERE
|
|
|
|
|
sai.`status` = 0 and sai.is_slt = 0 and
|
|
|
|
|
mm.ma_status='2'
|
|
|
|
|
and bp.external_id is not null
|
|
|
|
|
AND mt.jiju_type =2
|
|
|
|
|
AND mm.next_check_time BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 1 MONTH)
|
|
|
|
|
) res
|
|
|
|
|
GROUP BY proId
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getProjectManager" resultType="com.bonus.material.warningAnalysis.domain.UseMaintenanceWarningBean">
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
dc.id as projectId,
|
|
|
|
|
du1.mobile as leaderPhone,
|
|
|
|
|
du2.mobile as engPhone
|
|
|
|
|
FROM
|
|
|
|
|
`data_center`.dx_fb_son dc
|
|
|
|
|
LEFT JOIN `data_center`.dc_user du1 ON dc.project_leader_id = du1.id
|
|
|
|
|
LEFT JOIN `data_center`.dc_user du2 ON dc.project_engineer_id = du2.id
|
|
|
|
|
WHERE dc.id = #{projectId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getUserList" resultType="com.bonus.material.warningAnalysis.domain.UseMaintenanceWarningBean">
|
|
|
|
|
SELECT
|
2025-08-29 14:52:35 +08:00
|
|
|
sgp.cno as userName
|
2025-08-21 18:28:42 +08:00
|
|
|
FROM
|
|
|
|
|
bm_project bp
|
|
|
|
|
LEFT JOIN `data_center`.dx_fb_son dfs on bp.external_id = dfs.id
|
|
|
|
|
LEFT JOIN `sbd_audit`.sg_project_post_personnel sgp on sgp.depart_id = dfs.project_dept_id
|
|
|
|
|
|
|
|
|
|
WHERE sgp.post_id = '3de0eb390f3611efa1940242ac130004'
|
|
|
|
|
|
2025-08-29 14:52:35 +08:00
|
|
|
AND bp.pro_id = #{projectId}
|
2025-08-21 18:28:42 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getUserPhoneById" resultType="com.bonus.material.warningAnalysis.domain.UseMaintenanceWarningBean">
|
|
|
|
|
select
|
2025-08-29 14:52:35 +08:00
|
|
|
user_id as userId,
|
2025-08-21 18:28:42 +08:00
|
|
|
phonenumber AS clzPhone
|
|
|
|
|
from
|
|
|
|
|
sys_user
|
2025-08-29 14:52:35 +08:00
|
|
|
where user_name = #{userName}
|
2025-08-21 18:28:42 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getWarningLastDayList" resultType="com.bonus.material.warningAnalysis.domain.UseMaintenanceWarningBean">
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
proId as projectId,
|
|
|
|
|
deptId,
|
|
|
|
|
projectName,
|
|
|
|
|
GROUP_CONCAT(DISTINCT typeName) as typeName ,
|
|
|
|
|
COUNT(DISTINCT maId) as warnNum
|
|
|
|
|
FROM
|
|
|
|
|
(
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
bp.external_id as proId,
|
|
|
|
|
bp.imp_unit as deptId,
|
|
|
|
|
mm.ma_id as maId,
|
|
|
|
|
mm.next_check_time as nextCheckTime,
|
|
|
|
|
mt3.type_name as materialType,
|
|
|
|
|
mt2.type_name as typeName,
|
|
|
|
|
mt.type_name as typeModelName,
|
|
|
|
|
mm.ma_code as maCode,
|
|
|
|
|
bu.unit_name as unitName,
|
|
|
|
|
bp.pro_name as projectName,
|
|
|
|
|
DATEDIFF(mm.next_check_time, CURDATE()) AS overDays
|
|
|
|
|
FROM
|
|
|
|
|
ma_machine mm
|
|
|
|
|
LEFT JOIN ma_type mt on mt.type_id=mm.type_id
|
|
|
|
|
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
|
|
|
|
|
LEFT JOIN ma_type mt3 on mt3.type_id=mt2.parent_id
|
|
|
|
|
LEFT JOIN ma_type mt4 on mt4.type_id=mt3.parent_id
|
|
|
|
|
LEFT JOIN slt_agreement_info sai on sai.ma_id=mm.ma_id and mm.type_id=sai.type_id
|
|
|
|
|
LEFT JOIN bm_agreement_info bai on bai.agreement_id=sai.agreement_id
|
|
|
|
|
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
|
|
|
|
AND bu.del_flag = '0'
|
|
|
|
|
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
|
|
|
|
AND bp.del_flag = '0'
|
|
|
|
|
LEFT JOIN sys_dept sd on sd.dept_id = bp.imp_unit
|
|
|
|
|
WHERE
|
|
|
|
|
sai.`status` = 0 and sai.is_slt = 0 and
|
|
|
|
|
mm.ma_status='2'
|
|
|
|
|
and bp.external_id is not null
|
|
|
|
|
AND mt.jiju_type =2
|
|
|
|
|
AND mm.next_check_time BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 15 day)
|
|
|
|
|
) res
|
|
|
|
|
GROUP BY proId
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getUserManger" resultType="com.bonus.material.warningAnalysis.domain.UseMaintenanceWarningBean">
|
|
|
|
|
SELECT
|
2025-08-29 14:52:35 +08:00
|
|
|
su.user_id as userId,
|
|
|
|
|
su.user_name as userName
|
2025-08-21 18:28:42 +08:00
|
|
|
FROM
|
|
|
|
|
sys_user su
|
|
|
|
|
LEFT JOIN sys_user_role sr on su.user_id = sr.user_id
|
|
|
|
|
WHERE sr.role_id in (59,81) and dept_id =#{deptId}
|
|
|
|
|
</select>
|
2025-08-30 22:42:04 +08:00
|
|
|
|
|
|
|
|
<select id="getOverTimeListList" resultType="com.bonus.material.warningAnalysis.domain.UseMaintenanceWarningBean">
|
|
|
|
|
SELECT
|
|
|
|
|
mm.ma_id as maId,
|
|
|
|
|
mm.next_check_time as nextCheckTime,
|
|
|
|
|
mt3.type_name as materialType,
|
|
|
|
|
mt2.type_name as typeName,
|
|
|
|
|
mt.type_name as typeModelName,
|
|
|
|
|
mm.ma_code as maCode,
|
|
|
|
|
bu.unit_name as unitName,
|
|
|
|
|
bp.pro_name as projectName,
|
|
|
|
|
bai.agreement_code as agreementCode,
|
|
|
|
|
DATEDIFF(mm.next_check_time, CURDATE()) AS overDays,
|
|
|
|
|
sd.dept_name as impUnit
|
|
|
|
|
FROM
|
|
|
|
|
ma_machine mm
|
|
|
|
|
LEFT JOIN ma_type mt on mt.type_id=mm.type_id
|
|
|
|
|
LEFT JOIN ma_type mt2 on mt2.type_id=mt.parent_id
|
|
|
|
|
LEFT JOIN ma_type mt3 on mt3.type_id=mt2.parent_id
|
|
|
|
|
LEFT JOIN ma_type mt4 on mt4.type_id=mt3.parent_id
|
|
|
|
|
LEFT JOIN slt_agreement_info sai on sai.ma_id=mm.ma_id and mm.type_id=sai.type_id and sai.`status`='0' and
|
|
|
|
|
sai.end_time is null
|
|
|
|
|
LEFT JOIN bm_agreement_info bai on bai.agreement_id=sai.agreement_id
|
|
|
|
|
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
|
|
|
|
AND bu.del_flag = '0'
|
|
|
|
|
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
|
|
|
|
AND bp.del_flag = '0'
|
|
|
|
|
LEFT JOIN sys_dept sd on sd.dept_id = bp.imp_unit
|
|
|
|
|
WHERE
|
|
|
|
|
mm.ma_status='2' and sai.is_slt = 0
|
|
|
|
|
AND bp.pro_name is not null
|
2025-08-31 18:24:23 +08:00
|
|
|
AND mt.jiju_type = 2
|
2025-08-30 22:42:04 +08:00
|
|
|
AND mm.next_check_time <= CURDATE()
|
|
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
|
|
and (
|
|
|
|
|
mt4.type_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
mt3.type_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
mt2.type_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
mt.type_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
mm.ma_code like concat('%', #{keyWord}, '%') or
|
|
|
|
|
bu.unit_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
bp.pro_name like concat('%', #{keyWord}, '%') or
|
|
|
|
|
bai.agreement_code like concat('%', #{keyWord}, '%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
AND DATE_FORMAT( mm.next_check_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="typeId != null">
|
|
|
|
|
AND mt.type_id = #{typeId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="thirdTypeId != null">
|
|
|
|
|
AND mt2.type_id = #{thirdTypeId}
|
|
|
|
|
</if>
|
|
|
|
|
ORDER BY mm.next_check_time ASC
|
|
|
|
|
</select>
|
2025-08-21 18:28:42 +08:00
|
|
|
</mapper>
|