liusuyi
2026-06-01 3496700a5ba18be8ca0590a79e21a867782d1ea9
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
<?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.ard.gb28181.mapper.GbDeviceMapper">
 
    <resultMap type="com.ard.gb28181.domain.GbDevice" id="GbDeviceResult">
        <id property="id" column="id"/>
        <result property="gbDeviceId" column="gb_device_id"/>
        <result property="deviceName" column="device_name"/>
        <result property="deviceCode" column="device_code"/>
        <result property="ip" column="ip"/>
        <result property="port" column="port"/>
        <result property="manufacturer" column="manufacturer"/>
        <result property="model" column="model"/>
        <result property="firmware" column="firmware"/>
        <result property="onLine" column="online"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="remark" column="remark"/>
    </resultMap>
 
    <sql id="selectGbDeviceVo">
        select id, gb_device_id, device_name, device_code, ip, port,
               manufacturer, model, firmware, online,
               create_by, create_time, update_by, update_time, remark
        from ard_gb_device
    </sql>
 
    <select id="selectGbDeviceById" parameterType="Long" resultMap="GbDeviceResult">
        <include refid="selectGbDeviceVo"/> where id = #{id}
    </select>
 
    <select id="selectGbDeviceByGbDeviceId" parameterType="String" resultMap="GbDeviceResult">
        <include refid="selectGbDeviceVo"/> where gb_device_id = #{gbDeviceId}
    </select>
 
    <select id="selectGbDeviceList" parameterType="com.ard.gb28181.domain.GbDevice" resultMap="GbDeviceResult">
        <include refid="selectGbDeviceVo"/>
        <where>
            <if test="gbDeviceId != null and gbDeviceId != ''">
                and gb_device_id like concat('%', #{gbDeviceId}, '%')
            </if>
            <if test="deviceName != null and deviceName != ''">
                and device_name like concat('%', #{deviceName}, '%')
            </if>
            <if test="deviceCode != null and deviceCode != ''">
                and device_code like concat('%', #{deviceCode}, '%')
            </if>
        </where>
    </select>
 
    <insert id="insertGbDevice" parameterType="com.ard.gb28181.domain.GbDevice" useGeneratedKeys="true" keyProperty="id">
        insert into ard_gb_device
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="gbDeviceId != null">gb_device_id,</if>
            <if test="deviceName != null">device_name,</if>
            <if test="deviceCode != null">device_code,</if>
            <if test="ip != null">ip,</if>
            <if test="port != null">port,</if>
            <if test="manufacturer != null">manufacturer,</if>
            <if test="model != null">model,</if>
            <if test="firmware != null">firmware,</if>
            <if test="onLine != null">online,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="gbDeviceId != null">#{gbDeviceId},</if>
            <if test="deviceName != null">#{deviceName},</if>
            <if test="deviceCode != null">#{deviceCode},</if>
            <if test="ip != null">#{ip},</if>
            <if test="port != null">#{port},</if>
            <if test="manufacturer != null">#{manufacturer},</if>
            <if test="model != null">#{model},</if>
            <if test="firmware != null">#{firmware},</if>
            <if test="onLine != null">#{onLine},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
        </trim>
    </insert>
 
    <update id="updateGbDevice" parameterType="com.ard.gb28181.domain.GbDevice">
        update ard_gb_device
        <trim prefix="SET" suffixOverrides=",">
            <if test="deviceName != null">device_name = #{deviceName},</if>
            <if test="deviceCode != null">device_code = #{deviceCode},</if>
            <if test="ip != null">ip = #{ip},</if>
            <if test="port != null">port = #{port},</if>
            <if test="manufacturer != null">manufacturer = #{manufacturer},</if>
            <if test="model != null">model = #{model},</if>
            <if test="firmware != null">firmware = #{firmware},</if>
            <if test="onLine != null">online = #{onLine},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteGbDeviceById" parameterType="Long">
        delete from ard_gb_device where id = #{id}
    </delete>
 
    <delete id="deleteGbDeviceByIds" parameterType="String">
        delete from ard_gb_device where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">#{id}</foreach>
    </delete>
 
</mapper>