cl
2024-07-03 5b755f09d9ffba5f6c67a5894f3887340cccb31c
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
<?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.inspectionPlanItems.mapper.EmInspectionPlanItemsMapper">
    
    <resultMap type="EmInspectionPlanItems" id="EmInspectionPlanItemsResult">
        <result property="id"    column="id"    />
        <result property="itemsCode"    column="items_code"    />
        <result property="itemsName"    column="items_name"    />
        <result property="itemsType"    column="items_type"    />
        <result property="standard"    column="standard"    />
        <result property="itemsContent"    column="items_content"    />
        <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="planCode"    column="plan_code"    />
    </resultMap>
 
    <sql id="selectEmInspectionPlanItemsVo">
        select id, items_code, items_name, items_type, standard, items_content, create_user, create_time, update_user, update_time, spare_field_1, spare_field_2, plan_code from em_inspection_plan_items
    </sql>
 
    <select id="selectEmInspectionPlanItemsList" parameterType="EmInspectionPlanItems" resultMap="EmInspectionPlanItemsResult">
        <include refid="selectEmInspectionPlanItemsVo"/>
        <where>  
            <if test="itemsCode != null  and itemsCode != ''"> and items_code = #{itemsCode}</if>
            <if test="itemsName != null  and itemsName != ''"> and items_name like concat('%', #{itemsName}, '%')</if>
            <if test="itemsType != null  and itemsType != ''"> and items_type = #{itemsType}</if>
            <if test="standard != null  and standard != ''"> and standard = #{standard}</if>
            <if test="itemsContent != null  and itemsContent != ''"> and items_content = #{itemsContent}</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="planCode != null  and planCode != ''"> and plan_code = #{planCode}</if>
        </where>
    </select>
    
    <select id="selectEmInspectionPlanItemsById" parameterType="Long" resultMap="EmInspectionPlanItemsResult">
        <include refid="selectEmInspectionPlanItemsVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertEmInspectionPlanItems" parameterType="EmInspectionPlanItems" useGeneratedKeys="true" keyProperty="id">
        insert into em_inspection_plan_items
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="itemsCode != null">items_code,</if>
            <if test="itemsName != null">items_name,</if>
            <if test="itemsType != null">items_type,</if>
            <if test="standard != null">standard,</if>
            <if test="itemsContent != null">items_content,</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="planCode != null">plan_code,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="itemsCode != null">#{itemsCode},</if>
            <if test="itemsName != null">#{itemsName},</if>
            <if test="itemsType != null">#{itemsType},</if>
            <if test="standard != null">#{standard},</if>
            <if test="itemsContent != null">#{itemsContent},</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="planCode != null">#{planCode},</if>
         </trim>
    </insert>
 
    <update id="updateEmInspectionPlanItems" parameterType="EmInspectionPlanItems">
        update em_inspection_plan_items
        <trim prefix="SET" suffixOverrides=",">
            <if test="itemsCode != null">items_code = #{itemsCode},</if>
            <if test="itemsName != null">items_name = #{itemsName},</if>
            <if test="itemsType != null">items_type = #{itemsType},</if>
            <if test="standard != null">standard = #{standard},</if>
            <if test="itemsContent != null">items_content = #{itemsContent},</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="planCode != null">plan_code = #{planCode},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteEmInspectionPlanItemsById" parameterType="Long">
        delete from em_inspection_plan_items where id = #{id}
    </delete>
 
    <delete id="deleteEmInspectionPlanItemsByIds" parameterType="String">
        delete from em_inspection_plan_items where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>