wujian
2024-03-29 8241ddde076c3418f359e48009585a2d9aae7ed7
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
<?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.inspectionPlanItemsProject.mapper.EmInspectionPlanItemsProjectMapper">
    
    <resultMap type="EmInspectionPlanItemsProject" id="EmInspectionPlanItemsProjectResult">
        <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="results"    column="results"    />
        <result property="planTaskId"    column="plan_task_id"    />
    </resultMap>
 
    <sql id="selectEmInspectionPlanItemsProjectVo">
        select id, items_code, items_name, items_type, standard, items_content, create_user, create_time, update_user, update_time, results, plan_task_id from em_inspection_plan_items_project
    </sql>
 
    <select id="selectEmInspectionPlanItemsProjectList" parameterType="EmInspectionPlanItemsProject" resultMap="EmInspectionPlanItemsProjectResult">
        <include refid="selectEmInspectionPlanItemsProjectVo"/>
        <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="results != null  and results != ''"> and results = #{results}</if>
        </where>
    </select>
    
    <select id="selectEmInspectionPlanItemsProjectById" parameterType="Long" resultMap="EmInspectionPlanItemsProjectResult">
        <include refid="selectEmInspectionPlanItemsProjectVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertEmInspectionPlanItemsProject" parameterType="EmInspectionPlanItemsProject" useGeneratedKeys="true" keyProperty="id">
        insert into em_inspection_plan_items_project
        <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="results != null">results,</if>
            <if test="planTaskId != null">plan_task_id,</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="results != null">#{results},</if>
            <if test="planTaskId != null">#{planTaskId},</if>
         </trim>
    </insert>
 
    <update id="updateEmInspectionPlanItemsProject" parameterType="EmInspectionPlanItemsProject">
        update em_inspection_plan_items_project
        <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="results != null">results = #{results},</if>
            <if test="planTaskId != null">plan_task_id = #{planTaskId},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteEmInspectionPlanItemsProjectById" parameterType="Long">
        delete from em_inspection_plan_items_project where id = #{id}
    </delete>
 
    <delete id="deleteEmInspectionPlanItemsProjectByIds" parameterType="String">
        delete from em_inspection_plan_items_project where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>