懒羊羊
2024-01-31 e57a8990ae56f657a59c435a0613c5f7a8728003
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
<?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.da.opcuaconfig.mapper.DaOpcuaConfigMapper">
    <resultMap type="DaOpcuaConfig" id="DaOpcuaConfigResult">
        <result property="id"    column="id"    />
        <result property="node"    column="node"    />
        <result property="sysTypes"    column="sys_types"    />
        <result property="subscribe"    column="subscribe"    />
        <result property="rFunction"    column="r_function"    />
        <result property="remarks"    column="remarks"    />
        <result property="processName"    column="process_name"    />
        <result property="process"    column="process"    />
        <result property="state"    column="state"    />
    </resultMap>
 
    <sql id="selectDaOpcuaConfigVo">
        select id, node, sys_types, subscribe, r_function, remarks, process_name, process, state from da_opcua_config
    </sql>
 
    <select id="selectDaOpcuaConfigList" parameterType="DaOpcuaConfig" resultMap="DaOpcuaConfigResult">
        <include refid="selectDaOpcuaConfigVo"/>
        <where>  
            <if test="node != null  and node != ''"> and node = #{node}</if>
            <if test="rFunction != null  and rFunction != ''"> and r_function = #{rFunction}</if>
            <if test="process != null  and process != ''"> and process = #{process}</if>
            <if test="state != null "> and state = #{state}</if>
        </where>
    </select>
    
    <select id="selectDaOpcuaConfigById" parameterType="Long" resultMap="DaOpcuaConfigResult">
        <include refid="selectDaOpcuaConfigVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertDaOpcuaConfig" parameterType="DaOpcuaConfig" useGeneratedKeys="true" keyProperty="id">
        insert into da_opcua_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="node != null">node,</if>
            <if test="sysTypes != null">sys_types,</if>
            <if test="subscribe != null">subscribe,</if>
            <if test="rFunction != null">r_function,</if>
            <if test="remarks != null">remarks,</if>
            <if test="processName != null">process_name,</if>
            <if test="process != null">process,</if>
            <if test="state != null">state,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="node != null">#{node},</if>
            <if test="sysTypes != null">#{sysTypes},</if>
            <if test="subscribe != null">#{subscribe},</if>
            <if test="rFunction != null">#{rFunction},</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="processName != null">#{processName},</if>
            <if test="process != null">#{process},</if>
            <if test="state != null">#{state},</if>
         </trim>
    </insert>
 
    <update id="updateDaOpcuaConfig" parameterType="DaOpcuaConfig">
        update da_opcua_config
        <trim prefix="SET" suffixOverrides=",">
            <if test="node != null">node = #{node},</if>
            <if test="sysTypes != null">sys_types = #{sysTypes},</if>
            <if test="subscribe != null">subscribe = #{subscribe},</if>
            <if test="rFunction != null">r_function = #{rFunction},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
            <if test="processName != null">process_name = #{processName},</if>
            <if test="process != null">process = #{process},</if>
            <if test="state != null">state = #{state},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteDaOpcuaConfigById" parameterType="Long">
        delete from da_opcua_config where id = #{id}
    </delete>
 
    <delete id="deleteDaOpcuaConfigByIds" parameterType="String">
        delete from da_opcua_config where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>