liusuyi
2026-05-18 0b8c8d8986a35c3e36db1503125e2dff79d6d10e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?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>