<?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="org.jeecg.modules.eam.mapper.EamEquipmentMapper">
|
|
<select id="getResumeUseRecordList" parameterType="Map" resultType="Map">
|
SELECT DISTINCT
|
t1.id,
|
t1.num,
|
'设备领借' AS 'type',
|
t3.item_text AS businessType,
|
t1.create_time AS createTime,
|
t1.create_by AS createBy
|
FROM
|
mom_eam_equipment_unloading t1
|
LEFT JOIN mom_eam_equipment_unloading_borrow_detail t2 ON t1.id = t2.equipment_unloading_id
|
LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'business_type' ) t3 ON t3.item_value = t1.business_type
|
where t1.del_flag = '0' and t2.del_flag = '0' and t2.equipment_id = #{params.equipmentId}
|
|
UNION All
|
|
SELECT DISTINCT
|
t1.id,
|
t1.num,
|
'设备归还' AS 'type',
|
t3.item_text AS businessType,
|
t1.create_time AS createTime,
|
t1.create_by AS createBy
|
FROM
|
mom_eam_equipment_unloading t1
|
LEFT JOIN mom_eam_equipment_unloading_return_detail t2 ON t1.id = t2.equipment_unloading_id
|
LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'business_type' ) t3 ON t3.item_value = t1.business_type
|
where t1.del_flag = '0' and t2.del_flag = '0' and t2.equipment_id = #{params.equipmentId}
|
|
UNION All
|
|
SELECT DISTINCT
|
t1.id,
|
t1.num,
|
'设备调入' AS 'type',
|
'' as businessType,
|
t1.create_time AS createTime,
|
t1.create_by AS createBy
|
FROM
|
mom_eam_equipment_transfer t1
|
left join mom_eam_equipment_transfer_in_detail t2 on t1.id = t2.equipment_transfer_id
|
where t1.del_flag = '0' and t2.del_flag = '0' and t2.equipment_id = #{params.equipmentId}
|
|
UNION All
|
|
SELECT DISTINCT
|
t1.id,
|
t1.num,
|
'设备调出' AS 'type',
|
'' as businessType,
|
t1.create_time AS createTime,
|
t1.create_by AS createBy
|
FROM
|
mom_eam_equipment_transfer t1
|
left join mom_eam_equipment_transfer_out_detail t2 on t1.id = t2.equipment_transfer_id
|
where t1.del_flag = '0' and t2.del_flag = '0' and t2.equipment_id = #{params.equipmentId}
|
|
UNION All
|
|
SELECT DISTINCT
|
t1.id,
|
t1.num,
|
'设备变动' AS 'type',
|
'' as businessType,
|
t1.create_time AS createTime,
|
t1.create_by AS createBy
|
FROM
|
mom_eam_equipment_change t1
|
left join mom_eam_equipment_change_detail t2 on t1.id = t2.equipment_change_id
|
where t1.del_flag = '0' and t2.del_flag = '0' and t2.equipment_id = #{params.equipmentId}
|
</select>
|
|
<select id="getResumeInspectionRecordList" parameterType="Map" resultType="Map">
|
SELECT DISTINCT
|
t1.id,
|
'日常点检' as inspectionType,
|
t1.num,
|
t1.inspection_time as inspectionTime,
|
t3.name as teamName,
|
t4.realname as inspectionUserName,
|
t1.actual_end_time as actualEndTime
|
FROM
|
mom_eam_inspection_order t1
|
LEFT JOIN mom_eam_daily_inspection_standard t2 ON t1.inspection_standard_id = t2.id
|
left join mom_base_team t3 on t1.team_id = t3.id
|
left join sys_user t4 on t1.inspection_user_id = t4.id
|
left join mom_eam_inspection_cycle t5 on t1.inspection_cycle_id = t5.id
|
WHERE t1.del_flag = '0' and t2.del_flag= '0' and t5.del_flag= '0' and t2.equipment_id = #{params.equipmentId}
|
|
UNION All
|
|
SELECT DISTINCT
|
t1.id,
|
'专业点检' as inspectionType,
|
t1.num,
|
t1.inspection_time as inspectionTime,
|
t3.name as teamName,
|
t4.realname as inspectionUserName,
|
t1.plan_end_time as actualEndTime
|
FROM
|
mom_eam_specialty_inspection_order t1
|
LEFT JOIN mom_eam_specialty_inspection_order_detail t2 on t1.id = t2.specialty_inspection_order_id
|
left join sys_user t4 on t1.inspection_user_id = t4.id
|
left join mom_eam_specialty_inspection_plan t5 on t1.specialty_inspection_plan_id = t5.id
|
left join mom_base_team t3 on t5.team_id = t3.id
|
WHERE t1.del_flag = '0' and t2.del_flag= '0' and t5.del_flag= '0' and t2.equipment_id = #{params.equipmentId}
|
</select>
|
|
<select id="getResumeMaintenanceRecordList" parameterType="Map" resultType="Map">
|
SELECT DISTINCT
|
t1.id,
|
'日常保养' as maintenanceType,
|
t1.num,
|
t4.name as teamName,
|
t5.realname as maintenanceuserName,
|
t1.actual_start_time as actualStartTime,
|
t1.actual_end_time as actualEndTime
|
FROM
|
mom_eam_daily_maintenance_order t1
|
LEFT JOIN mom_eam_daily_maintenance_order_detail t2 ON t1.id = t2.daily_maintenance_order_id
|
left join mom_eam_equipment t3 on t1.equipment_id = t3.id
|
left join mom_base_team t4 on t3.team_id = t4.id
|
left join sys_user t5 on t5.id= t1.maintenance_user_id
|
WHERE t1.del_flag = '0' and t2.del_flag= '0' and t3.del_flag= '0' and t1.equipment_id = #{params.equipmentId}
|
|
UNION All
|
|
SELECT DISTINCT
|
t1.id,
|
'专业保养' AS maintenanceType,
|
t1.num,
|
t4.name as teamName,
|
t5.realname as maintenanceuserName,
|
t1.actual_start_time as actualStartTime,
|
t1.actual_end_time as actualEndTime
|
FROM
|
mom_eam_specialty_maintenance_order t1
|
left join mom_eam_specialty_maintenance_order_detail t2 on t1.id = t2.specialty_maintenance_order_id
|
left join mom_eam_equipment t3 on t2.equipment_id = t3.id
|
left join mom_base_team t4 on t3.team_id = t4.id
|
left join sys_user t5 on t5.id= t1.maintenance_user_id
|
WHERE t1.del_flag = '0' and t2.del_flag= '0' and t3.del_flag= '0' and t2.equipment_id = #{params.equipmentId}
|
</select>
|
|
<select id="getResumeRepairRecordList" parameterType="Map" resultType="Map">
|
SELECT
|
t1.id,
|
t1.num,
|
t1.fault_description as faultDescription,
|
t1.fault_time as faultTime,
|
t2.item_text as maintenanceMethodName,
|
t3.name as teamName,
|
t4.realname as recipientuserName,
|
t1.actual_hour as actualHour,
|
t1.actual_start_time AS actualStartTime,
|
t1.actual_end_time as actualEndTime
|
FROM
|
mom_eam_repair_order t1
|
LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'maintenance_method' ) t2 ON t2.item_value = t1.maintenance_method
|
left join mom_base_team t3 on t1.team_id = t3.id
|
left join sys_user t4 on t1.recipient_user_id = t4.id
|
WHERE t1.del_flag = '0' and t4.del_flag= '0' and t3.del_flag= '0' and t1.equipment_id = #{params.equipmentId}
|
</select>
|
|
<select id="getResumeCalibrationRecordList" parameterType="Map" resultType="Map">
|
SELECT
|
t1.id,
|
t1.num,
|
t2.item_text as calibrationTypeName,
|
t3.realname as calibrationUserName,
|
t1.calibration_time as calibrationTime,
|
t1.management_mode as managementMode,
|
t1.status
|
FROM
|
mom_eam_calibration_order t1
|
LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'calibration_type' ) t2 ON t2.item_value = t1.calibration_type
|
left join sys_user t3 on t1.calibration_user_id = t3.id
|
WHERE t1.del_flag = '0' and t3.del_flag= '0' and t1.equipment_id = #{params.equipmentId}
|
</select>
|
|
<select id="getResumeChangeRecordList" parameterType="Map" resultType="Map">
|
SELECT
|
t1.id,
|
t1.num,
|
(case t1.change_method when 'seal' then '设备封存' when 'unseal' then '设备启封' when 'scrap' then '设备报废' else '设备处置' end) as changeMethod,
|
t1.create_by as createBy,
|
t1.create_time as createTime
|
FROM
|
mom_eam_equipment_change t1
|
LEFT JOIN mom_eam_equipment_seal_detail t2 ON t1.id = t2.equipment_change_id
|
LEFT JOIN mom_eam_equipment_disposal_detail t3 ON t1.id = t3.equipment_change_id
|
LEFT JOIN mom_eam_equipment_unseal_detail t4 ON t1.id = t4.equipment_change_id
|
LEFT JOIN mom_eam_equipment_scrap_detail t5 ON t1.id = t5.equipment_change_id
|
where t1.del_flag = '0' and (t2.equipment_id = #{params.equipmentId} or t3.equipment_id = #{params.equipmentId} or t4.equipment_id = #{params.equipmentId} or t5.equipment_id = #{params.equipmentId})
|
</select>
|
</mapper>
|