<?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.cloud.device.dao.NodeDao">
|
<resultMap id="BaseResultMap" type="com.cloud.device.model.Node">
|
<result column="id" jdbcType="VARCHAR" property="id" />
|
<result column="devName" jdbcType="VARCHAR" property="devName" />
|
<result column="nodeIp" jdbcType="VARCHAR" property="nodeIp" />
|
<result column="port" jdbcType="INTEGER" property="port" />
|
<result column="clusterId" jdbcType="VARCHAR" property="clusterId" />
|
<result column="address" jdbcType="VARCHAR" property="address" />
|
<result column="devId" jdbcType="VARCHAR" property="devId" />
|
<result column="nodeId" jdbcType="VARCHAR" property="nodeId" />
|
<result column="createTime" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="publicIp" jdbcType="VARCHAR" property="publicIp" />
|
<result column="publicPort" jdbcType="VARCHAR" property="publicPort" />
|
<result column="videoPublicPort" jdbcType="VARCHAR" property="videoPublicPort" />
|
<result column="streamPublicPort" jdbcType="VARCHAR" property="streamPublicPort" />
|
</resultMap>
|
<sql id="Base_Column_List">
|
id, devName, nodeIp, port, clusterId, address, devId, nodeId, createTime, publicIp, publicPort, videoPublicPort, streamPublicPort
|
</sql>
|
<select id="selectById" parameterType="java.lang.String" resultMap="BaseResultMap">
|
select <include refid="Base_Column_List" />
|
from node
|
where id=#{id,jdbcType=VARCHAR}
|
</select>
|
<delete id="deleteById" parameterType="java.lang.String">
|
delete from node where id=#{id,jdbcType=VARCHAR}
|
</delete>
|
<insert id="insert" parameterType="com.cloud.device.model.Node">
|
insert into node (id, devName, nodeIp,
|
port, clusterId, address,
|
devId, nodeId, createTime, publicIp, publicPort, videoPublicPort, streamPublicPort
|
)
|
values (#{id,jdbcType=VARCHAR}, #{devName,jdbcType=VARCHAR}, #{nodeIp,jdbcType=VARCHAR},
|
#{port,jdbcType=INTEGER}, #{clusterId,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
|
#{devId,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
#{publicIp,jdbcType=VARCHAR}, #{publicPort,jdbcType=VARCHAR}, #{videoPublicPort,jdbcType=VARCHAR}, #{streamPublicPort,jdbcType=VARCHAR}
|
)
|
</insert>
|
<insert id="insertSelective" parameterType="com.cloud.device.model.Node">
|
insert into node
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">
|
id,
|
</if>
|
<if test="devName != null">
|
devName,
|
</if>
|
<if test="nodeIp != null">
|
nodeIp,
|
</if>
|
<if test="port != null">
|
port,
|
</if>
|
<if test="clusterId != null">
|
clusterId,
|
</if>
|
<if test="address != null">
|
address,
|
</if>
|
<if test="devId != null">
|
devId,
|
</if>
|
<if test="nodeId != null">
|
nodeId,
|
</if>
|
<if test="createTime != null">
|
createTime,
|
</if>
|
<if test="publicIp != null">
|
publicIp,
|
</if>
|
<if test="publicPort != null">
|
publicPort,
|
</if>
|
<if test="videoPublicPort !=null">
|
videoPublicPort,
|
</if>
|
<if test="streamPublicPort !=null">
|
streamPublicPort,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="id != null">
|
#{id,jdbcType=VARCHAR},
|
</if>
|
<if test="devName != null">
|
#{devName,jdbcType=VARCHAR},
|
</if>
|
<if test="nodeIp != null">
|
#{nodeIp,jdbcType=VARCHAR},
|
</if>
|
<if test="port != null">
|
#{port,jdbcType=INTEGER},
|
</if>
|
<if test="clusterId != null">
|
#{clusterId,jdbcType=VARCHAR},
|
</if>
|
<if test="address != null">
|
#{address,jdbcType=VARCHAR},
|
</if>
|
<if test="devId != null">
|
#{devId,jdbcType=VARCHAR},
|
</if>
|
<if test="nodeId != null">
|
#{nodeId,jdbcType=VARCHAR},
|
</if>
|
<if test="createTime != null">
|
#{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="publicIp !=null">
|
#{publicIp,jdbcType=VARCHAR},
|
</if>
|
<if test="publicPort != null">
|
#{publicPort,jdbcType=VARCHAR},
|
</if>
|
<if test="videoPublicPort !=null">
|
#{videoPublicPort,jdbcType=VARCHAR},
|
</if>
|
<if test="streamPublicPort != null">
|
#{streamPublicPort,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
<update id="updateById" parameterType="com.cloud.device.model.Node">
|
update node
|
set devName = #{devName,jdbcType=VARCHAR},
|
nodeIp = #{nodeIp,jdbcType=VARCHAR},
|
port = #{port,jdbcType=INTEGER},
|
clusterId = #{clusterId,jdbcType=VARCHAR},
|
address = #{address,jdbcType=VARCHAR},
|
devId = #{devId,jdbcType=VARCHAR},
|
nodeId = #{nodeId,jdbcType=VARCHAR},
|
createTime = #{createTime,jdbcType=TIMESTAMP},
|
publicIp = #{publicIp,jdbcType=VARCHAR},
|
publicPort = #{publicPort,jdbcType=VARCHAR},
|
videoPublicPort = #{videoPublicPort,jdbcType=VARCHAR},
|
streamPublicPort = #{streamPublicPort,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
</update>
|
<update id="updateByIdSelective" parameterType="com.cloud.device.model.Node">
|
update node
|
<set>
|
<if test="devName != null">
|
devName = #{devName,jdbcType=VARCHAR},
|
</if>
|
<if test="nodeIp != null">
|
nodeIp = #{nodeIp,jdbcType=VARCHAR},
|
</if>
|
<if test="port != null">
|
port = #{port,jdbcType=INTEGER},
|
</if>
|
<if test="clusterId != null">
|
clusterId = #{clusterId,jdbcType=VARCHAR},
|
</if>
|
<if test="address != null">
|
address = #{address,jdbcType=VARCHAR},
|
</if>
|
<if test="devId != null">
|
devId = #{devId,jdbcType=VARCHAR},
|
</if>
|
<if test="nodeId != null">
|
nodeId = #{nodeId,jdbcType=VARCHAR},
|
</if>
|
<if test="createTime != null">
|
createTime = #{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="publicIp !=null">
|
publicIp = #{publicIp,jdbcType=VARCHAR},
|
</if>
|
<if test="publicPort != null">
|
publicPort = #{publicPort,jdbcType=VARCHAR},
|
</if>
|
<if test="videoPublicPort !=null">
|
videoPublicPort = #{videoPublicPort,jdbcType=VARCHAR},
|
</if>
|
<if test="streamPublicPort != null">
|
streamPublicPort = #{streamPublicPort,jdbcType=VARCHAR}
|
</if>
|
</set>
|
where id = #{id,jdbcType=VARCHAR}
|
</update>
|
<select id="findByClusterId" parameterType="java.lang.String" resultMap="BaseResultMap">
|
select <include refid="Base_Column_List" />
|
from node
|
where clusterId = #{clusterId,jdbcType=VARCHAR}
|
</select>
|
|
<select id="getNodeByDevId" parameterType="java.lang.String" resultMap="BaseResultMap">
|
select <include refid="Base_Column_List" />
|
from node
|
where devId=#{devId,jdbcType=VARCHAR}
|
order by createTime desc
|
limit 0,1
|
</select>
|
</mapper>
|