admin
2024-07-03 475e409e27c5f05b0dcf2be1063ce35700c51bf2
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
<?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.equipmentStatus.mapper.EmEquipmentStatusMapper">
    
    <resultMap type="EmEquipmentStatus" id="EmEquipmentStatusResult">
        <result property="id"    column="id"    />
        <result property="equipmentNo"    column="equipment_no"    />
        <result property="equipmentName"    column="equipment_name"    />
        <result property="workshopCode"    column="workshop_code"    />
        <result property="productionLineCode"    column="production_line_code"    />
        <result property="processesCode"    column="processes_code"    />
        <result property="eqStatus"    column="eq_status"    />
        <result property="spareField1"    column="spare_field_1"    />
        <result property="spareField2"    column="spare_field_2"    />
        <result property="remarks"    column="remarks"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>
 
    <sql id="selectEmEquipmentStatusVo">
        select id, equipment_no, equipment_name, workshop_code, production_line_code, processes_code, eq_status, spare_field_1, spare_field_2, remarks, update_time from em_equipment_status
    </sql>
 
    <select id="selectEmEquipmentStatusList" parameterType="EmEquipmentStatus" resultMap="EmEquipmentStatusResult">
        <include refid="selectEmEquipmentStatusVo"/>
        <where>  
            <if test="equipmentNo != null  and equipmentNo != ''"> and equipment_no like concat('%', #{equipmentNo}, '%')</if>
            <if test="equipmentName != null  and equipmentName != ''"> and equipment_name like concat('%', #{equipmentName}, '%')</if>
            <if test="workshopCode != null  and workshopCode != ''"> and workshop_code like concat('%', #{workshopCode}, '%')</if>
            <if test="productionLineCode != null  and productionLineCode != ''"> and production_line_code like concat('%', #{productionLineCode}, '%')</if>
            <if test="processesCode != null  and processesCode != ''"> and processes_code like concat('%', #{processesCode}, '%')</if>
            <if test="eqStatus != null  and eqStatus != ''"> and eq_status like concat('%', #{eqStatus}, '%')</if>
        </where>
    </select>
    
    <select id="selectEmEquipmentStatusById" parameterType="Long" resultMap="EmEquipmentStatusResult">
        <include refid="selectEmEquipmentStatusVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertEmEquipmentStatus" parameterType="EmEquipmentStatus">
        insert into em_equipment_status
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="equipmentNo != null">equipment_no,</if>
            <if test="equipmentName != null">equipment_name,</if>
            <if test="workshopCode != null">workshop_code,</if>
            <if test="productionLineCode != null">production_line_code,</if>
            <if test="processesCode != null">processes_code,</if>
            <if test="eqStatus != null">eq_status,</if>
            <if test="spareField1 != null">spare_field_1,</if>
            <if test="spareField2 != null">spare_field_2,</if>
            <if test="remarks != null">remarks,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="equipmentNo != null">#{equipmentNo},</if>
            <if test="equipmentName != null">#{equipmentName},</if>
            <if test="workshopCode != null">#{workshopCode},</if>
            <if test="productionLineCode != null">#{productionLineCode},</if>
            <if test="processesCode != null">#{processesCode},</if>
            <if test="eqStatus != null">#{eqStatus},</if>
            <if test="spareField1 != null">#{spareField1},</if>
            <if test="spareField2 != null">#{spareField2},</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>
 
    <update id="updateEmEquipmentStatus" parameterType="EmEquipmentStatus">
        update em_equipment_status
        <trim prefix="SET" suffixOverrides=",">
            <if test="equipmentNo != null">equipment_no = #{equipmentNo},</if>
            <if test="equipmentName != null">equipment_name = #{equipmentName},</if>
            <if test="workshopCode != null">workshop_code = #{workshopCode},</if>
            <if test="productionLineCode != null">production_line_code = #{productionLineCode},</if>
            <if test="processesCode != null">processes_code = #{processesCode},</if>
            <if test="eqStatus != null">eq_status = #{eqStatus},</if>
            <if test="spareField1 != null">spare_field_1 = #{spareField1},</if>
            <if test="spareField2 != null">spare_field_2 = #{spareField2},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteEmEquipmentStatusById" parameterType="Long">
        delete from em_equipment_status where id = #{id}
    </delete>
 
    <delete id="deleteEmEquipmentStatusByIds" parameterType="String">
        delete from em_equipment_status where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>