-
懒羊羊
2024-03-28 55a52ebc929a3ebf2e8dbae450c0c241abf7ff02
提交 | 用户 | 时间
38b150 1 <?xml version="1.0" encoding="UTF-8" ?>
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.inspectionItems.mapper.EmInspectionItemsMapper">
6     
7     <resultMap type="EmInspectionItems" id="EmInspectionItemsResult">
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="status"    column="status"    />
13         <result property="standard"    column="standard"    />
14         <result property="itemsContent"    column="items_content"    />
15         <result property="remark"    column="remark"    />
16         <result property="createUser"    column="create_user"    />
17         <result property="createTime"    column="create_time"    />
18         <result property="updateUser"    column="update_user"    />
19         <result property="updateTime"    column="update_time"    />
20         <result property="spareField1"    column="spare_field_1"    />
21         <result property="spareField2"    column="spare_field_2"    />
22     </resultMap>
23
24     <sql id="selectEmInspectionItemsVo">
25         select id, items_code, items_name, items_type, status, standard, items_content, remark, create_user, create_time, update_user, update_time, spare_field_1, spare_field_2 from em_inspection_items
26     </sql>
27
28     <select id="selectEmInspectionItemsList" parameterType="EmInspectionItems" resultMap="EmInspectionItemsResult">
29         <include refid="selectEmInspectionItemsVo"/>
30         <where>  
31             <if test="itemsCode != null  and itemsCode != ''"> and items_code like concat('%', #{itemsCode}, '%')</if>
32             <if test="itemsName != null  and itemsName != ''"> and items_name like concat('%', #{itemsName}, '%')</if>
33             <if test="itemsType != null  and itemsType != ''"> and items_type = #{itemsType}</if>
34             <if test="status != null  and status != ''"> and status = #{status}</if>
35         </where>
36     </select>
37     
38     <select id="selectEmInspectionItemsById" parameterType="Long" resultMap="EmInspectionItemsResult">
39         <include refid="selectEmInspectionItemsVo"/>
40         where id = #{id}
41     </select>
42         
43     <insert id="insertEmInspectionItems" parameterType="EmInspectionItems" useGeneratedKeys="true" keyProperty="id">
44         insert into em_inspection_items
45         <trim prefix="(" suffix=")" suffixOverrides=",">
46             <if test="itemsCode != null">items_code,</if>
47             <if test="itemsName != null">items_name,</if>
48             <if test="itemsType != null">items_type,</if>
49             <if test="status != null">status,</if>
50             <if test="standard != null">standard,</if>
51             <if test="itemsContent != null">items_content,</if>
52             <if test="remark != null">remark,</if>
53             <if test="createUser != null">create_user,</if>
54             <if test="createTime != null">create_time,</if>
55             <if test="updateUser != null">update_user,</if>
56             <if test="updateTime != null">update_time,</if>
57             <if test="spareField1 != null">spare_field_1,</if>
58             <if test="spareField2 != null">spare_field_2,</if>
59          </trim>
60         <trim prefix="values (" suffix=")" suffixOverrides=",">
61             <if test="itemsCode != null">#{itemsCode},</if>
62             <if test="itemsName != null">#{itemsName},</if>
63             <if test="itemsType != null">#{itemsType},</if>
64             <if test="status != null">#{status},</if>
65             <if test="standard != null">#{standard},</if>
66             <if test="itemsContent != null">#{itemsContent},</if>
67             <if test="remark != null">#{remark},</if>
68             <if test="createUser != null">#{createUser},</if>
69             <if test="createTime != null">#{createTime},</if>
70             <if test="updateUser != null">#{updateUser},</if>
71             <if test="updateTime != null">#{updateTime},</if>
72             <if test="spareField1 != null">#{spareField1},</if>
73             <if test="spareField2 != null">#{spareField2},</if>
74          </trim>
75     </insert>
76
77     <update id="updateEmInspectionItems" parameterType="EmInspectionItems">
78         update em_inspection_items
79         <trim prefix="SET" suffixOverrides=",">
80             <if test="itemsCode != null">items_code = #{itemsCode},</if>
81             <if test="itemsName != null">items_name = #{itemsName},</if>
82             <if test="itemsType != null">items_type = #{itemsType},</if>
83             <if test="status != null">status = #{status},</if>
84             <if test="standard != null">standard = #{standard},</if>
85             <if test="itemsContent != null">items_content = #{itemsContent},</if>
86             <if test="remark != null">remark = #{remark},</if>
87             <if test="createUser != null">create_user = #{createUser},</if>
88             <if test="createTime != null">create_time = #{createTime},</if>
89             <if test="updateUser != null">update_user = #{updateUser},</if>
90             <if test="updateTime != null">update_time = #{updateTime},</if>
91             <if test="spareField1 != null">spare_field_1 = #{spareField1},</if>
92             <if test="spareField2 != null">spare_field_2 = #{spareField2},</if>
93         </trim>
94         where id = #{id}
95     </update>
96
97     <delete id="deleteEmInspectionItemsById" parameterType="Long">
98         delete from em_inspection_items where id = #{id}
99     </delete>
100
101     <delete id="deleteEmInspectionItemsByIds" parameterType="String">
102         delete from em_inspection_items where id in 
103         <foreach item="id" collection="array" open="(" separator="," close=")">
104             #{id}
105         </foreach>
106     </delete>
107 </mapper>