From 775524110885e27fe860be1feb156ca78b5040b2 Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期六, 06 七月 2024 14:10:57 +0800
Subject: [PATCH] 电子围栏分页查询修改提交

---
 ard-work/src/main/resources/mapper/device/ArdCamerasMapper.xml |  690 ++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 409 insertions(+), 281 deletions(-)

diff --git a/ard-work/src/main/resources/mapper/device/ArdCamerasMapper.xml b/ard-work/src/main/resources/mapper/device/ArdCamerasMapper.xml
index 421252d..78083d2 100644
--- a/ard-work/src/main/resources/mapper/device/ArdCamerasMapper.xml
+++ b/ard-work/src/main/resources/mapper/device/ArdCamerasMapper.xml
@@ -1,281 +1,409 @@
-<?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.ArdCamerasMapper">
-
-    <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"/>
-    </resultMap>
-
-    <sql id="selectArdCamerasVo">
-        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
-        from ard_cameras c
-                 left join sys_dept d on d.dept_id = c.dept_id
-                 left join sys_user u on u.user_id = c.user_id
-    </sql>
-
-    <select id="selectArdCamerasList" parameterType="ArdCameras" resultMap="ArdCamerasResult">
-        <include refid="selectArdCamerasVo"/>
-        <where>
-            <if test="id != null  and id != ''">and c.id = #{id}</if>
-            <if test="name != null  and name != ''">and c.name like '%'||#{name}||'%'</if>
-            <if test="ip != null  and ip != ''">and c.ip = #{ip}</if>
-            <if test="port != null ">and c.port = #{port}</if>
-            <if test="rtspPort != null ">and c.rtsp_port = #{rtspPort}</if>
-            <if test="username != null  and username != ''">and c.username like '%'||#{username}||'%'</if>
-            <if test="password != null  and password != ''">and c.password = #{password}</if>
-            <if test="gdtype != null  and gdtype != ''">and c.gdtype = #{gdtype}</if>
-            <if test="factory != null  and factory != ''">and c.factory = #{factory}</if>
-            <if test="chanNum != null ">and c.channel = #{chanNum}</if>
-            <if test="longitude != null ">and c.longitude = #{longitude}</if>
-            <if test="latitude != null ">and c.latitude = #{latitude}</if>
-            <if test="altitude != null ">and c.altitude = #{altitude}</if>
-            <if test="camHeading != null ">and c.cam_heading = #{camHeading}</if>
-            <if test="camPitch != null ">and c.cam_pitch = #{camPitch}</if>
-            <if test="camRoll != null ">and c.cam_roll = #{camRoll}</if>
-            <if test="camNear != null ">and c.cam_near = #{camNear}</if>
-            <if test="camFar != null ">and c.cam_far = #{camFar}</if>
-            <if test="camAspectratio != null ">and c.cam_aspectratio = #{camAspectratio}</if>
-            <if test="camDepth != null ">and c.cam_depth = #{camDepth}</if>
-            <if test="camFov != null ">and c.cam_fov = #{camFov}</if>
-            <if test="camMaxVisibleDistance != null ">and c.cam_max_visible_distance = #{camMaxVisibleDistance}</if>
-            <if test="camAlarmGuideEnable != null ">and c.cam_alarm_guide_enable = #{camAlarmGuideEnable}</if>
-            <if test="loginId != null ">and c.login_id = #{loginId}</if>
-            <if test="deptId != null ">and (d.dept_id = #{deptId} OR d.dept_id IN ( SELECT t.dept_id FROM sys_dept t
-                WHERE cast(#{deptId} as varchar) = any(string_to_array(ancestors,',')) ))
-            </if>
-            <!-- 鏁版嵁鑼冨洿杩囨护 -->
-            ${params.dataScope}
-        </where>
-    </select>
-    <select id="selectArdCamerasListNoDataScope" parameterType="ArdCameras" resultMap="ArdCamerasResult">
-        <include refid="selectArdCamerasVo"/>
-        <where>
-            <if test="id != null  and id != ''">and c.id = #{id}</if>
-            <if test="name != null  and name != ''">and c.name like '%'||#{name}||'%'</if>
-            <if test="ip != null  and ip != ''">and c.ip = #{ip}</if>
-            <if test="port != null ">and c.port = #{port}</if>
-            <if test="rtspPort != null ">and c.rtsp_port = #{rtspPort}</if>
-            <if test="username != null  and username != ''">and c.username like '%'||#{username}||'%'</if>
-            <if test="password != null  and password != ''">and c.password = #{password}</if>
-            <if test="gdtype != null  and gdtype != ''">and c.gdtype = #{gdtype}</if>
-            <if test="factory != null  and factory != ''">and c.factory = #{factory}</if>
-            <if test="chanNum != null ">and c.channel = #{chanNum}</if>
-            <if test="longitude != null ">and c.longitude = #{longitude}</if>
-            <if test="latitude != null ">and c.latitude = #{latitude}</if>
-            <if test="altitude != null ">and c.altitude = #{altitude}</if>
-            <if test="userId != null  and userId != ''">and c.user_id = #{userId}</if>
-            <if test="deptId != null ">and (c.dept_id = #{deptId} OR c.dept_id IN ( SELECT t.dept_id FROM sys_dept t
-                WHERE cast(#{deptId} as varchar) = any(string_to_array(ancestors,',')) ))
-            </if>
-            <if test="camHeading != null ">and c.cam_heading = #{camHeading}</if>
-            <if test="camPitch != null ">and c.cam_pitch = #{camPitch}</if>
-            <if test="camRoll != null ">and c.cam_roll = #{camRoll}</if>
-            <if test="camNear != null ">and c.cam_near = #{camNear}</if>
-            <if test="camFar != null ">and c.cam_far = #{camFar}</if>
-            <if test="camAspectratio != null ">and c.cam_aspectratio = #{camAspectratio}</if>
-            <if test="camDepth != null ">and c.cam_depth = #{camDepth}</if>
-            <if test="camFov != null ">and c.cam_fov = #{camFov}</if>
-            <if test="camMaxVisibleDistance != null ">and c.cam_max_visible_distance = #{camMaxVisibleDistance}</if>
-            <if test="camAlarmGuideEnable != null ">and c.cam_alarm_guide_enable = #{camAlarmGuideEnable}</if>
-            <if test="loginId != null ">and c.login_id = #{loginId}</if>
-        </where>
-    </select>
-    <select id="selectArdCamerasById" parameterType="String" resultMap="ArdCamerasResult">
-        <include refid="selectArdCamerasVo"/>
-        where id = #{id}
-    </select>
-
-    <insert id="insertArdCameras" parameterType="ArdCameras">
-        insert into ard_cameras
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="id != null">id,</if>
-            <if test="name != null">name,</if>
-            <if test="ip != null">ip,</if>
-            <if test="port != null">port,</if>
-            <if test="rtspPort != null ">rtsp_port,</if>
-            <if test="username != null">username,</if>
-            <if test="password != null">password,</if>
-            <if test="gdtype != null">gdtype,</if>
-            <if test="factory != null">factory,</if>
-            <if test="chanNum != null">channel,</if>
-            <if test="longitude != null">longitude,</if>
-            <if test="latitude != null">latitude,</if>
-            <if test="altitude != null">altitude,</if>
-            <if test="camHeading != null">cam_heading,</if>
-            <if test="camPitch != null">cam_pitch,</if>
-            <if test="camRoll != null">cam_roll,</if>
-            <if test="camNear != null">cam_near,</if>
-            <if test="camFar != null">cam_far,</if>
-            <if test="camAspectratio != null">cam_aspectratio,</if>
-            <if test="camDepth != null">cam_depth,</if>
-            <if test="camFov != null">cam_fov,</if>
-            <if test="camMaxVisibleDistance != null ">cam_max_visible_distance,</if>
-            <if test="camAlarmGuideEnable != null">cam_alarm_guide_enable,</if>
-            <if test="loginId != null">login_id,</if>
-            <if test="deptId != null">dept_id,</if>
-            <if test="userId != null">user_id,</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>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="id != null">#{id},</if>
-            <if test="name != null">#{name},</if>
-            <if test="ip != null">#{ip},</if>
-            <if test="port != null">#{port},</if>
-            <if test="rtspPort != null ">#{rtspPort},</if>
-            <if test="username != null">#{username},</if>
-            <if test="password != null">#{password},</if>
-            <if test="gdtype != null">#{gdtype},</if>
-            <if test="factory != null">#{factory},</if>
-            <if test="chanNum != null">#{chanNum},</if>
-            <if test="longitude != null">#{longitude},</if>
-            <if test="latitude != null">#{latitude},</if>
-            <if test="altitude != null">#{altitude},</if>
-            <if test="camHeading != null">#{camHeading},</if>
-            <if test="camPitch != null">#{camPitch},</if>
-            <if test="camRoll != null">#{camRoll},</if>
-            <if test="camNear != null">#{camNear},</if>
-            <if test="camFar != null">#{camFar},</if>
-            <if test="camAspectratio != null">#{camAspectratio},</if>
-            <if test="camDepth != null">#{camDepth},</if>
-            <if test="camFov != null">#{camFov},</if>
-            <if test="camMaxVisibleDistance != null ">#{camMaxVisibleDistance},</if>
-            <if test="camAlarmGuideEnable != null">#{camAlarmGuideEnable},</if>
-            <if test="loginId != null">#{loginId},</if>
-            <if test="deptId != null">#{deptId},</if>
-            <if test="userId != null">#{userId},</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>
-        </trim>
-    </insert>
-
-    <update id="updateArdCameras" parameterType="ArdCameras">
-        update ard_cameras
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="name != null">name = #{name},</if>
-            <if test="ip != null">ip = #{ip},</if>
-            <if test="port != null">port = #{port},</if>
-            <if test="rtspPort != null ">rtsp_port= #{rtspPort},</if>
-            <if test="username != null">username = #{username},</if>
-            <if test="password != null">password = #{password},</if>
-            <if test="gdtype != null">gdtype = #{gdtype},</if>
-            <if test="factory != null">factory = #{factory},</if>
-            <if test="chanNum != null">channel = #{chanNum},</if>
-            <if test="longitude != null">longitude = #{longitude},</if>
-            <if test="latitude != null">latitude = #{latitude},</if>
-            <if test="altitude != null">altitude = #{altitude},</if>
-            <if test="camHeading != null">cam_heading = #{camHeading},</if>
-            <if test="camPitch != null">cam_pitch = #{camPitch},</if>
-            <if test="camRoll != null">cam_roll = #{camRoll},</if>
-            <if test="camNear != null">cam_near = #{camNear},</if>
-            <if test="camFar != null">cam_far = #{camFar},</if>
-            <if test="camAspectratio != null">cam_aspectratio = #{camAspectratio},</if>
-            <if test="camDepth != null">cam_depth = #{camDepth},</if>
-            <if test="camFov != null">cam_fov = #{camFov},</if>
-            <if test="camMaxVisibleDistance != null ">cam_max_visible_distance = #{camMaxVisibleDistance},</if>
-            <if test="camAlarmGuideEnable != null">cam_alarm_guide_enable = #{camAlarmGuideEnable},</if>
-            <if test="loginId != null">login_id = #{loginId},</if>
-            <if test="deptId != null">dept_id = #{deptId},</if>
-            <if test="userId != null">user_id = #{userId},</if>
-            <if test="createBy != null">create_by = #{createBy},</if>
-            <if test="createTime != null">create_time = #{createTime},</if>
-            <if test="updateBy != null">update_by = #{updateBy},</if>
-            <if test="updateTime != null">update_time = #{updateTime},</if>
-            <if test="operatorId != null">operator_id = #{operatorId},</if>
-            <if test="operatorExpired != null">operator_expired = #{operatorExpired},</if>
-            <if test="state != null">state = #{state},</if>
-        </trim>
-        where id = #{id}
-    </update>
-
-    <delete id="deleteArdCamerasById" parameterType="String">
-        delete
-        from ard_cameras
-        where id = #{id}
-    </delete>
-
-    <delete id="deleteArdCamerasByIds" parameterType="String">
-        delete from ard_cameras where id in
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
-
-    <select id="findOptions" parameterType="String" resultMap="ArdCamerasResult">
-        <include refid="selectArdCamerasVo"/>
-        <where>
-            <if test="id != null  and id != ''">and c.id = #{id}</if>
-            <if test="name != null  and name != ''">and c.name like '%'||#{name}||'%'</if>
-        </where>
-    </select>
-    <select id="selectArdCamerasByDeptId" parameterType="Long" resultMap="ArdCamerasResult">
-        select *
-        from ard_cameras
-        where dept_id = #{deptId}
-    </select>
-    <select id="checkCameraIpAndPortUnique"  resultMap="ArdCamerasResult">
-        select * from ard_cameras where ip=#{ip} and port=#{port} limit 1
-    </select>
-</mapper>
\ No newline at end of file
+<?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.ArdCamerasMapper">
+
+    <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"/>
+    </resultMap>
+
+    <sql id="selectArdCamerasVo">
+        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
+        from ard_cameras c
+                 left join sys_dept d on d.dept_id = c.dept_id
+                 left join sys_user u on u.user_id = c.user_id
+    </sql>
+
+    <select id="selectArdCamerasList" parameterType="ArdCameras" resultMap="ArdCamerasResult">
+        <include refid="selectArdCamerasVo"/>
+        <where>
+            <if test="id != null  and id != ''">and c.id = #{id}</if>
+            <if test="name != null  and name != ''">and c.name like '%'||#{name}||'%'</if>
+            <if test="ip != null  and ip != ''">and c.ip = #{ip}</if>
+            <if test="port != null ">and c.port = #{port}</if>
+            <if test="rtspPort != null ">and c.rtsp_port = #{rtspPort}</if>
+            <if test="username != null  and username != ''">and c.username like '%'||#{username}||'%'</if>
+            <if test="password != null  and password != ''">and c.password = #{password}</if>
+            <if test="gdtype != null  and gdtype != ''">and c.gdtype = #{gdtype}</if>
+            <if test="factory != null  and factory != ''">and c.factory = #{factory}</if>
+            <if test="chanNum != null ">and c.channel = #{chanNum}</if>
+            <if test="longitude != null ">and c.longitude = #{longitude}</if>
+            <if test="latitude != null ">and c.latitude = #{latitude}</if>
+            <if test="altitude != null ">and c.altitude = #{altitude}</if>
+            <if test="camHeading != null ">and c.cam_heading = #{camHeading}</if>
+            <if test="camPitch != null ">and c.cam_pitch = #{camPitch}</if>
+            <if test="camRoll != null ">and c.cam_roll = #{camRoll}</if>
+            <if test="camNear != null ">and c.cam_near = #{camNear}</if>
+            <if test="camFar != null ">and c.cam_far = #{camFar}</if>
+            <if test="camAspectratio != null ">and c.cam_aspectratio = #{camAspectratio}</if>
+            <if test="camDepth != null ">and c.cam_depth = #{camDepth}</if>
+            <if test="camFov != null ">and c.cam_fov = #{camFov}</if>
+            <if test="camMaxVisibleDistance != null ">and c.cam_max_visible_distance = #{camMaxVisibleDistance}</if>
+            <if test="camAlarmGuideEnable != null ">and c.cam_alarm_guide_enable = #{camAlarmGuideEnable}</if>
+            <if test="loginId != null ">and c.login_id = #{loginId}</if>
+            <if test="deptId != null ">and (d.dept_id = #{deptId} OR d.dept_id IN ( SELECT t.dept_id FROM sys_dept t
+                WHERE cast(#{deptId} as varchar) = any(string_to_array(ancestors,',')) ))
+            </if>
+            <if test="towerId != null ">and c.tower_id = #{towerId}</if>
+            <if test="state != null ">and c.state = #{state}</if>
+            <!-- 鏁版嵁鑼冨洿杩囨护 -->
+            ${params.dataScope}
+        </where>
+        order  by c.name
+    </select>
+    <select id="selectArdCamerasListNoDataScope" parameterType="ArdCameras" resultMap="ArdCamerasResult">
+        <include refid="selectArdCamerasVo"/>
+        <where>
+            <if test="id != null  and id != ''">and c.id = #{id}</if>
+            <if test="name != null  and name != ''">and c.name like '%'||#{name}||'%'</if>
+            <if test="ip != null  and ip != ''">and c.ip = #{ip}</if>
+            <if test="port != null ">and c.port = #{port}</if>
+            <if test="rtspPort != null ">and c.rtsp_port = #{rtspPort}</if>
+            <if test="username != null  and username != ''">and c.username like '%'||#{username}||'%'</if>
+            <if test="password != null  and password != ''">and c.password = #{password}</if>
+            <if test="gdtype != null  and gdtype != ''">and c.gdtype = #{gdtype}</if>
+            <if test="factory != null  and factory != ''">and c.factory = #{factory}</if>
+            <if test="chanNum != null ">and c.channel = #{chanNum}</if>
+            <if test="longitude != null ">and c.longitude = #{longitude}</if>
+            <if test="latitude != null ">and c.latitude = #{latitude}</if>
+            <if test="altitude != null ">and c.altitude = #{altitude}</if>
+            <if test="userId != null  and userId != ''">and c.user_id = #{userId}</if>
+            <if test="deptId != null ">and (c.dept_id = #{deptId} OR c.dept_id IN ( SELECT t.dept_id FROM sys_dept t
+                WHERE cast(#{deptId} as varchar) = any(string_to_array(ancestors,',')) ))
+            </if>
+            <if test="camHeading != null ">and c.cam_heading = #{camHeading}</if>
+            <if test="camPitch != null ">and c.cam_pitch = #{camPitch}</if>
+            <if test="camRoll != null ">and c.cam_roll = #{camRoll}</if>
+            <if test="camNear != null ">and c.cam_near = #{camNear}</if>
+            <if test="camFar != null ">and c.cam_far = #{camFar}</if>
+            <if test="camAspectratio != null ">and c.cam_aspectratio = #{camAspectratio}</if>
+            <if test="camDepth != null ">and c.cam_depth = #{camDepth}</if>
+            <if test="camFov != null ">and c.cam_fov = #{camFov}</if>
+            <if test="camMaxVisibleDistance != null ">and c.cam_max_visible_distance = #{camMaxVisibleDistance}</if>
+            <if test="camAlarmGuideEnable != null ">and c.cam_alarm_guide_enable = #{camAlarmGuideEnable}</if>
+            <if test="loginId != null ">and c.login_id = #{loginId}</if>
+            <if test="state != null ">and c.state = #{state}</if>
+        </where>
+    </select>
+    <select id="selectArdCamerasById" parameterType="String" resultMap="ArdCamerasResult">
+        <include refid="selectArdCamerasVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertArdCameras" parameterType="ArdCameras">
+        insert into ard_cameras
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="name != null">name,</if>
+            <if test="ip != null">ip,</if>
+            <if test="port != null">port,</if>
+            <if test="rtspPort != null ">rtsp_port,</if>
+            <if test="username != null">username,</if>
+            <if test="password != null">password,</if>
+            <if test="gdtype != null">gdtype,</if>
+            <if test="factory != null">factory,</if>
+            <if test="towerId != null">tower_id,</if>
+            <if test="chanNum != null">channel,</if>
+            <if test="longitude != null">longitude,</if>
+            <if test="latitude != null">latitude,</if>
+            <if test="altitude != null">altitude,</if>
+            <if test="camHeading != null">cam_heading,</if>
+            <if test="camPitch != null">cam_pitch,</if>
+            <if test="camRoll != null">cam_roll,</if>
+            <if test="camNear != null">cam_near,</if>
+            <if test="camFar != null">cam_far,</if>
+            <if test="camAspectratio != null">cam_aspectratio,</if>
+            <if test="camDepth != null">cam_depth,</if>
+            <if test="camFov != null">cam_fov,</if>
+            <if test="camMaxVisibleDistance != null ">cam_max_visible_distance,</if>
+            <if test="camAlarmGuideEnable != null">cam_alarm_guide_enable,</if>
+            <if test="loginId != null">login_id,</if>
+            <if test="deptId != null">dept_id,</if>
+            <if test="userId != null">user_id,</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="state != null">state,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="name != null">#{name},</if>
+            <if test="ip != null">#{ip},</if>
+            <if test="port != null">#{port},</if>
+            <if test="rtspPort != null ">#{rtspPort},</if>
+            <if test="username != null">#{username},</if>
+            <if test="password != null">#{password},</if>
+            <if test="gdtype != null">#{gdtype},</if>
+            <if test="factory != null">#{factory},</if>
+            <if test="towerId != null">#{towerId},</if>
+            <if test="chanNum != null">#{chanNum},</if>
+            <if test="longitude != null">#{longitude},</if>
+            <if test="latitude != null">#{latitude},</if>
+            <if test="altitude != null">#{altitude},</if>
+            <if test="camHeading != null">#{camHeading},</if>
+            <if test="camPitch != null">#{camPitch},</if>
+            <if test="camRoll != null">#{camRoll},</if>
+            <if test="camNear != null">#{camNear},</if>
+            <if test="camFar != null">#{camFar},</if>
+            <if test="camAspectratio != null">#{camAspectratio},</if>
+            <if test="camDepth != null">#{camDepth},</if>
+            <if test="camFov != null">#{camFov},</if>
+            <if test="camMaxVisibleDistance != null ">#{camMaxVisibleDistance},</if>
+            <if test="camAlarmGuideEnable != null">#{camAlarmGuideEnable},</if>
+            <if test="loginId != null">#{loginId},</if>
+            <if test="deptId != null">#{deptId},</if>
+            <if test="userId != null">#{userId},</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="state != null">#{state},</if>
+        </trim>
+    </insert>
+
+    <update id="updateArdCameras" parameterType="ArdCameras">
+        update ard_cameras
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="name != null">name = #{name},</if>
+            <if test="ip != null">ip = #{ip},</if>
+            <if test="port != null">port = #{port},</if>
+            <if test="rtspPort != null ">rtsp_port= #{rtspPort},</if>
+            <if test="username != null">username = #{username},</if>
+            <if test="password != null">password = #{password},</if>
+            <if test="gdtype != null">gdtype = #{gdtype},</if>
+            <if test="factory != null">factory = #{factory},</if>
+            <if test="towerId != null">tower_id = #{towerId},</if>
+            <if test="chanNum != null">channel = #{chanNum},</if>
+            <if test="longitude != null">longitude = #{longitude},</if>
+            <if test="latitude != null">latitude = #{latitude},</if>
+            <if test="altitude != null">altitude = #{altitude},</if>
+            <if test="camHeading != null">cam_heading = #{camHeading},</if>
+            <if test="camPitch != null">cam_pitch = #{camPitch},</if>
+            <if test="camRoll != null">cam_roll = #{camRoll},</if>
+            <if test="camNear != null">cam_near = #{camNear},</if>
+            <if test="camFar != null">cam_far = #{camFar},</if>
+            <if test="camAspectratio != null">cam_aspectratio = #{camAspectratio},</if>
+            <if test="camDepth != null">cam_depth = #{camDepth},</if>
+            <if test="camFov != null">cam_fov = #{camFov},</if>
+            <if test="camMaxVisibleDistance != null ">cam_max_visible_distance = #{camMaxVisibleDistance},</if>
+            <if test="camAlarmGuideEnable != null">cam_alarm_guide_enable = #{camAlarmGuideEnable},</if>
+            <if test="loginId != null">login_id = #{loginId},</if>
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="operatorId != null">operator_id = #{operatorId},</if>
+            <if test="operatorExpired != null">operator_expired = #{operatorExpired},</if>
+            <if test="state != null">state = #{state},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteArdCamerasById" parameterType="String">
+        delete
+        from ard_cameras
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteArdCamerasByIds" parameterType="String">
+        delete from ard_cameras where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="findOptions" parameterType="String" resultMap="ArdCamerasResult">
+        <include refid="selectArdCamerasVo"/>
+        <where>
+            <if test="id != null  and id != ''">and c.id = #{id}</if>
+            <if test="name != null  and name != ''">and c.name like '%'||#{name}||'%'</if>
+        </where>
+    </select>
+    <select id="selectArdCamerasByDeptId" parameterType="Long" resultMap="ArdCamerasResult">
+        select *
+        from ard_cameras
+        where dept_id = #{deptId}
+    </select>
+    <select id="checkCameraIpAndPortUnique" resultMap="ArdCamerasResult">
+        select *
+        from ard_cameras
+        where ip = #{ip}
+          and port = #{port} limit 1
+    </select>
+    <!--<select id="getCamerasByDeptId" resultType="java.util.Map" >
+        select distinct * from (
+           with recursive rsd as (
+               select ac.id,ac.name,ac.ip,ac.port,ac.username,ac.password,ac.longitude,ac.latitude,ac.altitude,ac.channel,ac.dept_id as "deptId",
+                      ac.gdtype,ac.state,sdd.dict_label as "dictLabel",sdd0.dict_label as factory,
+                      case sdd0.dict_label
+                          when '娴峰悍' then concat('rtsp://',ac.username,':',ac.password,'@',ac.ip,':',ac.rtsp_port,'/h264/ch1/main/av_stream')
+                          when '澶у崕' then concat('rtsp://',ac.username,':',ac.password,'@',ac.ip,':',ac.rtsp_port,'/cam/realmonitor?channel=1&amp;subtype=1')
+                          end as rtsp
+               from sys_dept sd
+                        inner join ard_cameras ac on sd.dept_id = ac.dept_id
+                        inner join sys_dict_data sdd on ac.gdtype = sdd.dict_value
+                        inner join sys_dict_type sdt on sdd.dict_type = sdt.dict_type
+                        inner join sys_dict_data sdd0 on ac.factory = sdd0.dict_value
+                        inner join sys_dict_type sdt0 on sdd0.dict_type = sdt0.dict_type
+               where sd.dept_id = #{deptId}
+                 and sdt.dict_type = 'camera_type' and (sdd.dict_label = '灏忓厜鐢�' or sdd.dict_label = '澶у厜鐢�')
+                 and sdt0.dict_type = 'factory'
+               union
+               select ac.id,ac.name,ac.ip,ac.port,ac.username,ac.password,ac.longitude,ac.latitude,ac.altitude,ac.channel,ac.dept_id as "deptId",
+                      ac.gdtype,ac.state,sdd.dict_label as "dictLabel",sdd0.dict_label as factory,
+                      case sdd0.dict_label
+                          when '娴峰悍' then concat('rtsp://',ac.username,':',ac.password,'@',ac.ip,':',ac.rtsp_port,'/h264/ch1/main/av_stream')
+                          when '澶у崕' then concat('rtsp://',ac.username,':',ac.password,'@',ac.ip,':',ac.rtsp_port,'/cam/realmonitor?channel=1&amp;subtype=1')
+                          end as rtsp
+               from sys_dept csd
+                        inner join rsd on rsd."deptId" = csd.parent_id
+                        inner join ard_cameras ac on csd.dept_id = ac.dept_id
+                        inner join sys_dict_data sdd on ac.gdtype = sdd.dict_value
+                        inner join sys_dict_type sdt on sdd.dict_type = sdt.dict_type
+                        inner join sys_dict_data sdd0 on ac.factory = sdd0.dict_value
+                        inner join sys_dict_type sdt0 on sdd0.dict_type = sdt0.dict_type
+                   and sdt.dict_type = 'camera_type' and (sdd.dict_label = '灏忓厜鐢�' or sdd.dict_label = '澶у厜鐢�')
+                   and sdt0.dict_type = 'factory')
+           select * from rsd
+           union
+           select ac.id,ac.name,ac.ip,ac.port,ac.username,ac.password,ac.longitude,ac.latitude,ac.altitude,ac.channel,ac.dept_id as "deptId",
+                  ac.gdtype,ac.state,sdd.dict_label as "dictLabel",sdd0.dict_label as factory,
+                  case sdd0.dict_label
+                      when '娴峰悍' then concat('rtsp://',ac.username,':',ac.password,'@',ac.ip,':',ac.rtsp_port,'/h264/ch1/main/av_stream')
+                      when '澶у崕' then concat('rtsp://',ac.username,':',ac.password,'@',ac.ip,':',ac.rtsp_port,'/cam/realmonitor?channel=1&amp;subtype=1')
+                      end as rtsp from sys_user_role sur
+                                           inner join sys_role_dept srd on sur.role_id = srd.role_id
+                                           inner join ard_cameras ac on srd.dept_id = ac.dept_id
+                                           inner join sys_dict_data sdd on ac.gdtype = sdd.dict_value
+                                           inner join sys_dict_type sdt on sdd.dict_type = sdt.dict_type
+                                           inner join sys_dict_data sdd0 on ac.factory = sdd0.dict_value
+                                           inner join sys_dict_type sdt0 on sdd0.dict_type = sdt0.dict_type
+           where sur.user_id = #{userId} and sdt.dict_type = 'camera_type' and (sdd.dict_label = '灏忓厜鐢�' or sdd.dict_label = '澶у厜鐢�') and sdt0.dict_type = 'factory'
+       )t order by "dictLabel"
+    </select>-->
+    <select id="getCamerasByDeptId" resultType="java.util.Map" >
+        select distinct * from (
+           select ac.id,ac.name,ac.ip,ac.port,ac.username,ac.password,ac.longitude,ac.latitude,ac.altitude,ac.channel,ac.dept_id as "deptId",
+                  ac.gdtype,ac.state,sdd.dict_label as "dictLabel",sdd0.dict_label as factory,
+                  case sdd0.dict_label
+                      when '娴峰悍' then concat('rtsp://',ac.username,':',ac.password,'@',ac.ip,':',ac.rtsp_port,'/h264/ch1/main/av_stream')
+                      when '澶у崕' then concat('rtsp://',ac.username,':',ac.password,'@',ac.ip,':',ac.rtsp_port,'/cam/realmonitor?channel=1&amp;subtype=0')
+                      end as rtsp
+           from  ard_cameras ac
+                    inner join sys_dict_data sdd on ac.gdtype = sdd.dict_value
+                    inner join sys_dict_type sdt on sdd.dict_type = sdt.dict_type
+                    inner join sys_dict_data sdd0 on ac.factory = sdd0.dict_value
+                    inner join sys_dict_type sdt0 on sdd0.dict_type = sdt0.dict_type
+           where ac.dept_id in
+           <foreach collection="deptIdList" open="(" close=")" separator="," item="deptId">
+               #{deptId}
+           </foreach>
+           and sdt.dict_type = 'camera_type' and (sdd.dict_label = '灏忓厜鐢�' or sdd.dict_label = '澶у厜鐢�')
+           and sdt0.dict_type = 'factory'
+           union
+           select ac.id,ac.name,ac.ip,ac.port,ac.username,ac.password,ac.longitude,ac.latitude,ac.altitude,ac.channel,ac.dept_id as "deptId",
+                  ac.gdtype,ac.state,sdd.dict_label as "dictLabel",sdd0.dict_label as factory,
+                  case sdd0.dict_label
+                      when '娴峰悍' then concat('rtsp://',ac.username,':',ac.password,'@',ac.ip,':',ac.rtsp_port,'/h264/ch1/main/av_stream')
+                      when '澶у崕' then concat('rtsp://',ac.username,':',ac.password,'@',ac.ip,':',ac.rtsp_port,'/cam/realmonitor?channel=1&amp;subtype=0')
+                      end as rtsp from sys_user_role sur
+                                           inner join sys_role_dept srd on sur.role_id = srd.role_id
+                                           inner join ard_cameras ac on srd.dept_id = ac.dept_id
+                                           inner join sys_dict_data sdd on ac.gdtype = sdd.dict_value
+                                           inner join sys_dict_type sdt on sdd.dict_type = sdt.dict_type
+                                           inner join sys_dict_data sdd0 on ac.factory = sdd0.dict_value
+                                           inner join sys_dict_type sdt0 on sdd0.dict_type = sdt0.dict_type
+           where sur.user_id = #{userId} and sdt.dict_type = 'camera_type' and (sdd.dict_label = '灏忓厜鐢�' or sdd.dict_label = '澶у厜鐢�') and sdt0.dict_type = 'factory'
+       )t order by "dictLabel"
+    </select>
+    <select id="getCameraOperationByCameraId" resultType="java.lang.Boolean" parameterType="java.lang.String">
+        select
+            case now() > ac.operator_expired or ac.operator_expired is null
+                when true then true
+                when (
+                    case ((select cast(su.camera_priority as integer) from sys_user su
+                           where su.user_id = #{userId}) > (select cast(su.camera_priority as integer) from sys_user su
+                                                      inner join ard_cameras ac on su.user_id = ac.operator_id
+                                                      where ac.id = #{id} ))
+                        when true then true
+                        when false then false end) then false
+                end
+        from ard_cameras ac
+        where ac.id = #{id}
+    </select>
+    <select id="getChannelByCameraId" resultType="java.util.Map" parameterType="java.lang.String">
+        select * from ard_channel ac
+        inner join sys_config sc on sc.config_key = 'dayNightTime'
+        where ac.device_id = #{id}
+    </select>
+    <select id="findTowerCamerasBySubAndOwnDeptIds" parameterType="java.lang.String" resultMap = "ArdCamerasResult">
+        select * from ard_cameras where dept_id in
+        <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
+            #{deptId}
+        </foreach>
+        and tower_id is not null
+        order by create_time desc
+    </select>
+</mapper>

--
Gitblit v1.9.3