<?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.camera.mapper.ArdCameraPtzScopeMapper">
|
|
<resultMap type="ArdCameraPtzScope" id="ArdCameraPtzScopeResult">
|
<result property="id" column="id" />
|
<result property="cameraId" column="camera_id" />
|
<result property="pMin" column="p_min" />
|
<result property="pMax" column="p_max" />
|
<result property="tMin" column="t_min" />
|
<result property="tMax" column="t_max" />
|
<result property="zMin" column="z_min" />
|
<result property="zMax" column="z_max" />
|
<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="selectArdCameraPtzScopeVo">
|
select id, camera_id, p_min, p_max, t_min, t_max, z_min, z_max,
|
create_by, create_time, update_by, update_time, remark
|
from ard_camera_ptz_scope
|
</sql>
|
|
<select id="selectArdCameraPtzScopeList" parameterType="ArdCameraPtzScope" resultMap="ArdCameraPtzScopeResult">
|
<include refid="selectArdCameraPtzScopeVo"/>
|
<where>
|
<if test="cameraId != null and cameraId != ''">
|
AND camera_id like concat('%', #{cameraId}, '%')
|
</if>
|
</where>
|
order by create_time desc
|
</select>
|
|
<select id="selectArdCameraPtzScopeById" parameterType="Long" resultMap="ArdCameraPtzScopeResult">
|
<include refid="selectArdCameraPtzScopeVo"/>
|
where id = #{id}
|
</select>
|
|
<select id="selectArdCameraPtzScopeByCameraId" parameterType="String" resultMap="ArdCameraPtzScopeResult">
|
<include refid="selectArdCameraPtzScopeVo"/>
|
where camera_id = #{cameraId}
|
</select>
|
|
<insert id="insertArdCameraPtzScope" parameterType="ArdCameraPtzScope" useGeneratedKeys="true" keyProperty="id">
|
insert into ard_camera_ptz_scope
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="cameraId != null">camera_id,</if>
|
<if test="pMin != null">p_min,</if>
|
<if test="pMax != null">p_max,</if>
|
<if test="tMin != null">t_min,</if>
|
<if test="tMax != null">t_max,</if>
|
<if test="zMin != null">z_min,</if>
|
<if test="zMax != null">z_max,</if>
|
<if test="createBy != null">create_by,</if>
|
<if test="remark != null">remark,</if>
|
create_time
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="cameraId != null">#{cameraId},</if>
|
<if test="pMin != null">#{pMin},</if>
|
<if test="pMax != null">#{pMax},</if>
|
<if test="tMin != null">#{tMin},</if>
|
<if test="tMax != null">#{tMax},</if>
|
<if test="zMin != null">#{zMin},</if>
|
<if test="zMax != null">#{zMax},</if>
|
<if test="createBy != null">#{createBy},</if>
|
<if test="remark != null">#{remark},</if>
|
sysdate()
|
</trim>
|
</insert>
|
|
<update id="updateArdCameraPtzScope" parameterType="ArdCameraPtzScope">
|
update ard_camera_ptz_scope
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="cameraId != null">camera_id = #{cameraId},</if>
|
<if test="pMin != null">p_min = #{pMin},</if>
|
<if test="pMax != null">p_max = #{pMax},</if>
|
<if test="tMin != null">t_min = #{tMin},</if>
|
<if test="tMax != null">t_max = #{tMax},</if>
|
<if test="zMin != null">z_min = #{zMin},</if>
|
<if test="zMax != null">z_max = #{zMax},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
update_time = sysdate()
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteArdCameraPtzScopeById" parameterType="Long">
|
delete from ard_camera_ptz_scope where id = #{id}
|
</delete>
|
|
<delete id="deleteArdCameraPtzScopeByIds" parameterType="String">
|
delete from ard_camera_ptz_scope where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
<!-- 插入或更新(存在则更新) -->
|
<insert id="insertOrUpdate" parameterType="ArdCameraPtzScope">
|
INSERT INTO ard_camera_ptz_scope (
|
camera_id, p_min, p_max, t_min, t_max, z_min, z_max,
|
create_by, create_time, remark
|
) VALUES (
|
#{cameraId}, #{pMin}, #{pMax}, #{tMin}, #{tMax}, #{zMin}, #{zMax},
|
#{createBy}, sysdate(), #{remark}
|
)
|
ON DUPLICATE KEY UPDATE
|
p_min = VALUES(p_min),
|
p_max = VALUES(p_max),
|
t_min = VALUES(t_min),
|
t_max = VALUES(t_max),
|
z_min = VALUES(z_min),
|
z_max = VALUES(z_max),
|
update_by = VALUES(create_by),
|
update_time = sysdate()
|
</insert>
|
|
<!-- 清空所有数据 -->
|
<delete id="clearAll">
|
DELETE FROM ard_camera_ptz_scope
|
</delete>
|
</mapper>
|