liusuyi
2024-05-08 c17dc5484bde25d032bf58d114a4f1598a301f31
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?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.ruoyi.device.camera.mapper.ArdCameraUserPostionMapper">
 
    <resultMap type="ArdCameras" id="ArdCamerasResult">
        <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="gdtype" column="gdtype"/>
        <result property="factory" column="factory"/>
        <result property="chanNum" column="channel"/>
        <result property="longitude" column="longitude"/>
        <result property="latitude" column="latitude"/>
        <result property="altitude" column="altitude"/>
        <result property="userId" column="user_id"/>
        <result property="deptId" column="dept_id"/>
        <result property="camHeading" column="cam_heading"/>
        <result property="camPitch" column="cam_pitch"/>
        <result property="camRoll" column="cam_roll"/>
        <result property="camNear" column="cam_near"/>
        <result property="camFar" column="cam_far"/>
        <result property="camAspectratio" column="cam_aspectratio"/>
        <result property="camDepth" column="cam_depth"/>
        <result property="camFov" column="cam_fov"/>
        <result property="loginId" column="login_id"/>
        <result property="operatorId" column="operator_id"/>
        <result property="operatorExpired" column="operator_expired"/>
        <result property="camMaxVisibleDistance" column="cam_max_visible_distance"/>
        <result property="camAlarmGuideEnable" column="cam_alarm_guide_enable"/>
        <result property="state" column="state"/>
        <result property="towerId" column="tower_id"/>
        <collection property="channelList" ofType="ArdChannel">
            <result property="id" column="c_id"/>
            <result property="name" column="c_name"/>
            <result property="chanNo" column="c_chan_no"/>
            <result property="deviceId" column="c_device_id"/>
        </collection>
    </resultMap>
    <resultMap type="ArdCameraUserPostion" id="ArdCameraUserPostionResult">
        <result property="id"    column="id"    />
        <result property="cameraId"    column="camera_id"    />
        <result property="chanNo"    column="chan_no"    />
        <result property="userId"    column="user_id"    />
        <result property="position"    column="position"    />
    </resultMap>
 
    <sql id="selectArdCameraUserPostionVo">
        select id, camera_id, chan_no, user_id, position from ard_camera_user_postion
    </sql>
    <select id="selectArdCameraUserPostionList" parameterType="ArdCameraUserPostion" resultMap="ArdCameraUserPostionResult">
        <include refid="selectArdCameraUserPostionVo"/>
        <where>
            <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
            <if test="position != null  and position != ''"> and position = #{position}</if>
        </where>
    </select>
    <select id="selectArdCameraUserPostionByPosition" parameterType="ArdCameraUserPostion" resultMap="ArdCamerasResult">
        SELECT c.id,
               c.name,
               c.ip,
               c.port,
               c.rtsp_port,
               c.username,
               c.password,
               c.gdtype,
               c.factory,
               c.channel,
               c.longitude,
               c.latitude,
               c.altitude,
               c.user_id,
               c.dept_id,
               c.login_id,
               c.cam_heading,
               c.cam_pitch,
               c.cam_roll,
               c.cam_near,
               c.cam_far,
               c.cam_aspectratio,
               c.cam_depth,
               c.cam_fov,
               c.operator_id,
               c.operator_expired,
               c.cam_max_visible_distance,
               c.cam_alarm_guide_enable,
               c.state,
               c.tower_id,
               aaa.id as c_id,
               aaa.device_id as c_device_id,
               aaa.name as c_name,
               aaa.chan_no as c_chan_no
               FROM ard_camera_user_postion p
            LEFT JOIN ard_cameras c ON c.id = p.camera_id
            LEFT JOIN ard_channel aaa on c.id = aaa.device_id
        where p.user_id = #{userId} and p.position = #{position}
    </select>
    
    <select id="selectArdCameraUserPostionById" parameterType="String" resultMap="ArdCameraUserPostionResult">
        <include refid="selectArdCameraUserPostionVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertArdCameraUserPostion" parameterType="ArdCameraUserPostion">
        insert into ard_camera_user_postion
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="cameraId != null">camera_id,</if>
            <if test="chanNo != null">chan_no,</if>
            <if test="userId != null">user_id,</if>
            <if test="position != null">position,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="cameraId != null">#{cameraId},</if>
            <if test="chanNo != null">#{chanNo},</if>
            <if test="userId != null">#{userId},</if>
            <if test="position != null">#{position},</if>
         </trim>
    </insert>
 
    <update id="updateArdCameraUserPostion" parameterType="ArdCameraUserPostion">
        update ard_camera_user_postion
        <trim prefix="SET" suffixOverrides=",">
            <if test="cameraId != null">camera_id = #{cameraId},</if>
            <if test="chanNo != null">chan_no = #{chanNo},</if>
            <if test="userId != null">user_id = #{userId},</if>
            <if test="position != null">position = #{position},</if>
        </trim>
        where position = #{position} and user_id = #{userId}
    </update>
 
    <delete id="deleteArdCameraUserPostionById" parameterType="String">
        delete from ard_camera_user_postion where id = #{id}
    </delete>
 
    <delete id="deleteArdCameraUserPostionByIds" parameterType="String">
        delete from ard_camera_user_postion where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>