<?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.work.device.channel.mapper.ArdChannelMapper">
|
|
<resultMap type="ArdChannel" id="ArdChannelResult">
|
<result property="id" column="id"/>
|
<result property="name" column="name"/>
|
<result property="chanNo" column="chan_no"/>
|
<result property="videoCode" column="video_code"/>
|
<result property="deviceId" column="device_id"/>
|
<result property="type" column="type"/>
|
<result property="liveAddress" column="live_address"/>
|
<result property="snapUrl" column="snap_url"/>
|
<result property="mediaServerId" column="media_server_id"/>
|
<result property="streamKey" column="stream_key"/>
|
</resultMap>
|
|
<sql id="selectArdChannelVo">
|
select id, name, chan_no, video_code, device_id, type, live_address, snap_url, media_server_id, stream_key
|
from ard_channel
|
</sql>
|
|
<select id="selectArdChannelList" parameterType="ArdChannel" resultMap="ArdChannelResult">
|
<include refid="selectArdChannelVo"/>
|
<where>
|
<if test="deviceId!=null">device_id=#{deviceId}</if>
|
</where>
|
order by chan_no
|
</select>
|
|
<select id="queryByIds" resultMap="ArdChannelResult">
|
<include refid="selectArdChannelVo"/>
|
where id in
|
<foreach item="id" collection="startArdChannelIdList" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</select>
|
|
<select id="selectArdChannelById" parameterType="String" resultMap="ArdChannelResult">
|
<include refid="selectArdChannelVo"/>
|
where id = #{id}
|
</select>
|
|
<!-- 根据ID数组批量查询通道 -->
|
<select id="selectArdChannelByIds" resultMap="ArdChannelResult">
|
SELECT * FROM ard_channel
|
WHERE id IN
|
<foreach collection="array" item="id" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</select>
|
|
<insert id="insertArdChannel" parameterType="ArdChannel">
|
insert into ard_channel
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">id,</if>
|
<if test="name != null">name,</if>
|
<if test="chanNo != null">chan_no,</if>
|
<if test="videoCode != null">video_code,</if>
|
<if test="deviceId != null">device_id,</if>
|
<if test="liveAddress != null">live_address,</if>
|
<if test="snapUrl != null">snap_url,</if>
|
<if test="type != null">type,</if>
|
<if test="mediaServerId != null">media_server_id,</if>
|
<if test="streamKey != null">stream_key,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id},</if>
|
<if test="name != null">#{name},</if>
|
<if test="chanNo != null">#{chanNo},</if>
|
<if test="videoCode != null">#{videoCode},</if>
|
<if test="deviceId != null">#{deviceId},</if>
|
<if test="liveAddress != null">#{liveAddress},</if>
|
<if test="snapUrl != null">#{snapUrl},</if>
|
<if test="type != null">#{type},</if>
|
<if test="mediaServerId != null">#{mediaServerId},</if>
|
<if test="streamKey != null">#{streamKey},</if>
|
</trim>
|
</insert>
|
|
<update id="updateArdChannel" parameterType="ArdChannel">
|
update ard_channel
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="name != null">name = #{name},</if>
|
<if test="chanNo != null">chan_no = #{chanNo},</if>
|
<if test="videoCode != null">video_code = #{videoCode},</if>
|
<if test="deviceId != null">device_id = #{deviceId},</if>
|
<if test="liveAddress != null">live_address = #{liveAddress},</if>
|
<if test="snapUrl != null">snap_url = #{snapUrl},</if>
|
<if test="type != null">type = #{type},</if>
|
<if test="mediaServerId != null">media_server_id = #{mediaServerId},</if>
|
<if test="streamKey != null">stream_key = #{streamKey},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteArdChannelById" parameterType="String">
|
delete
|
from ard_channel
|
where id = #{id}
|
</delete>
|
|
<delete id="deleteArdChannelByIds" parameterType="String">
|
delete from ard_channel where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
<delete id="deleteArdChannelByDeviceId" parameterType="String">
|
delete
|
from ard_channel
|
where device_id = #{deviceId}
|
</delete>
|
<delete id="clearArdChannel">
|
delete
|
from ard_channel
|
</delete>
|
<select id="checkArdChannelUnique" parameterType="ArdChannel" resultMap="ArdChannelResult">
|
select *
|
from ard_channel
|
where device_id = #{deviceId}
|
and chan_no = #{chanNo} limit 1
|
</select>
|
</mapper>
|