admin
2024-10-15 6d313a4a6f9f9d7ea65ec50ab0d4491e595edb97
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
<?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.equipmentArchives.mapper.EmEquipmentArchivesMapper">
    
    <resultMap type="EmEquipmentArchives" id="EmEquipmentArchivesResult">
        <result property="id"    column="id"    />
        <result property="equipmentCode"    column="equipment_code"    />
        <result property="equipmentName"    column="equipment_name"    />
        <result property="equipmentBrand"    column="equipment_brand"    />
        <result property="equipmentSpec"    column="equipment_spec"    />
        <result property="equipmentTypeId"    column="equipment_type_id"    />
        <result property="equipmentTypeCode"    column="equipment_type_code"    />
        <result property="equipmentTypeName"    column="equipment_type_name"    />
        <result property="workshopCode"    column="workshop_code"    />
        <result property="lineCode"    column="line_code"    />
        <result property="processesCode"    column="processes_code"    />
        <result property="processesName"    column="processes_name"    />
        <result property="status"    column="status"    />
        <result property="remark"    column="remark"    />
        <result property="createUser"    column="create_user"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateUser"    column="update_user"    />
        <result property="updateTime"    column="update_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"    />
    </resultMap>
 
    <sql id="selectEmEquipmentArchivesVo">
        select id, equipment_code, equipment_name, equipment_brand, equipment_spec, equipment_type_id, equipment_type_code, equipment_type_name, workshop_code, line_code, processes_code, processes_name , status, remark, create_user, create_time, update_user, update_time, spare_field_1, spare_field_2, spare_field_3, spare_field_4 from em_equipment_archives
    </sql>
 
    <select id="selectEmEquipmentArchivesList" parameterType="EmEquipmentArchives" resultMap="EmEquipmentArchivesResult">
        <include refid="selectEmEquipmentArchivesVo"/>
        <where>  
            <if test="equipmentCode != null  and equipmentCode != ''"> and equipment_code = #{equipmentCode}</if>
            <if test="equipmentName != null  and equipmentName != ''"> and equipment_name like concat('%', #{equipmentName}, '%')</if>
            <if test="equipmentBrand != null  and equipmentBrand != ''"> and equipment_brand = #{equipmentBrand}</if>
            <if test="equipmentSpec != null  and equipmentSpec != ''"> and equipment_spec = #{equipmentSpec}</if>
            <if test="equipmentTypeId != null "> and equipment_type_id = #{equipmentTypeId}</if>
            <if test="equipmentTypeCode != null  and equipmentTypeCode != ''"> and equipment_type_code = #{equipmentTypeCode}</if>
            <if test="equipmentTypeName != null  and equipmentTypeName != ''"> and equipment_type_name like concat('%', #{equipmentTypeName}, '%')</if>
            <if test="workshopCode != null  and workshopCode != ''"> and workshop_code = #{workshopCode}</if>
            <if test="lineCode != null  and lineCode != ''"> and line_code = #{lineCode}</if>
            <if test="processesName != null  and processesName != ''"> and processes_name like concat('%', #{processesName}, '%')</if>
            <if test="processesCode != null  and processesCode != ''"> and processes_code = #{processesCode}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="createUser != null  and createUser != ''"> and create_user = #{createUser}</if>
            <if test="updateUser != null  and updateUser != ''"> and update_user = #{updateUser}</if>
            <if test="spareField1 != null  and spareField1 != ''"> and spare_field_1 = #{spareField1}</if>
            <if test="spareField2 != null  and spareField2 != ''"> and spare_field_2 = #{spareField2}</if>
            <if test="spareField3 != null "> and spare_field_3 = #{spareField3}</if>
            <if test="spareField4 != null "> and spare_field_4 = #{spareField4}</if>
        </where>
    </select>
    
    <select id="selectEmEquipmentArchivesById" parameterType="Long" resultMap="EmEquipmentArchivesResult">
        <include refid="selectEmEquipmentArchivesVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertEmEquipmentArchives" parameterType="EmEquipmentArchives">
        insert into em_equipment_archives
        <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="equipmentBrand != null">equipment_brand,</if>
            <if test="equipmentSpec != null">equipment_spec,</if>
            <if test="equipmentTypeId != null">equipment_type_id,</if>
            <if test="equipmentTypeCode != null">equipment_type_code,</if>
            <if test="equipmentTypeName != null">equipment_type_name,</if>
            <if test="workshopCode != null">workshop_code,</if>
            <if test="lineCode != null">line_code,</if>
            <if test="processesName != null and processesName != ''">processes_name,</if>
            <if test="processesCode != null">processes_code,</if>
            <if test="status != null">status,</if>
            <if test="remark != null">remark,</if>
            <if test="createUser != null">create_user,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateUser != null">update_user,</if>
            <if test="updateTime != null">update_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>
         </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="equipmentBrand != null">#{equipmentBrand},</if>
            <if test="equipmentSpec != null">#{equipmentSpec},</if>
            <if test="equipmentTypeId != null">#{equipmentTypeId},</if>
            <if test="equipmentTypeCode != null">#{equipmentTypeCode},</if>
            <if test="equipmentTypeName != null">#{equipmentTypeName},</if>
            <if test="workshopCode != null">#{workshopCode},</if>
            <if test="lineCode != null">#{lineCode},</if>
            <if test="processesCode != null">#{processesCode},</if>
            <if test="processesName != null and processesName != ''">#{processesName},</if>
            <if test="status != null">#{status},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createUser != null">#{createUser},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateUser != null">#{updateUser},</if>
            <if test="updateTime != null">#{updateTime},</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>
         </trim>
    </insert>
 
    <update id="updateEmEquipmentArchives" parameterType="EmEquipmentArchives">
        update em_equipment_archives
        <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="equipmentBrand != null">equipment_brand = #{equipmentBrand},</if>
            <if test="equipmentSpec != null">equipment_spec = #{equipmentSpec},</if>
            <if test="equipmentTypeId != null">equipment_type_id = #{equipmentTypeId},</if>
            <if test="equipmentTypeCode != null">equipment_type_code = #{equipmentTypeCode},</if>
            <if test="equipmentTypeName != null">equipment_type_name = #{equipmentTypeName},</if>
            <if test="workshopCode != null">workshop_code = #{workshopCode},</if>
            <if test="lineCode != null">line_code = #{lineCode},</if>
            <if test="processesCode != null">processes_code = #{processesCode},</if>
            <if test="processesName != null and processesName != ''">processes_name = #{processesName},</if>
            <if test="status != null">status = #{status},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createUser != null">create_user = #{createUser},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateUser != null">update_user = #{updateUser},</if>
            <if test="updateTime != null">update_time = #{updateTime},</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>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteEmEquipmentArchivesById" parameterType="Long">
        delete from em_equipment_archives where id = #{id}
    </delete>
 
    <delete id="deleteEmEquipmentArchivesByIds" parameterType="String">
        delete from em_equipment_archives where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>