cuijian
2023-08-19 bdd0875d4b13a3f1ef472f64d4b6a95e0ef64b22
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?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.SpecialtyInspectionOrderDetailMapper">
 
    <select id="getEquipmentTotalByOrderId"  parameterType="Map" resultType="Map">
        SELECT DISTINCT
            equipment_id AS equipmentId,
            t2.num AS equipmentNum,
            t2.NAME AS equipmentName,
            t2.model AS equipmentModel
        FROM
            mom_eam_specialty_inspection_order_detail t1
        LEFT JOIN mom_eam_equipment t2 ON t1.equipment_id = t2.id
        WHERE t1.del_flag = 0 and t2.del_flag = 0 and t1.specialty_inspection_order_id = #{params.specialtyInspectionOrderId}
    </select>
 
    <select id="getSpecialtyInspectionOrderDetailList"  parameterType="Map" resultType="Map">
        SELECT
            t1.id,
            t1.specialty_inspection_order_id as specialtyInspectionOrderId,
            t1.specialty_inspection_standard_detail_id as specialtyInspectionStandardDetailId,
            t1.inspection_project_id as inspectionProjectId,
            t2.name as inspectionProjectName,
            t1.location,
            t1.photo,
            t1.detection_standard as detectionStandard,
            t1.acceptability_limit as acceptabilityLimit,
            t1.inspection_method AS inspectionMethod,
            t1.analysis_method as analysisMethod,
            t6.item_text as inspectionMethodName,
            t1.inspection_tool AS inspectionTool,
            t1.treatment_measure as treatmentMeasure,
            t1.inspection_project_result AS inspectionProjectResult,
            t1.judgment_result as judgmentResult,
            t1.abnormal_desc as abnormalDesc,
            t1.abnormal_photo as abnormalPhoto,
            t7.`status`
        FROM
            mom_eam_specialty_inspection_order_detail t1
        LEFT JOIN mom_eam_inspection_project t2 on t1.inspection_project_id = t2.id
        left join mom_eam_equipment t3  on t1.equipment_id = t3.id
        left join mom_eam_specialty_inspection_standard_detail t4 on t1.specialty_inspection_standard_detail_id = t4.id
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'inspection_method' ) t6 ON t6.item_value = t2.inspection_method
        left join mom_eam_specialty_inspection_order t7 on t1.specialty_inspection_order_id = t7.id
        WHERE t1.del_flag = 0 and t2.del_flag = 0 and t3.del_flag = 0
        <if test="params.specialtyInspectionOrderId != null and params.specialtyInspectionOrderId != ''">
            and t1.specialty_inspection_order_id = #{params.specialtyInspectionOrderId}
        </if>
        <if test="params.equipmentId != null and params.equipmentId != ''">
            and t1.equipment_id = #{params.equipmentId}
        </if>
        <if test="params.inspectionCycleId != null and params.inspectionCycleId != ''">
            and t4.inspection_cycle_id = #{params.inspectionCycleId}
        </if>
        ORDER BY t1.create_time desc
    </select>
</mapper>