lyh
昨天 d61b21c50e62298f185ecafa8e0b22f7ee8c4973
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?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,f.process_instance_id as 'procInstId',
               f.process_definition_key,
               f.process_definition_id,
               f.process_instance_id
        from eam_inspection_order wmo
        inner join eam_equipment e
        on wmo.equipment_id = e.id
        left join flow_my_business f on f.data_id=wmo.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>
    <select id="queryList" resultType="org.jeecg.modules.eam.dto.EamInspectionOrderExport">
        SELECT
            t2.equipment_name equipmentName,
            t2.equipment_code equipmentCode,
            t2.equipment_model equipmentModel,
            SUBSTRING(t2.factory_org_code,1,6) 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
            1=1
          <if test="ids != null and ids.size() > 0">
            AND t1.id IN
              <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
                #{id}
            </foreach>
          </if>
          AND t1.inspection_status = 'COMPLETE'
        GROUP BY
        t2.equipment_name,
        t2.equipment_code,
        t2.equipment_model ,
        t2.factory_org_code ,
        DATEPART( YEAR, t1.inspection_date ),
        DATEPART( MONTH, t1.inspection_date ),
        t1.hf_code
    </select>
 
</mapper>