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
<?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.inspectionPlanTask.mapper.EmInspectionPlanTaskMapper">
    
    <resultMap type="EmInspectionPlanTask" id="EmInspectionPlanTaskResult">
        <result property="id"    column="id"    />
        <result property="planCode"    column="plan_code"    />
        <result property="planName"    column="plan_name"    />
        <result property="planType"    column="plan_type"    />
        <result property="state"    column="state"    />
        <result property="devicesCode"    column="devices_code"    />
        <result property="devicesName"    column="devices_name"    />
        <result property="brand"    column="brand"    />
        <result property="specs"    column="specs"    />
        <result property="results"    column="results"    />
        <result property="remarks"    column="remarks"    />
        <result property="createTime"    column="create_time"    />
        <result property="createUser"    column="create_user"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateUser"    column="update_user"    />
    </resultMap>
 
    <sql id="selectEmInspectionPlanTaskVo">
        select id, plan_code, plan_name, plan_type, state, devices_code, devices_name, brand, specs, results, remarks, create_time, create_user, update_time, update_user from em_inspection_plan_task
    </sql>
 
    <select id="selectEmInspectionPlanTaskList" parameterType="EmInspectionPlanTask" resultMap="EmInspectionPlanTaskResult">
        <include refid="selectEmInspectionPlanTaskVo"/>
        <where>  
            <if test="planCode != null  and planCode != ''"> and plan_code = #{planCode}</if>
            <if test="planName != null  and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
            <if test="planType != null  and planType != ''"> and plan_type = #{planType}</if>
            <if test="state != null  and state != ''"> and state = #{state}</if>
            <if test="devicesCode != null  and devicesCode != ''"> and devices_code = #{devicesCode}</if>
            <if test="devicesName != null  and devicesName != ''"> and devices_name like concat('%', #{devicesName}, '%')</if>
        </where>
    </select>
    
    <select id="selectEmInspectionPlanTaskById" parameterType="Long" resultMap="EmInspectionPlanTaskResult">
        <include refid="selectEmInspectionPlanTaskVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertEmInspectionPlanTask" parameterType="EmInspectionPlanTask" useGeneratedKeys="true" keyProperty="id">
        insert into em_inspection_plan_task
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="planCode != null">plan_code,</if>
            <if test="planName != null">plan_name,</if>
            <if test="planType != null">plan_type,</if>
            <if test="state != null">state,</if>
            <if test="devicesCode != null">devices_code,</if>
            <if test="devicesName != null">devices_name,</if>
            <if test="brand != null">brand,</if>
            <if test="specs != null">specs,</if>
            <if test="results != null">results,</if>
            <if test="remarks != null">remarks,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createUser != null">create_user,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateUser != null">update_user,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="planCode != null">#{planCode},</if>
            <if test="planName != null">#{planName},</if>
            <if test="planType != null">#{planType},</if>
            <if test="state != null">#{state},</if>
            <if test="devicesCode != null">#{devicesCode},</if>
            <if test="devicesName != null">#{devicesName},</if>
            <if test="brand != null">#{brand},</if>
            <if test="specs != null">#{specs},</if>
            <if test="results != null">#{results},</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createUser != null">#{createUser},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateUser != null">#{updateUser},</if>
         </trim>
    </insert>
 
    <update id="updateEmInspectionPlanTask" parameterType="EmInspectionPlanTask">
        update em_inspection_plan_task
        <trim prefix="SET" suffixOverrides=",">
            <if test="planCode != null">plan_code = #{planCode},</if>
            <if test="planName != null">plan_name = #{planName},</if>
            <if test="planType != null">plan_type = #{planType},</if>
            <if test="state != null">state = #{state},</if>
            <if test="devicesCode != null">devices_code = #{devicesCode},</if>
            <if test="devicesName != null">devices_name = #{devicesName},</if>
            <if test="brand != null">brand = #{brand},</if>
            <if test="specs != null">specs = #{specs},</if>
            <if test="results != null">results = #{results},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createUser != null">create_user = #{createUser},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateUser != null">update_user = #{updateUser},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteEmInspectionPlanTaskById" parameterType="Long">
        delete from em_inspection_plan_task where id = #{id}
    </delete>
 
    <delete id="deleteEmInspectionPlanTaskByIds" parameterType="String">
        delete from em_inspection_plan_task where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>