-
admin
2024-06-05 16714e1a824acd878b105e6ac433866cfc50ed89
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
<?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="com.jcdm.main.em.equipmentAlarm.mapper.EmEquipmentAlarmMapper">
 
    <resultMap type="EmEquipmentAlarm" id="EmEquipmentAlarmResult">
        <result property="id"    column="id"    />
        <result property="equipmentCode"    column="equipment_code"    />
        <result property="equipmentName"    column="equipment_name"    />
        <result property="equipmentType"    column="equipment_type"    />
        <result property="workshopCode"    column="workshop_code"    />
        <result property="lineCode"    column="line_code"    />
        <result property="processesCode"    column="processes_code"    />
        <result property="errorNo"    column="error_no"    />
        <result property="errorDesc"    column="error_desc"    />
        <result property="alarmTime"    column="alarm_time"    />
        <result property="whetherRecovery"    column="whether_recovery"    />
        <result property="recoveryTime"    column="recovery_time"    />
        <result property="spareField1"    column="spare_field_1"    />
        <result property="spareField2"    column="spare_field_2"    />
        <result property="spareField3"    column="spare_field_3"    />
        <result property="spareField4"    column="spare_field_4"    />
        <result property="remarks"    column="remarks"    />
    </resultMap>
 
    <sql id="selectEmEquipmentAlarmVo">
        select id, equipment_code, equipment_name, equipment_type, workshop_code, line_code, processes_code, error_no, error_desc, alarm_time, whether_recovery, recovery_time, spare_field_1, spare_field_2, spare_field_3, spare_field_4, remarks from em_equipment_alarm
    </sql>
 
    <select id="selectEmEquipmentAlarmList" parameterType="EmEquipmentAlarm" resultMap="EmEquipmentAlarmResult">
        <include refid="selectEmEquipmentAlarmVo"/>
        <where>  
            <if test="equipmentCode != null  and equipmentCode != ''"> and equipment_code like concat('%', #{equipmentCode}, '%')</if>
            <if test="equipmentName != null  and equipmentName != ''"> and equipment_name like concat('%', #{equipmentName}, '%')</if>
            <if test="equipmentType != null  and equipmentType != ''"> and equipment_type = #{equipmentType}</if>
            <if test="errorNo != null  and errorNo != ''"> and error_no = #{errorNo}</if>
        </where>
    </select>
    
    <select id="selectEmEquipmentAlarmById" parameterType="Long" resultMap="EmEquipmentAlarmResult">
        <include refid="selectEmEquipmentAlarmVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertEmEquipmentAlarm" parameterType="EmEquipmentAlarm">
        insert into em_equipment_alarm
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="equipmentCode != null and equipmentCode != ''">equipment_code,</if>
            <if test="equipmentName != null and equipmentName != ''">equipment_name,</if>
            <if test="equipmentType != null and equipmentType != ''">equipment_type,</if>
            <if test="workshopCode != null">workshop_code,</if>
            <if test="lineCode != null">line_code,</if>
            <if test="processesCode != null and processesCode != ''">processes_code,</if>
            <if test="errorNo != null and errorNo != ''">error_no,</if>
            <if test="errorDesc != null">error_desc,</if>
            <if test="alarmTime != null">alarm_time,</if>
            <if test="whetherRecovery != null">whether_recovery,</if>
            <if test="recoveryTime != null">recovery_time,</if>
            <if test="spareField1 != null">spare_field_1,</if>
            <if test="spareField2 != null">spare_field_2,</if>
            <if test="spareField3 != null">spare_field_3,</if>
            <if test="spareField4 != null">spare_field_4,</if>
            <if test="remarks != null">remarks,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="equipmentCode != null and equipmentCode != ''">#{equipmentCode},</if>
            <if test="equipmentName != null and equipmentName != ''">#{equipmentName},</if>
            <if test="equipmentType != null and equipmentType != ''">#{equipmentType},</if>
            <if test="workshopCode != null">#{workshopCode},</if>
            <if test="lineCode != null">#{lineCode},</if>
            <if test="processesCode != null and processesCode != ''">#{processesCode},</if>
            <if test="errorNo != null and errorNo != ''">#{errorNo},</if>
            <if test="errorDesc != null">#{errorDesc},</if>
            <if test="alarmTime != null">#{alarmTime},</if>
            <if test="whetherRecovery != null">#{whetherRecovery},</if>
            <if test="recoveryTime != null">#{recoveryTime},</if>
            <if test="spareField1 != null">#{spareField1},</if>
            <if test="spareField2 != null">#{spareField2},</if>
            <if test="spareField3 != null">#{spareField3},</if>
            <if test="spareField4 != null">#{spareField4},</if>
            <if test="remarks != null">#{remarks},</if>
         </trim>
    </insert>
 
    <update id="updateEmEquipmentAlarm" parameterType="EmEquipmentAlarm">
        update em_equipment_alarm
        <trim prefix="SET" suffixOverrides=",">
            <if test="equipmentCode != null and equipmentCode != ''">equipment_code = #{equipmentCode},</if>
            <if test="equipmentName != null and equipmentName != ''">equipment_name = #{equipmentName},</if>
            <if test="equipmentType != null and equipmentType != ''">equipment_type = #{equipmentType},</if>
            <if test="workshopCode != null">workshop_code = #{workshopCode},</if>
            <if test="lineCode != null">line_code = #{lineCode},</if>
            <if test="processesCode != null and processesCode != ''">processes_code = #{processesCode},</if>
            <if test="errorNo != null and errorNo != ''">error_no = #{errorNo},</if>
            <if test="errorDesc != null">error_desc = #{errorDesc},</if>
            <if test="alarmTime != null">alarm_time = #{alarmTime},</if>
            <if test="whetherRecovery != null">whether_recovery = #{whetherRecovery},</if>
            <if test="recoveryTime != null">recovery_time = #{recoveryTime},</if>
            <if test="spareField1 != null">spare_field_1 = #{spareField1},</if>
            <if test="spareField2 != null">spare_field_2 = #{spareField2},</if>
            <if test="spareField3 != null">spare_field_3 = #{spareField3},</if>
            <if test="spareField4 != null">spare_field_4 = #{spareField4},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteEmEquipmentAlarmById" parameterType="Long">
        delete from em_equipment_alarm where id = #{id}
    </delete>
 
    <delete id="deleteEmEquipmentAlarmByIds" parameterType="String">
        delete from em_equipment_alarm where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>