<?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>
|