| | |
| | | <result property="gdtype" column="gdtype"/>
|
| | | <result property="factory" column="factory"/>
|
| | | <result property="chanNum" column="channel"/>
|
| | | <result property="startChan" column="start_chan"/>
|
| | | <result property="longitude" column="longitude"/>
|
| | | <result property="latitude" column="latitude"/>
|
| | | <result property="altitude" column="altitude"/>
|
| | |
| | | c.gdtype,
|
| | | c.factory,
|
| | | c.channel,
|
| | | c.start_chan,
|
| | | c.longitude,
|
| | | c.latitude,
|
| | | c.altitude,
|
| | |
| | | <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="startChan != null ">and c.start_chan = #{startChan}</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>
|
| | |
| | | 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"/>
|
| | |
| | | <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="startChan != null ">and c.start_chan= #{startChan}</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="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">
|
| | |
| | | <if test="factory != null">factory,</if>
|
| | | <if test="towerId != null">tower_id,</if>
|
| | | <if test="chanNum != null">channel,</if>
|
| | | <if test="startChan != null">start_chan,</if>
|
| | | <if test="longitude != null">longitude,</if>
|
| | | <if test="latitude != null">latitude,</if>
|
| | | <if test="altitude != null">altitude,</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="factory != null">#{factory},</if>
|
| | | <if test="towerId != null">#{towerId},</if>
|
| | | <if test="chanNum != null">#{chanNum},</if>
|
| | | <if test="startChan != null">#{startChan},</if>
|
| | | <if test="longitude != null">#{longitude},</if>
|
| | | <if test="latitude != null">#{latitude},</if>
|
| | | <if test="altitude != null">#{altitude},</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>
|
| | |
|
| | |
| | | <if test="factory != null">factory = #{factory},</if>
|
| | | <if test="towerId != null">tower_id = #{towerId},</if>
|
| | | <if test="chanNum != null">channel = #{chanNum},</if>
|
| | | <if test="startChan != null">start_chan = #{startChan},</if>
|
| | | <if test="longitude != null">longitude = #{longitude},</if>
|
| | | <if test="latitude != null">latitude = #{latitude},</if>
|
| | | <if test="altitude != null">altitude = #{altitude},</if>
|
| | |
| | | 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 id="checkCameraIpAndPortUnique" resultMap="ArdCamerasResult">
|
| | | select *
|
| | | from ard_cameras
|
| | | where ip = #{ip}
|
| | | and port = #{port} limit 1
|
| | | </select>
|
| | | </mapper> |
| | | <!--<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&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&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&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&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&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>
|
| | | <update id="resetCameraLoginId">
|
| | | update ard_cameras set login_id = -1
|
| | | </update>
|
| | | </mapper>
|