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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?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.GbChannelMapper">
 
    <resultMap type="com.ard.gb28181.domain.GbChannel" id="GbChannelResult">
        <id property="id" column="id"/>
        <result property="gbDeviceId" column="gb_device_id"/>
        <result property="gbChannelId" column="gb_channel_id"/>
        <result property="channelName" column="channel_name"/>
        <result property="deviceCode" column="device_code"/>
        <result property="streamMode" column="stream_mode"/>
        <result property="enableMp4" column="enable_mp4"/>
        <result property="streamStatus" column="stream_status"/>
        <result property="mediaServerId" column="media_server_id"/>
        <result property="streamKey" column="stream_key"/>
        <result property="snap" column="snap"/>
        <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="selectGbChannelVo">
        select id, gb_device_id, gb_channel_id, channel_name, device_code, stream_mode, enable_mp4,
               stream_status, media_server_id, stream_key, snap,
               create_by, create_time, update_by, update_time, remark
        from ard_gb_channel
    </sql>
 
    <select id="selectGbChannelById" parameterType="Long" resultMap="GbChannelResult">
        <include refid="selectGbChannelVo"/> where id = #{id}
    </select>
 
    <select id="selectGbChannelByGbDeviceId" parameterType="String" resultMap="GbChannelResult">
        <include refid="selectGbChannelVo"/> where gb_device_id = #{gbDeviceId}
        order by id
    </select>
 
    <select id="selectByGbDeviceIdAndGbChannelId" resultMap="GbChannelResult">
        <include refid="selectGbChannelVo"/>
        where gb_device_id = #{gbDeviceId} and gb_channel_id = #{gbChannelId}
    </select>
 
    <select id="selectGbChannelList" parameterType="com.ard.gb28181.domain.GbChannel" resultMap="GbChannelResult">
        <include refid="selectGbChannelVo"/>
        <where>
            <if test="gbDeviceId != null and gbDeviceId != ''">
                and gb_device_id like concat('%', #{gbDeviceId}, '%')
            </if>
            <if test="gbChannelId != null and gbChannelId != ''">
                and gb_channel_id like concat('%', #{gbChannelId}, '%')
            </if>
            <if test="channelName != null and channelName != ''">
                and channel_name like concat('%', #{channelName}, '%')
            </if>
        </where>
    </select>
 
    <insert id="insertGbChannel" parameterType="com.ard.gb28181.domain.GbChannel" useGeneratedKeys="true" keyProperty="id">
        insert into ard_gb_channel
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="gbDeviceId != null">gb_device_id,</if>
            <if test="gbChannelId != null">gb_channel_id,</if>
            <if test="channelName != null">channel_name,</if>
            <if test="deviceCode != null">device_code,</if>
            <if test="streamMode != null">stream_mode,</if>
            <if test="enableMp4 != null">enable_mp4,</if>
            <if test="streamStatus != null">stream_status,</if>
            <if test="mediaServerId != null">media_server_id,</if>
            <if test="streamKey != null">stream_key,</if>
            <if test="snap != null">snap,</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="gbChannelId != null">#{gbChannelId},</if>
            <if test="channelName != null">#{channelName},</if>
            <if test="deviceCode != null">#{deviceCode},</if>
            <if test="streamMode != null">#{streamMode},</if>
            <if test="enableMp4 != null">#{enableMp4},</if>
            <if test="streamStatus != null">#{streamStatus},</if>
            <if test="mediaServerId != null">#{mediaServerId},</if>
            <if test="streamKey != null">#{streamKey},</if>
            <if test="snap != null">#{snap},</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="updateGbChannel" parameterType="com.ard.gb28181.domain.GbChannel">
        update ard_gb_channel
        <trim prefix="SET" suffixOverrides=",">
            <if test="channelName != null">channel_name = #{channelName},</if>
            <if test="deviceCode != null">device_code = #{deviceCode},</if>
            <if test="streamMode != null">stream_mode = #{streamMode},</if>
            <if test="enableMp4 != null">enable_mp4 = #{enableMp4},</if>
            <if test="streamStatus != null">stream_status = #{streamStatus},</if>
            <if test="mediaServerId != null">media_server_id = #{mediaServerId},</if>
            <if test="streamKey != null">stream_key = #{streamKey},</if>
            <if test="snap != null">snap = #{snap},</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>
 
    <update id="updateGbChannelStream">
        update ard_gb_channel
        <trim prefix="SET" suffixOverrides=",">
            <if test="streamStatus != null">stream_status = #{streamStatus},</if>
            <if test="streamKey != null">stream_key = #{streamKey},</if>
            <if test="mediaServerId != null">media_server_id = #{mediaServerId},</if>
            <if test="snap != null">snap = #{snap},</if>
            update_by = #{updateBy},
            update_time = #{updateTime}
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteGbChannelById" parameterType="Long">
        delete from ard_gb_channel where id = #{id}
    </delete>
 
    <delete id="deleteGbChannelByIds" parameterType="String">
        delete from ard_gb_channel where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">#{id}</foreach>
    </delete>
 
</mapper>