-
admin
2024-06-21 d76bbaa8a9a70124045dc4c9753e5a868ac4e7d2
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?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.inspectionPlan.mapper.EmInspectionPlanMapper">
    
    <resultMap type="EmInspectionPlan" id="EmInspectionPlanResult">
        <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="frequency"    column="frequency"    />
        <result property="dimension"    column="dimension"    />
        <result property="lastGenerationTime"    column="last_generation_time"    />
        <result property="startTime"    column="start_time"    />
        <result property="endTime"    column="end_time"    />
        <result property="devices"    column="devices"    />
        <result property="inspectionItems"    column="Inspection_items"    />
        <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"    />
        <result property="spareField1"    column="spare_field_1"    />
        <result property="spareField2"    column="spare_field_2"    />
        <result property="spareField3"    column="spare_field_3"    />
        <result property="spareField4"    column="spare_field_4"    />
    </resultMap>
 
    <sql id="selectEmInspectionPlanVo">
        select id, plan_code, plan_name, plan_type, state, frequency, dimension, last_generation_time, start_time, end_time, devices, Inspection_items, remarks, create_time, create_user, update_time, update_user, spare_field_1, spare_field_2, spare_field_3, spare_field_4 from em_inspection_plan
    </sql>
 
    <select id="selectEmInspectionPlanList" parameterType="EmInspectionPlan" resultMap="EmInspectionPlanResult">
        <include refid="selectEmInspectionPlanVo"/>
        <where>  
            <if test="planCode != null  and planCode != ''"> and plan_code like concat('%', #{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="frequency != null  and frequency != ''"> and frequency = #{frequency}</if>
            <if test="dimension != null  and dimension != ''"> and dimension = #{dimension}</if>
            <if test="startTime != null  and startTime != ''"> and start_time = #{startTime}</if>
            <if test="endTime != null  and endTime != ''"> and end_time = #{endTime}</if>
        </where>
    </select>
    
    <select id="selectEmInspectionPlanById" parameterType="Long" resultMap="EmInspectionPlanResult">
        <include refid="selectEmInspectionPlanVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertEmInspectionPlan" parameterType="EmInspectionPlan" useGeneratedKeys="true" keyProperty="id">
        insert into em_inspection_plan
        <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="frequency != null">frequency,</if>
            <if test="dimension != null">dimension,</if>
            <if test="lastGenerationTime != null">last_generation_time,</if>
            <if test="startTime != null">start_time,</if>
            <if test="endTime != null">end_time,</if>
            <if test="devices != null">devices,</if>
            <if test="inspectionItems != null">Inspection_items,</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>
            <if test="spareField1 != null">spare_field_1,</if>
            <if test="spareField2 != null">spare_field_2,</if>
            <if test="spareField3 != null">spare_field_3,</if>
            <if test="spareField4 != null">spare_field_4,</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="frequency != null">#{frequency},</if>
            <if test="dimension != null">#{dimension},</if>
            <if test="lastGenerationTime != null">#{lastGenerationTime},</if>
            <if test="startTime != null">#{startTime},</if>
            <if test="endTime != null">#{endTime},</if>
            <if test="devices != null">#{devices},</if>
            <if test="inspectionItems != null">#{inspectionItems},</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>
            <if test="spareField1 != null">#{spareField1},</if>
            <if test="spareField2 != null">#{spareField2},</if>
            <if test="spareField3 != null">#{spareField3},</if>
            <if test="spareField4 != null">#{spareField4},</if>
         </trim>
    </insert>
 
    <update id="updateEmInspectionPlan" parameterType="EmInspectionPlan">
        update em_inspection_plan
        <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="frequency != null">frequency = #{frequency},</if>
            <if test="dimension != null">dimension = #{dimension},</if>
            <if test="lastGenerationTime != null">last_generation_time = #{lastGenerationTime},</if>
            <if test="startTime != null">start_time = #{startTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
            <if test="devices != null">devices = #{devices},</if>
            <if test="inspectionItems != null">Inspection_items = #{inspectionItems},</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>
            <if test="spareField1 != null">spare_field_1 = #{spareField1},</if>
            <if test="spareField2 != null">spare_field_2 = #{spareField2},</if>
            <if test="spareField3 != null">spare_field_3 = #{spareField3},</if>
            <if test="spareField4 != null">spare_field_4 = #{spareField4},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteEmInspectionPlanById" parameterType="Long">
        delete from em_inspection_plan where id = #{id}
    </delete>
 
    <delete id="deleteEmInspectionPlanByIds" parameterType="String">
        delete from em_inspection_plan where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>