qushaowei
2023-08-31 ff165658b255893c80cef7f441e4764b88d00fc4
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml
@@ -6,38 +6,7 @@
        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
@@ -45,13 +14,12 @@
        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
        UNION
        SELECT DISTINCT
            t1.id,
            t1.num,
            '设备调出' AS 'type',
            '' as  businessType,
            t1.create_time AS createTime,
            t1.create_by AS createBy
        FROM
@@ -59,13 +27,12 @@
        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
        UNION
        SELECT DISTINCT
            t1.id,
            t1.num,
            '设备变动' AS 'type',
            '' as  businessType,
            t1.create_time AS createTime,
            t1.create_by AS createBy
        FROM
@@ -89,25 +56,8 @@
        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}
        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">
@@ -127,7 +77,7 @@
        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
        UNION
        SELECT DISTINCT
            t1.id,