lyh
4 小时以前 fb5aa087eaf6a68cf7ea8114beb270551016e7dd
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
<?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.mdc.mapper.AndonOrderMapper">
 
    <select id="equAndonList" resultType="org.jeecg.modules.mdc.entity.AndonOrder">
        SELECT
            *
        FROM
            andon_order
        WHERE
            CONVERT ( DATE, create_time ) = CONVERT ( DATE, GETDATE( ) )
          AND equipment_id IN
        <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
        ORDER BY
            create_time
    </select>
    <select id="untreatedAndonList" resultType="org.jeecg.modules.mdc.entity.AndonOrder">
        SELECT
            ao.*
        FROM
          andon_order ao
          INNER JOIN (
            SELECT
              equipment_id,
              MAX(create_time) AS max_create_time
            FROM
              andon_order
            WHERE order_status = 1
            GROUP BY
          equipment_id) AS latest ON ao.equipment_id = latest.equipment_id
          AND ao.create_time = latest.max_create_time
        WHERE order_status = 1
        ORDER BY
            ao.create_time
    </select>
    <select id="pageList" resultType="org.jeecg.modules.mdc.entity.AndonOrder">
        SELECT
            id,
            equipment_id,
            andon_type,
            operator,
            operate_time,
            responder,
            response_time,
            processor,
            process_time,
            order_status,
            problem_descreption,
            resolution_descreption,
            image_files,
            del_flag,
            create_by,
            create_time,
            update_by,
            update_time,
            call_reason,
            plant_name
        FROM
            andon_order
        WHERE
            del_flag = 0
          AND (operator = #{userId} OR responder = #{userId} OR processor = #{userId})
        <if test="andonOrder.equipmentId != null and andonOrder.equipmentId != '' ">
            AND equipment_id LIKE CONCAT(CONCAT('%',#{andonOrder.equipmentId}),'%')
        </if>
        <if test="andonOrder.andonType != null and andonOrder.andonType != '' ">
            AND andon_type = #{andonOrder.andonType}
        </if>
        <if test="andonOrder.orderStatus != null and andonOrder.orderStatus != '' ">
            AND order_status = #{andonOrder.orderStatus}
        </if>
 
    </select>
</mapper>