cl
2024-07-03 5b755f09d9ffba5f6c67a5894f3887340cccb31c
提交 | 用户 | 时间
0ca254 1 <?xml version="1.0" encoding="UTF-8" ?>
A 2 <!DOCTYPE mapper
3 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 <mapper namespace="com.jcdm.main.em.inspectionPlanItems.mapper.EmInspectionPlanItemsMapper">
6     
7     <resultMap type="EmInspectionPlanItems" id="EmInspectionPlanItemsResult">
8         <result property="id"    column="id"    />
9         <result property="itemsCode"    column="items_code"    />
10         <result property="itemsName"    column="items_name"    />
11         <result property="itemsType"    column="items_type"    />
12         <result property="standard"    column="standard"    />
13         <result property="itemsContent"    column="items_content"    />
14         <result property="createUser"    column="create_user"    />
15         <result property="createTime"    column="create_time"    />
16         <result property="updateUser"    column="update_user"    />
17         <result property="updateTime"    column="update_time"    />
18         <result property="spareField1"    column="spare_field_1"    />
19         <result property="spareField2"    column="spare_field_2"    />
20         <result property="planCode"    column="plan_code"    />
21     </resultMap>
22
23     <sql id="selectEmInspectionPlanItemsVo">
24         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
25     </sql>
26
27     <select id="selectEmInspectionPlanItemsList" parameterType="EmInspectionPlanItems" resultMap="EmInspectionPlanItemsResult">
28         <include refid="selectEmInspectionPlanItemsVo"/>
29         <where>  
30             <if test="itemsCode != null  and itemsCode != ''"> and items_code = #{itemsCode}</if>
31             <if test="itemsName != null  and itemsName != ''"> and items_name like concat('%', #{itemsName}, '%')</if>
32             <if test="itemsType != null  and itemsType != ''"> and items_type = #{itemsType}</if>
33             <if test="standard != null  and standard != ''"> and standard = #{standard}</if>
34             <if test="itemsContent != null  and itemsContent != ''"> and items_content = #{itemsContent}</if>
35             <if test="createUser != null  and createUser != ''"> and create_user = #{createUser}</if>
36             <if test="updateUser != null  and updateUser != ''"> and update_user = #{updateUser}</if>
37             <if test="spareField1 != null  and spareField1 != ''"> and spare_field_1 = #{spareField1}</if>
38             <if test="spareField2 != null  and spareField2 != ''"> and spare_field_2 = #{spareField2}</if>
39             <if test="planCode != null  and planCode != ''"> and plan_code = #{planCode}</if>
40         </where>
41     </select>
42     
43     <select id="selectEmInspectionPlanItemsById" parameterType="Long" resultMap="EmInspectionPlanItemsResult">
44         <include refid="selectEmInspectionPlanItemsVo"/>
45         where id = #{id}
46     </select>
47         
48     <insert id="insertEmInspectionPlanItems" parameterType="EmInspectionPlanItems" useGeneratedKeys="true" keyProperty="id">
49         insert into em_inspection_plan_items
50         <trim prefix="(" suffix=")" suffixOverrides=",">
51             <if test="itemsCode != null">items_code,</if>
52             <if test="itemsName != null">items_name,</if>
53             <if test="itemsType != null">items_type,</if>
54             <if test="standard != null">standard,</if>
55             <if test="itemsContent != null">items_content,</if>
56             <if test="createUser != null">create_user,</if>
57             <if test="createTime != null">create_time,</if>
58             <if test="updateUser != null">update_user,</if>
59             <if test="updateTime != null">update_time,</if>
60             <if test="spareField1 != null">spare_field_1,</if>
61             <if test="spareField2 != null">spare_field_2,</if>
62             <if test="planCode != null">plan_code,</if>
63          </trim>
64         <trim prefix="values (" suffix=")" suffixOverrides=",">
65             <if test="itemsCode != null">#{itemsCode},</if>
66             <if test="itemsName != null">#{itemsName},</if>
67             <if test="itemsType != null">#{itemsType},</if>
68             <if test="standard != null">#{standard},</if>
69             <if test="itemsContent != null">#{itemsContent},</if>
70             <if test="createUser != null">#{createUser},</if>
71             <if test="createTime != null">#{createTime},</if>
72             <if test="updateUser != null">#{updateUser},</if>
73             <if test="updateTime != null">#{updateTime},</if>
74             <if test="spareField1 != null">#{spareField1},</if>
75             <if test="spareField2 != null">#{spareField2},</if>
76             <if test="planCode != null">#{planCode},</if>
77          </trim>
78     </insert>
79
80     <update id="updateEmInspectionPlanItems" parameterType="EmInspectionPlanItems">
81         update em_inspection_plan_items
82         <trim prefix="SET" suffixOverrides=",">
83             <if test="itemsCode != null">items_code = #{itemsCode},</if>
84             <if test="itemsName != null">items_name = #{itemsName},</if>
85             <if test="itemsType != null">items_type = #{itemsType},</if>
86             <if test="standard != null">standard = #{standard},</if>
87             <if test="itemsContent != null">items_content = #{itemsContent},</if>
88             <if test="createUser != null">create_user = #{createUser},</if>
89             <if test="createTime != null">create_time = #{createTime},</if>
90             <if test="updateUser != null">update_user = #{updateUser},</if>
91             <if test="updateTime != null">update_time = #{updateTime},</if>
92             <if test="spareField1 != null">spare_field_1 = #{spareField1},</if>
93             <if test="spareField2 != null">spare_field_2 = #{spareField2},</if>
94             <if test="planCode != null">plan_code = #{planCode},</if>
95         </trim>
96         where id = #{id}
97     </update>
98
99     <delete id="deleteEmInspectionPlanItemsById" parameterType="Long">
100         delete from em_inspection_plan_items where id = #{id}
101     </delete>
102
103     <delete id="deleteEmInspectionPlanItemsByIds" parameterType="String">
104         delete from em_inspection_plan_items where id in 
105         <foreach item="id" collection="array" open="(" separator="," close=")">
106             #{id}
107         </foreach>
108     </delete>
109 </mapper>