<?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.qs.mapper.QsDeviceMapper">
|
|
<resultMap type="QsDevice" id="QsDeviceResult">
|
<result property="id" column="id"/>
|
<result property="deviceCode" column="device_code"/>
|
<result property="deviceName" column="device_name"/>
|
<result property="ipAddress" column="ip_address"/>
|
<result property="port" column="port"/>
|
<result property="userName" column="user_name"/>
|
<result property="password" column="password"/>
|
<result property="type" column="type"/>
|
<result property="deviceType" column="device_type"/>
|
<result property="liveAddress" column="live_address"/>
|
<result property="channel" column="channel"/>
|
<result property="alarmChannelId" column="alarm_channel_id"/>
|
<result property="status" column="status"/>
|
<result property="streamType" column="stream_type"/>
|
<result property="longitude" column="longitude"/>
|
<result property="latitude" column="latitude"/>
|
<result property="gbCode" column="gb_code"/>
|
<result property="protocol" column="protocol"/>
|
<result property="deviceStatus" column="device_status"/>
|
<result property="onlineType" column="online_type"/>
|
<result property="enableAudio" column="enable_audio"/>
|
<result property="enableMp4" column="enable_mp4"/>
|
<result property="streamStatus" column="stream_status"/>
|
<result property="mediaServerId" column="media_serverId"/>
|
<result property="streamKey" column="stream_key"/>
|
<result property="enableDisableNoneReader" column="enable_disable_none_reader"/>
|
<result property="snap" column="snap"/>
|
<result property="flvType" column="flv_type"/>
|
<result property="onvifAuth" column="onvif_auth"/>
|
<result property="onvifHostName" column="onvif_host_name"/>
|
<result property="recordPlanId" column="record_plan_id"/>
|
<result property="gbCivilCode" column="gb_civil_code"/>
|
<result property="gbBusinessGroupId" column="gb_business_group_id"/>
|
<result property="gbParentId" column="gb_parent_id"/>
|
<result property="manufacturer" column="manufacturer"/>
|
<result property="address" column="address"/>
|
<result property="ptzType" column="ptz_type"/>
|
<result property="gbDeviceId" column="gb_device_id"/>
|
<result property="gbChannelId" column="gb_channel_id"/>
|
<result property="streamMode" column="stream_mode"/>
|
<result property="jtMobileNo" column="jt_mobile_no"/>
|
<result property="jtPlateNo" column="jt_plate_no"/>
|
<result property="jtPlateColor" column="jt_plate_color"/>
|
<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>
|
|
<resultMap type="QsRegionTree" id="QsRegionTreeResult">
|
<result property="id" column="id"/>
|
<result property="deviceId" column="device_id"/>
|
<result property="name" column="name"/>
|
<result property="parentId" column="parent_id"/>
|
<result property="parentDeviceId" column="parent_device_id"/>
|
<result property="treeId" column="tree_id"/>
|
<result property="isLeaf" column="is_leaf"/>
|
<result property="type" column="type"/>
|
<result property="status" column="status"/>
|
<result property="longitude" column="longitude"/>
|
<result property="latitude" column="latitude"/>
|
<result property="manufacturer" column="manufacturer"/>
|
<result property="address" column="address"/>
|
<result property="ptzType" column="ptz_type"/>
|
<result property="streamType" column="stream_type"/>
|
<result property="ipAddress" column="ip_address"/>
|
</resultMap>
|
|
<resultMap type="QsGroupTree" id="QsGroupTreeResult">
|
<id property="id" column="id"/>
|
<result property="deviceId" column="device_id"/>
|
<result property="name" column="name"/>
|
<result property="parentId" column="parent_id"/>
|
<result property="parentDeviceId" column="parent_device_id"/>
|
<result property="businessGroup" column="business_group"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="civilCode" column="civil_code"/>
|
<result property="alias" column="alias"/>
|
<result property="treeId" column="tree_id"/>
|
<result property="isLeaf" column="is_leaf"/>
|
<result property="type" column="type"/>
|
<result property="status" column="status"/>
|
<result property="longitude" column="longitude"/>
|
<result property="latitude" column="latitude"/>
|
<result property="manufacturer" column="manufacturer"/>
|
<result property="address" column="address"/>
|
<result property="ptzType" column="ptz_type"/>
|
<result property="streamType" column="stream_type"/>
|
<result property="ipAddress" column="ip_address"/>
|
</resultMap>
|
|
<resultMap id="DeviceStatsResultMap" type="DeviceStats">
|
<result column="totalDeviceCount" property="totalDeviceCount"/>
|
<result column="totalOnlineCount" property="totalOnlineCount"/>
|
<result column="totalOfflineCount" property="totalOfflineCount"/>
|
<result column="enableCount" property="enableCount"/>
|
<result column="deactivateCount" property="deactivateCount"/>
|
<result column="rtspCount" property="rtspCount"/>
|
<result column="rtmpCount" property="rtmpCount"/>
|
<result column="flvCount" property="flvCount"/>
|
<result column="hlsCount" property="hlsCount"/>
|
<result column="onvifCount" property="onvifCount"/>
|
<result column="fileCount" property="fileCount"/>
|
<result column="hikSdkCount" property="hikSdkCount"/>
|
<result column="hikIsupCount" property="hikIsupCount"/>
|
<result column="dahuaSdkCount" property="dahuaSdkCount"/>
|
<result column="gb28181Count" property="gb28181Count"/>
|
<result column="jt1078Count" property="jt1078Count"/>
|
<result column="pushCount" property="pushCount"/>
|
</resultMap>
|
|
|
<sql id="selectQsDeviceVo">
|
select id,
|
device_code,
|
device_name,
|
ip_address,
|
port,
|
user_name,
|
password,
|
type,
|
device_type,
|
live_address,
|
channel,
|
alarm_channel_id,
|
status,
|
stream_type,
|
longitude,
|
latitude,
|
gb_code,
|
protocol,
|
device_status,
|
online_type,
|
enable_audio,
|
enable_mp4,
|
stream_status,
|
media_serverId,
|
stream_key,
|
enable_disable_none_reader,
|
snap,
|
flv_type,
|
onvif_auth,
|
onvif_host_name,
|
record_plan_id,
|
gb_civil_code,
|
gb_business_group_id,
|
gb_parent_id,
|
manufacturer,
|
address,
|
ptz_type,
|
gb_device_id,
|
gb_channel_id,
|
stream_mode,
|
jt_mobile_no,
|
jt_plate_no,
|
jt_plate_color,
|
create_by,
|
create_time,
|
update_by,
|
update_time,
|
remark
|
from qs_device
|
</sql>
|
|
<select id="selectQsDeviceList" parameterType="QsDevice" resultMap="QsDeviceResult">
|
<include refid="selectQsDeviceVo"/>
|
<where>
|
<if test="deviceName != null and deviceName != ''">and device_name like concat('%', #{deviceName}, '%')
|
</if>
|
<if test="ipAddress != null and ipAddress != ''">and ip_address like concat('%', #{ipAddress}, '%')</if>
|
<if test="type != null and type != ''">and type = #{type}</if>
|
<if test="status != null and status != ''">and status = #{status}</if>
|
<if test="deviceStatus != null and deviceStatus != ''">and device_status = #{deviceStatus}</if>
|
<if test="gbCivilCode != null and gbCivilCode != ''">and gb_civil_code = #{gbCivilCode}</if>
|
<if test="gbParentId != null and gbParentId != ''">and gb_parent_id = #{gbParentId}</if>
|
</where>
|
</select>
|
|
<select id="selectQsDeviceById" parameterType="Long" resultMap="QsDeviceResult">
|
<include refid="selectQsDeviceVo"/>
|
where id = #{id}
|
</select>
|
|
<select id="getQsDeviceStream" resultMap="QsDeviceResult"
|
parameterType="java.lang.String">
|
<include refid="selectQsDeviceVo"/>
|
where device_code = #{stream}
|
</select>
|
|
<insert id="insertQsDevice" parameterType="QsDevice" useGeneratedKeys="true" keyProperty="id">
|
insert into qs_device
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="deviceCode != null and deviceCode != ''">device_code,</if>
|
<if test="deviceName != null">device_name,</if>
|
<if test="ipAddress != null and ipAddress != ''">ip_address,</if>
|
<if test="port != null">port,</if>
|
<if test="userName != null and userName != ''">user_name,</if>
|
<if test="password != null and password != ''">password,</if>
|
<if test="type != null">type,</if>
|
<if test="deviceType != null">device_type,</if>
|
<if test="liveAddress != null">live_address,</if>
|
<if test="channel != null">channel,</if>
|
<if test="alarmChannelId != null">alarm_channel_id,</if>
|
<if test="status != null">status,</if>
|
<if test="streamType != null">stream_type,</if>
|
<if test="longitude != null">longitude,</if>
|
<if test="latitude != null">latitude,</if>
|
<if test="gbCode != null">gb_code,</if>
|
<if test="protocol != null">protocol,</if>
|
<if test="deviceStatus != null">device_status,</if>
|
<if test="onlineType != null">online_type,</if>
|
<if test="enableAudio != null">enable_audio,</if>
|
<if test="enableMp4 != null">enable_mp4,</if>
|
<if test="streamStatus != null">stream_status,</if>
|
<if test="mediaServerId != null">media_serverId,</if>
|
<if test="streamKey != null">stream_key,</if>
|
<if test="enableDisableNoneReader != null">enable_disable_none_reader,</if>
|
<if test="snap != null">snap,</if>
|
<if test="flvType != null">flv_type,</if>
|
<if test="onvifAuth != null">onvif_auth,</if>
|
<if test="onvifHostName != null">onvif_host_name,</if>
|
<if test="recordPlanId != null">record_plan_id,</if>
|
<if test="gbCivilCode != null">gb_civil_code,</if>
|
<if test="gbBusinessGroupId != null">gb_business_group_id,</if>
|
<if test="gbParentId != null">gb_parent_id,</if>
|
<if test="manufacturer != null">manufacturer,</if>
|
<if test="address != null">address,</if>
|
<if test="ptzType != null">ptz_type,</if>
|
<if test="gbDeviceId != null">gb_device_id,</if>
|
<if test="gbChannelId != null">gb_channel_id,</if>
|
<if test="streamMode != null">stream_mode,</if>
|
<if test="jtMobileNo != null">jt_mobile_no,</if>
|
<if test="jtPlateNo != null">jt_plate_no,</if>
|
<if test="jtPlateColor != null">jt_plate_color,</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="remark != null">remark,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="deviceCode != null and deviceCode != ''">#{deviceCode},</if>
|
<if test="deviceName != null">#{deviceName},</if>
|
<if test="ipAddress != null and ipAddress != ''">#{ipAddress},</if>
|
<if test="port != null">#{port},</if>
|
<if test="userName != null and userName != ''">#{userName},</if>
|
<if test="password != null and password != ''">#{password},</if>
|
<if test="type != null">#{type},</if>
|
<if test="deviceType != null">#{deviceType},</if>
|
<if test="liveAddress != null">#{liveAddress},</if>
|
<if test="channel != null">#{channel},</if>
|
<if test="alarmChannelId != null">#{alarmChannelId},</if>
|
<if test="status != null">#{status},</if>
|
<if test="streamType != null">#{streamType},</if>
|
<if test="longitude != null">#{longitude},</if>
|
<if test="latitude != null">#{latitude},</if>
|
<if test="gbCode != null">#{gbCode},</if>
|
<if test="protocol != null">#{protocol},</if>
|
<if test="deviceStatus != null">#{deviceStatus},</if>
|
<if test="onlineType != null">#{onlineType},</if>
|
<if test="enableAudio != null">#{enableAudio},</if>
|
<if test="enableMp4 != null">#{enableMp4},</if>
|
<if test="streamStatus != null">#{streamStatus},</if>
|
<if test="mediaServerId != null">#{mediaServerId},</if>
|
<if test="streamKey != null">#{streamKey},</if>
|
<if test="enableDisableNoneReader != null">#{enableDisableNoneReader},</if>
|
<if test="snap != null">#{snap},</if>
|
<if test="flvType != null">#{flvType},</if>
|
<if test="onvifAuth != null">#{onvifAuth},</if>
|
<if test="onvifHostName != null">#{onvifHostName},</if>
|
<if test="recordPlanId != null">#{recordPlanId},</if>
|
<if test="gbCivilCode != null">#{gbCivilCode},</if>
|
<if test="gbBusinessGroupId != null">#{gbBusinessGroupId},</if>
|
<if test="gbParentId != null">#{gbParentId},</if>
|
<if test="manufacturer != null">#{manufacturer},</if>
|
<if test="ptzType != null">#{ptzType},</if>
|
<if test="gbDeviceId != null">#{gbDeviceId},</if>
|
<if test="gbChannelId != null">#{gbChannelId},</if>
|
<if test="streamMode != null">#{streamMode},</if>
|
<if test="jtMobileNo != null">#{jtMobileNo},</if>
|
<if test="jtPlateNo != null">#{jtPlateNo},</if>
|
<if test="jtPlateColor != null">#{jtPlateColor},</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="remark != null">#{remark},</if>
|
</trim>
|
</insert>
|
|
<update id="updateQsDevice" parameterType="QsDevice">
|
update qs_device
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="deviceCode != null and deviceCode != ''">device_code = #{deviceCode},</if>
|
<if test="deviceName != null">device_name = #{deviceName},</if>
|
<if test="ipAddress != null and ipAddress != ''">ip_address = #{ipAddress},</if>
|
<if test="port != null">port = #{port},</if>
|
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
<if test="password != null and password != ''">password = #{password},</if>
|
<if test="type != null">type = #{type},</if>
|
<if test="deviceType != null">device_type = #{deviceType},</if>
|
<if test="liveAddress != null">live_address = #{liveAddress},</if>
|
<if test="channel != null">channel = #{channel},</if>
|
<if test="alarmChannelId != null">alarm_channel_id = #{alarmChannelId},</if>
|
<if test="status != null">status = #{status},</if>
|
<if test="streamType != null">stream_type = #{streamType},</if>
|
<if test="longitude != null">longitude = #{longitude},</if>
|
<if test="latitude != null">latitude = #{latitude},</if>
|
<if test="gbCode != null">gb_code = #{gbCode},</if>
|
<if test="protocol != null">protocol = #{protocol},</if>
|
<if test="deviceStatus != null">device_status = #{deviceStatus},</if>
|
<if test="onlineType != null">online_type = #{onlineType},</if>
|
<if test="enableAudio != null">enable_audio = #{enableAudio},</if>
|
<if test="enableMp4 != null">enable_mp4 = #{enableMp4},</if>
|
<if test="streamStatus != null">stream_status = #{streamStatus},</if>
|
<if test="mediaServerId != null">media_serverId = #{mediaServerId},</if>
|
<if test="streamKey != null">stream_key = #{streamKey},</if>
|
<if test="enableDisableNoneReader != null">enable_disable_none_reader = #{enableDisableNoneReader},</if>
|
<if test="snap != null">snap = #{snap},</if>
|
<if test="flvType != null">flv_type = #{flvType},</if>
|
<if test="onvifAuth != null">onvif_auth = #{onvifAuth},</if>
|
<if test="onvifHostName != null">onvif_host_name = #{onvifHostName},</if>
|
<if test="recordPlanId != null">record_plan_id = #{recordPlanId},</if>
|
<if test="gbCivilCode != null">gb_civil_code = #{gbCivilCode},</if>
|
<if test="gbBusinessGroupId != null">gb_business_group_id = #{gbBusinessGroupId},</if>
|
<if test="gbParentId != null">gb_parent_id = #{gbParentId},</if>
|
<if test="manufacturer != null">manufacturer = #{manufacturer},</if>
|
<if test="address != null">address = #{address},</if>
|
<if test="ptzType != null">ptz_type = #{ptzType},</if>
|
<if test="gbDeviceId != null">gb_device_id = #{gbDeviceId},</if>
|
<if test="gbChannelId != null">gb_channel_id = #{gbChannelId},</if>
|
<if test="streamMode != null">stream_mode = #{streamMode},</if>
|
<if test="jtMobileNo != null">jt_mobile_no = #{jtMobileNo},</if>
|
<if test="jtPlateNo != null">jt_plate_no = #{jtPlateNo},</if>
|
<if test="jtPlateColor != null">jt_plate_color = #{jtPlateColor},</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="remark != null">remark = #{remark},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<update id="updateQsDeviceStatus">
|
update qs_device
|
set status = #{status},
|
update_time = sysdate()
|
where id = #{id}
|
</update>
|
<update id="updateQsDeviceStatusList">
|
update qs_device set device_status = #{deviceStatus}, update_time = sysdate() where id in
|
<foreach item="id" collection="list" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</update>
|
|
<update id="updateAllQsDevicesToOffline">
|
update qs_device
|
set device_status = 'OFFLINE',
|
stream_status = '0',
|
media_serverId = null,
|
stream_key = null
|
</update>
|
<update id="updateAllQsDeviceStreamUrls"
|
parameterType="QsDevice">
|
<foreach collection="list" item="item" separator=";">
|
UPDATE qs_device
|
<set>
|
device_status = #{item.deviceStatus}
|
</set>
|
WHERE id = #{item.id}
|
</foreach>
|
</update>
|
|
<update id="linkAll" parameterType="java.lang.Long">
|
UPDATE qs_device
|
set record_plan_id = #{planId}
|
where status = 'ENABLE'
|
</update>
|
|
<update id="cleanAll" parameterType="java.lang.Long">
|
UPDATE qs_device
|
set record_plan_id = null
|
where record_plan_id = #{planId}
|
</update>
|
|
<update id="link">
|
UPDATE qs_device
|
set record_plan_id = #{planId}
|
where
|
<foreach collection="deviceIds" item="id" separator="or">
|
id = #{id}
|
</foreach>
|
</update>
|
|
<update id="cleanRecordPlanId" parameterType="java.lang.Long">
|
UPDATE qs_device
|
set record_plan_id = null
|
where record_plan_id = #{planId}
|
</update>
|
|
<update id="updateCivilCodeByDeviceList">
|
UPDATE qs_device
|
SET gb_civil_code = #{civilCode}
|
WHERE id IN
|
<foreach collection="deviceList" item="item" open="(" separator="," close=")">
|
#{item.id}
|
</foreach>
|
</update>
|
|
<update id="updateBusinessGroupBydeviceList">
|
UPDATE qs_device
|
SET gb_business_group_id = #{businessGroup}
|
WHERE id IN
|
<foreach collection="deviceList" item="item" open="(" separator="," close=")">
|
#{item.id}
|
</foreach>
|
</update>
|
|
<update id="updateParentIdByDeviceList">
|
UPDATE qs_device
|
SET gb_parent_id = #{parentId}
|
WHERE id IN
|
<foreach collection="deviceList" item="item" open="(" separator="," close=")">
|
#{item.id}
|
</foreach>
|
</update>
|
|
<update id="removeParentIdByDevices">
|
UPDATE qs_device
|
SET gb_parent_id = null,
|
gb_business_group_id = null
|
WHERE id IN
|
<foreach collection="deviceList" item="item" open="(" separator="," close=")">
|
#{item.id}
|
</foreach>
|
</update>
|
|
<update id="updateRegion">
|
UPDATE qs_device
|
SET gb_civil_code = #{civilCode}
|
WHERE id IN
|
<foreach collection="deviceList" item="item" open="(" separator="," close=")">
|
#{item.id}
|
</foreach>
|
</update>
|
|
<update id="removeCivilCodeByDeletes">
|
UPDATE qs_device
|
SET gb_civil_code = null
|
WHERE id IN
|
<foreach collection="deviceList" item="item" open="(" separator="," close=")">
|
#{item.id}
|
</foreach>
|
</update>
|
|
<update id="removeCivilCodeByDeviceIds">
|
UPDATE qs_device
|
SET gb_civil_code = null
|
WHERE id IN
|
<foreach collection="deviceList" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</update>
|
|
<update id="updateGroup">
|
UPDATE qs_device
|
SET gb_parent_id = #{parentId},
|
gb_business_group_id = #{businessGroup}
|
WHERE id IN
|
<foreach collection="deviceList" item="item" open="(" separator="," close=")">
|
#{item.id}
|
</foreach>
|
</update>
|
|
<update id="removeParentIdByDeviceIds">
|
UPDATE qs_device
|
SET gb_parent_id = null,
|
gb_business_group_id = null
|
WHERE id IN
|
<foreach collection="deviceIdsForClear" item="item" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</update>
|
|
<select id="fetchAllQsDeviceStreamUrls" resultMap="QsDeviceResult">
|
select id,
|
live_address
|
from qs_device
|
where type in ('1', '2', '3', '4', '6')
|
</select>
|
<select id="listPlanRecordQsDevice" parameterType="QsDevice" resultMap="QsDeviceResult">
|
<include refid="selectQsDeviceVo"/>
|
<where>
|
<if test="deviceName != null and deviceName != ''">and device_name like concat('%', #{deviceName}, '%')
|
</if>
|
<if test="type != null and type != ''">and type = #{type}</if>
|
<if test="status != null and status != ''">and status = #{status}</if>
|
<if test="deviceStatus != null and deviceStatus != ''">and device_status = #{deviceStatus}</if>
|
|
<if test="recordPlanId != null">
|
and record_plan_id = #{recordPlanId}
|
</if>
|
<if test="recordPlanId == null">
|
and record_plan_id is null
|
</if>
|
|
and status = 'ENABLE'
|
</where>
|
</select>
|
|
<select id="queryByIds" resultMap="QsDeviceResult">
|
<include refid="selectQsDeviceVo"/>
|
where id in
|
<foreach item="id" collection="startDeviceIdList" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</select>
|
|
<select id="countRecordPlanDevice" resultType="java.lang.Integer" parameterType="java.lang.Long">
|
select count(1)
|
from qs_device
|
where record_plan_id = #{planId}
|
and status = 'ENABLE'
|
</select>
|
|
<select id="queryByCivilCode" resultMap="QsDeviceResult">
|
<include refid="selectQsDeviceVo"/>
|
where gb_civil_code = #{civilCode}
|
</select>
|
|
<select id="queryForRegionTreeByCivilCode" resultMap="QsRegionTreeResult"
|
parameterType="java.lang.String">
|
SELECT id as id,
|
device_name as name,
|
device_status as status,
|
true as is_leaf,
|
longitude as longitude,
|
1 as type,
|
latitude as latitude,
|
type as stream_type,
|
manufacturer as manufacturer,
|
address as address,
|
ptz_type as ptz_type
|
FROM qs_device
|
WHERE gb_civil_code = #{deviceId}
|
and status = 'ENABLE'
|
</select>
|
|
<select id="queryByBusinessGroup" resultMap="QsRegionTreeResult" parameterType="java.lang.String">
|
<include refid="selectQsDeviceVo"/>
|
where gb_business_group_id= #{businessGroup}
|
</select>
|
|
<select id="queryByParentId" resultMap="QsDeviceResult"
|
parameterType="java.lang.String">
|
<include refid="selectQsDeviceVo"/>
|
where gb_parent_id = #{parentId}
|
</select>
|
|
<select id="queryByGroupList" resultMap="QsDeviceResult">
|
<include refid="selectQsDeviceVo"/>
|
where
|
gb_parent_id in
|
<foreach collection="groupList" item="item" open="(" separator="," close=")">
|
#{item.id}
|
</foreach>
|
</select>
|
|
<select id="queryForGroupTreeByParentId" resultMap="QsGroupTreeResult">
|
SELECT id as id,
|
device_name as name,
|
device_status as status,
|
true as is_leaf,
|
longitude as longitude,
|
1 as type,
|
latitude as latitude,
|
type as stream_type,
|
manufacturer as manufacturer,
|
address as address,
|
ptz_type as ptz_type
|
FROM qs_device
|
WHERE gb_parent_id = #{parent}
|
and status = 'ENABLE'
|
<if test="query != null and query != ''">
|
AND device_name LIKE concat('%', #{query}, '%'))
|
</if>
|
</select>
|
|
<select id="queryListByCivilCode" parameterType="QsDevice" resultMap="QsDeviceResult">
|
<include refid="selectQsDeviceVo"/>
|
<where>
|
<if test="deviceName != null and deviceName != ''">and device_name like concat('%', #{deviceName}, '%')
|
</if>
|
<if test="ipAddress != null and ipAddress != ''">and ip_address like concat('%', #{ipAddress}, '%')</if>
|
<if test="type != null and type != ''">and type = #{type}</if>
|
<if test="status != null and status != ''">and status = #{status}</if>
|
<if test="deviceStatus != null and deviceStatus != ''">and device_status = #{deviceStatus}</if>
|
<if test="gbCivilCode != null and gbCivilCode != ''">and gb_civil_code = #{gbCivilCode}</if>
|
<if test="gbCivilCode == null or gbCivilCode ==''">
|
AND gb_civil_code is null
|
</if>
|
</where>
|
</select>
|
|
<select id="queryListByCivilCodeForUnusual" parameterType="QsDevice" resultMap="QsDeviceResult">
|
<include refid="selectQsDeviceVo"/>
|
d
|
LEFT JOIN (
|
SELECT wcr.device_id FROM qs_common_region wcr
|
) temp ON temp.device_id = d.gb_civil_code
|
WHERE d.gb_civil_code IS NOT NULL
|
AND temp.device_id IS NULL
|
|
<if test="deviceName != null and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
|
</if>
|
<if test="ipAddress != null and ipAddress != ''">and d.ip_address like concat('%', #{ipAddress}, '%')</if>
|
<if test="type != null and type != ''">and d.type = #{type}</if>
|
<if test="deviceStatus != null and deviceStatus != ''">and d.device_status = #{deviceStatus}</if>
|
<if test="status != null and status != ''">and status = #{status}</if>
|
</select>
|
|
<select id="queryAllForUnusualCivilCode" resultType="java.lang.Long">
|
SELECT d.id
|
FROM qs_device d
|
LEFT JOIN (SELECT wcr.device_id FROM qs_common_region wcr) temp ON temp.device_id = d.gb_civil_code
|
WHERE d.gb_civil_code IS NOT NULL
|
AND temp.device_id IS NULL
|
</select>
|
|
<select id="queryListByParentId" parameterType="QsDevice" resultMap="QsDeviceResult">
|
<include refid="selectQsDeviceVo"/>
|
<where>
|
<if test="deviceName != null and deviceName != ''">and device_name like concat('%', #{deviceName}, '%')
|
</if>
|
<if test="ipAddress != null and ipAddress != ''">and ip_address like concat('%', #{ipAddress}, '%')</if>
|
<if test="type != null and type != ''">and type = #{type}</if>
|
<if test="deviceStatus != null and deviceStatus != ''">and device_status = #{deviceStatus}</if>
|
<if test="gbCivilCode != null and gbCivilCode != ''">and gb_civil_code = #{gbCivilCode}</if>
|
<if test="gbParentId == null or gbParentId ==''">
|
AND gb_parent_id is null
|
</if>
|
</where>
|
<if test="status != null and status != ''">and status = #{status}</if>
|
</select>
|
|
<select id="queryListByParentForUnusual" parameterType="QsDevice" resultMap="QsDeviceResult">
|
<include refid="selectQsDeviceVo"/>
|
d
|
LEFT JOIN (
|
SELECT wcg.device_id FROM qs_common_group wcg
|
) temp ON temp.device_id = d.gb_parent_id
|
WHERE d.gb_parent_id IS NOT NULL
|
AND temp.device_id IS NULL
|
|
<if test="deviceName != null and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
|
</if>
|
<if test="ipAddress != null and ipAddress != ''">and d.ip_address like concat('%', #{ipAddress}, '%')</if>
|
<if test="type != null and type != ''">and d.type = #{type}</if>
|
<if test="deviceStatus != null and deviceStatus != ''">and d.device_status = #{deviceStatus}</if>
|
<if test="status != null and status != ''">and status = #{status}</if>
|
</select>
|
|
<select id="queryAllForUnusualParent" resultType="java.lang.Long">
|
SELECT d.id
|
FROM qs_device d
|
LEFT JOIN (SELECT wcg.device_id
|
FROM qs_common_group wcg) temp ON temp.device_id = d.gb_parent_id
|
WHERE d.gb_parent_id IS NOT NULL
|
AND temp.device_id IS NULL
|
</select>
|
|
<select id="getDeviceStatistics" resultMap="DeviceStatsResultMap">
|
SELECT
|
COUNT(*) AS 'totalDeviceCount',
|
SUM(CASE WHEN device_status = 'ON' THEN 1 ELSE 0 END) AS 'totalOnlineCount',
|
SUM(CASE WHEN device_status = 'OFFLINE' THEN 1 ELSE 0 END) AS 'totalOfflineCount',
|
|
SUM(CASE WHEN status = 'ENABLE' THEN 1 ELSE 0 END) AS 'enableCount',
|
SUM(CASE WHEN status = 'DEACTIVATE' THEN 1 ELSE 0 END) AS 'deactivateCount',
|
|
SUM(CASE WHEN type = '1' THEN 1 ELSE 0 END) AS 'rtspCount',
|
SUM(CASE WHEN type = '2' THEN 1 ELSE 0 END) AS 'rtmpCount',
|
SUM(CASE WHEN type = '3' THEN 1 ELSE 0 END) AS 'flvCount' ,
|
SUM(CASE WHEN type = '4' THEN 1 ELSE 0 END) AS 'hlsCount' ,
|
SUM(CASE WHEN type = '5' THEN 1 ELSE 0 END) AS 'onvifCount' ,
|
SUM(CASE WHEN type = '6' THEN 1 ELSE 0 END) AS 'fileCount' ,
|
SUM(CASE WHEN type = '7' THEN 1 ELSE 0 END) AS 'hikSdkCount' ,
|
SUM(CASE WHEN type = '8' THEN 1 ELSE 0 END) AS 'hikIsupCount' ,
|
SUM(CASE WHEN type = '9' THEN 1 ELSE 0 END) AS 'dahuaSdkCount',
|
SUM(CASE WHEN type = '12' THEN 1 ELSE 0 END) AS 'gb28181Count',
|
SUM(CASE WHEN type = '13' THEN 1 ELSE 0 END) AS 'pushCount',
|
SUM(CASE WHEN type = '14' THEN 1 ELSE 0 END) AS 'jt1078Count'
|
|
FROM qs_device;
|
</select>
|
|
<delete id="deleteQsDeviceById" parameterType="Long">
|
delete
|
from qs_device
|
where id = #{id}
|
</delete>
|
|
<delete id="deleteQsDeviceByIds" parameterType="String">
|
delete from qs_device where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
<delete id="removeCivilCode">
|
UPDATE qs_device
|
SET gb_civil_code = null
|
WHERE gb_civil_code IN
|
<foreach collection="allChildren" item="item" open="(" separator="," close=")">
|
#{item.deviceId}
|
</foreach>
|
</delete>
|
</mapper>
|