zhangherong
6 天以前 d6372da6f37778e90a4bae02865e8ec77e980b6e
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?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.EamInspectionOrderMapper">
 
    <select id="queryPageList" resultType="org.jeecg.modules.eam.entity.EamInspectionOrder">
        select wmo.*, e.equipment_code, e.equipment_name, e.equipment_model
        from eam_inspection_order wmo
        inner join eam_equipment e
        on wmo.equipment_id = e.id
        ${ew.customSqlSegment}
    </select>
 
    <select id="findInsOrderBaseInfo" resultType="org.jeecg.modules.eam.request.EamInspectionOrderBaseResponse">
        SELECT TOP 1
            t2.equipment_name equipmentName,
            t2.equipment_code equipmentCode,
            t2.equipment_model equipmentModel,
            t2.factory_org_code factoryName,
            DATEPART( YEAR, t1.inspection_date ) AS inspectionYear,
            DATEPART( MONTH, t1.inspection_date ) AS inspectionMonth,
            t1.hf_code hfCode
        FROM
            eam_inspection_order t1
                LEFT JOIN eam_equipment t2 ON t1.equipment_id = t2.id
        WHERE
            t2.equipment_code = #{equipmentCode}
          AND t1.inspection_date LIKE CONCAT(#{inspectionDate},'%')
          AND t1.inspection_status = 'COMPLETE'
        ORDER BY
            t1.inspection_date DESC
    </select>
 
    <select id="findInsOrderDetailList" resultType="org.jeecg.modules.eam.request.EamInsOrderDetailResultResponse">
        SELECT
            t1.inspection_date inspectionDate,
            t2.item_code item_code,
            t2.item_name item_name,
            t2.item_demand item_demand,
            t2.inspection_result inspection_result
        FROM
            eam_inspection_order t1
                LEFT JOIN eam_inspection_order_detail t2 ON t1.id = t2.order_id
                LEFT JOIN eam_equipment t3 ON t1.equipment_id = t3.id
        WHERE
            t3.equipment_code = #{equipmentCode}
            AND t1.inspection_date LIKE CONCAT(#{inspectionDate},'%')
            AND t1.inspection_status = 'COMPLETE'
        GROUP BY
            t1.inspection_date,
            t2.item_code,
            t2.item_name,
            t2.item_demand,
            t2.inspection_result
        ORDER BY
            t1.inspection_date ASC
    </select>
 
    <select id="findInspectionOrderDetailUserList" resultType="org.jeecg.modules.eam.request.EamInsOrderDetailUserResponse">
        SELECT
            t1.inspection_date inspectionDate,
            t1.operator,
            t1.confirm_user confirmUser
        FROM
            eam_inspection_order t1
            LEFT JOIN eam_equipment t2 ON t1.equipment_id = t2.id
        WHERE
            t2.equipment_code = #{equipmentCode}
            AND t1.inspection_date LIKE CONCAT(#{inspectionDate},'%')
            AND t1.inspection_status = 'COMPLETE'
        GROUP BY
            t1.inspection_date,
            t1.operator,
            t1.confirm_user
        ORDER BY
            t1.inspection_date ASC
    </select>
 
    <select id="findWeekInsDetailList" resultType="org.jeecg.modules.eam.request.EamWeekInsDetailResultResponse">
        SELECT
            t1.plan_inspection_date,
            t1.item_code,
            t1.item_name,
            t1.item_demand,
            t1.inspection_result
 
        FROM
            eam_week_inspection_detail t1
                LEFT JOIN eam_equipment t2 ON t1.equipment_id = t2.id
                LEFT JOIN eam_inspection_order t3 ON t3.inspection_date = t1.plan_inspection_date
                AND t3.equipment_id = t1.equipment_id
        WHERE
            t2.equipment_code = #{equipmentCode}
            AND t3.inspection_date LIKE CONCAT(#{inspectionDate},'%')
            AND t3.inspection_status = 'COMPLETE'
        GROUP BY
            t1.plan_inspection_date,
            t1.item_code,
            t1.item_name,
            t1.item_demand,
            t1.inspection_result
        ORDER BY
            t1.plan_inspection_date ASC
    </select>
 
    <select id="findWeekInsOrderDetailUserList" resultType="org.jeecg.modules.eam.request.EamWeekInsDetailUserResponse">
        SELECT
            t1.plan_inspection_date,
            t1.inspector,
            t3.confirm_user
        FROM
            eam_week_inspection_detail t1
                LEFT JOIN eam_equipment t2 ON t1.equipment_id = t2.id
                LEFT JOIN eam_inspection_order t3 ON t3.inspection_date = t1.plan_inspection_date
                AND t3.equipment_id = t1.equipment_id
                AND t1.inspector IS NOT NULL
        WHERE
            t2.equipment_code = #{equipmentCode}
            AND t3.inspection_date LIKE CONCAT(#{inspectionDate},'%')
            AND t3.inspection_status = 'COMPLETE'
        GROUP BY
            t1.plan_inspection_date,
            t1.inspector,
            t3.confirm_user
        ORDER BY
            t1.plan_inspection_date ASC
    </select>
 
</mapper>