<?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.device.camera.mapper.ArdCameraMapper">
|
|
<resultMap type="ArdCamera" id="ArdCameraResult">
|
<result property="id" column="id"/>
|
<result property="name" column="name"/>
|
<result property="ip" column="ip"/>
|
<result property="port" column="port"/>
|
<result property="rtspPort" column="rtsp_port"/>
|
<result property="username" column="username"/>
|
<result property="password" column="password"/>
|
<result property="type" column="type"/>
|
<result property="factory" column="factory"/>
|
<result property="chanNum" column="chan_num"/>
|
<result property="startChan" column="start_chan"/>
|
<result property="longitude" column="longitude"/>
|
<result property="latitude" column="latitude"/>
|
<result property="altitude" column="altitude"/>
|
<result property="dockId" column="dock_id"/>
|
<result property="userId" column="user_id"/>
|
<result property="deptId" column="dept_id"/>
|
<result property="loginId" column="login_id"/>
|
<result property="state" column="state"/>
|
<result property="createBy" column="create_by" />
|
<result property="createTime" column="create_time" />
|
<result property="updateBy" column="update_by" />
|
<result property="updateTime" column="update_time" />
|
<collection property="channelList" ofType="com.ard.device.channel.domain.ArdChannel"
|
javaType="List" column="id" autoMapping="true" select="selectChannelList">
|
</collection>
|
</resultMap>
|
<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"/>
|
<!-- 关联 ArdVtdu 对象 -->
|
<association property="ardVtdu" javaType="com.ard.vtdu.domain.ArdVtdu" column="{deviceId=device_id,chanNo=chan_no}" select="selectVtduByDeviceIdAndChanNo">
|
</association>
|
</resultMap>
|
<resultMap type="com.ard.vtdu.domain.ArdVtdu" id="ArdVtduResult">
|
<result property="name" column="name"/>
|
<result property="rtspSource" column="rtsp_source"/>
|
<result property="rtspUrl" column="rtsp_url"/>
|
<result property="rtmpUrl" column="rtmp_url"/>
|
<result property="webrtcUrl" column="webrtc_url"/>
|
<result property="cameraId" column="camera_id"/>
|
<result property="createBy" column="create_by"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateBy" column="update_by"/>
|
<result property="updateTime" column="update_time"/>
|
</resultMap>
|
<select id="selectVtduByDeviceIdAndChanNo" resultMap="ArdVtduResult">
|
select * from ard_vtdu where name = CONCAT(#{deviceId}, '_', #{chanNo})
|
</select>
|
<select id="selectChannelList" parameterType="String" resultMap="ArdChannelResult">
|
select *
|
from ard_channel
|
where device_id = #{id}
|
order by chan_no asc
|
</select>
|
|
<sql id="selectArdCameraVo">
|
select c.id,
|
c.name,
|
c.ip,
|
c.port,
|
c.rtsp_port,
|
c.username,
|
c.password,
|
c.type,
|
c.factory,
|
c.chan_num,
|
c.start_chan,
|
c.longitude,
|
c.latitude,
|
c.altitude,
|
c.dock_id,
|
c.user_id,
|
c.dept_id,
|
c.login_id,
|
c.state,
|
c.create_by,
|
c.create_time,
|
c.update_by,
|
c.update_time
|
from ard_camera c
|
left join sys_dept d on d.dept_id = c.dept_id
|
left join sys_user u on u.user_id = c.user_id
|
</sql>
|
|
<select id="selectArdCameraList" parameterType="ArdCamera" resultMap="ArdCameraResult">
|
<include refid="selectArdCameraVo"/>
|
<where>
|
<if test="id != null and id != ''">and c.id = #{id}</if>
|
<if test="name != null and name != ''">and c.name like concat('%', #{name}, '%')</if>
|
<if test="ip != null and ip != ''">and c.ip = #{ip}</if>
|
<if test="port != null ">and c.port = #{port}</if>
|
<if test="rtspPort != null ">and c.rtsp_port = #{rtspPort}</if>
|
<if test="username != null and username != ''">and c.username like '%'||#{username}||'%'</if>
|
<if test="password != null and password != ''">and c.password = #{password}</if>
|
<if test="type != null and type != ''">and c.type = #{type}</if>
|
<if test="factory != null and factory != ''">and c.factory = #{factory}</if>
|
<if test="chanNum != null ">and c.chan_num = #{chanNum}</if>
|
<if test="startChan != null ">and c.start_chan = #{startChan}</if>
|
<if test="longitude != null ">and c.longitude = #{longitude}</if>
|
<if test="latitude != null ">and c.latitude = #{latitude}</if>
|
<if test="altitude != null ">and c.altitude = #{altitude}</if>
|
<if test="dockId != null ">and c.dock_id = #{dockId}</if>
|
<if test="loginId != null ">and c.login_id = #{loginId}</if>
|
<if test="state != null ">and c.state = #{state}</if>
|
<if test="deptId != null and deptId != 0">
|
and (d.dept_id = #{deptId} OR d.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE
|
find_in_set(#{deptId}, ancestors) ))
|
</if>
|
<!-- 数据范围过滤 -->
|
${params.dataScope}
|
</where>
|
order by c.name
|
</select>
|
|
<select id="selectArdCameraById" parameterType="String" resultMap="ArdCameraResult">
|
<include refid="selectArdCameraVo"/>
|
where id = #{id}
|
</select>
|
<select id="selectArdCameraByName" parameterType="String" resultMap="ArdCameraResult">
|
<include refid="selectArdCameraVo"/>
|
where name = #{name}
|
</select>
|
<insert id="insertArdCamera" parameterType="ArdCamera">
|
insert into ard_camera
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">id,</if>
|
<if test="name != null">name,</if>
|
<if test="ip != null">ip,</if>
|
<if test="port != null">port,</if>
|
<if test="rtspPort != null ">rtsp_port,</if>
|
<if test="username != null">username,</if>
|
<if test="password != null">password,</if>
|
<if test="type != null">type,</if>
|
<if test="factory != null">factory,</if>
|
<if test="chanNum != null">chan_num,</if>
|
<if test="startChan != null">start_chan,</if>
|
<if test="longitude != null">longitude,</if>
|
<if test="latitude != null">latitude,</if>
|
<if test="altitude != null">altitude,</if>
|
<if test="dockId != null">dock_id,</if>
|
<if test="loginId != null">login_id,</if>
|
<if test="deptId != null">dept_id,</if>
|
<if test="userId != null">user_id,</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="state != null">state,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id},</if>
|
<if test="name != null">#{name},</if>
|
<if test="ip != null">#{ip},</if>
|
<if test="port != null">#{port},</if>
|
<if test="rtspPort != null ">#{rtspPort},</if>
|
<if test="username != null">#{username},</if>
|
<if test="password != null">#{password},</if>
|
<if test="type != null">#{type},</if>
|
<if test="factory != null">#{factory},</if>
|
<if test="chanNum != null">#{chanNum},</if>
|
<if test="startChan != null">#{startChan},</if>
|
<if test="longitude != null">#{longitude},</if>
|
<if test="latitude != null">#{latitude},</if>
|
<if test="altitude != null">#{altitude},</if>
|
<if test="dockId != null">#{dockId},</if>
|
<if test="loginId != null">#{loginId},</if>
|
<if test="deptId != null">#{deptId},</if>
|
<if test="userId != null">#{userId},</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="state != null">#{state},</if>
|
</trim>
|
</insert>
|
|
<update id="updateArdCamera" parameterType="ArdCamera">
|
update ard_camera
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="name != null">name = #{name},</if>
|
<if test="ip != null">ip = #{ip},</if>
|
<if test="port != null">port = #{port},</if>
|
<if test="rtspPort != null ">rtsp_port= #{rtspPort},</if>
|
<if test="username != null">username = #{username},</if>
|
<if test="password != null">password = #{password},</if>
|
<if test="type != null">type = #{type},</if>
|
<if test="factory != null">factory = #{factory},</if>
|
<if test="chanNum != null">chan_num = #{chanNum},</if>
|
<if test="startChan != null">start_chan = #{startChan},</if>
|
<if test="longitude != null">longitude = #{longitude},</if>
|
<if test="latitude != null">latitude = #{latitude},</if>
|
<if test="altitude != null">altitude = #{altitude},</if>
|
<if test="dockId != null">dock_id = #{dockId},</if>
|
<if test="loginId != null">login_id = #{loginId},</if>
|
<if test="deptId != null">dept_id = #{deptId},</if>
|
<if test="userId != null">user_id = #{userId},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="state != null">state = #{state},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteArdCameraById" parameterType="String">
|
delete
|
from ard_camera
|
where id = #{id}
|
</delete>
|
|
<delete id="deleteArdCameraByIds" parameterType="String">
|
delete from ard_camera where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
|
<select id="checkCameraIpAndPortUnique" resultMap="ArdCameraResult">
|
select *
|
from ard_camera
|
where ip = #{ip}
|
and port = #{port} limit 1
|
</select>
|
<update id="resetCameraLoginId" parameterType="ArdCamera">
|
update ard_camera set login_id = -1 where id = #{id}
|
</update>
|
|
</mapper>
|