|
|
@@ -1,415 +0,0 @@
|
|
|
-<?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.xunmei.iot.mapper.VideoDaysCheckMapper">
|
|
|
- <resultMap id="VideoDaysCheckPageVo" type="com.xunmei.iot.vo.videoDays.VideoDaysCheckPageVo">
|
|
|
- <result column="orgId" property="orgId"/>
|
|
|
- <result column="orgPath" property="orgPath"/>
|
|
|
- <result column="orgName" property="orgName"/>
|
|
|
- <result column="equipmentCode" property="equipmentCode"/>
|
|
|
- <result column="status" property="status"/>
|
|
|
- <result column="deviceName" property="nvrName"/>
|
|
|
- <result column="brandName" property="brandName"/>
|
|
|
- <!-- <collection property="channelVos" column="equipmentCode=equipmentCode,orgId=orgId"
|
|
|
- select="selectChannelsByTime">
|
|
|
- <result column="channelId" property="channelId"/>
|
|
|
- <result column="channelCode" property="channelCode"/>
|
|
|
- <result column="channelStatus" property="channelStatus"/>
|
|
|
- <result column="planDays" property="planDays"/>
|
|
|
- <result column="realDays" property="realDays"/>
|
|
|
- <result column="status" property="status"/>
|
|
|
- <result column="updateTime" property="updateTime"/>
|
|
|
- </collection>-->
|
|
|
- </resultMap>
|
|
|
- <!--<select id="selectPageByOrgId" resultMap="VideoDaysCheckPageVo" parameterType="long">
|
|
|
- select v.equipment_code equipmentCode,
|
|
|
- v.org_name orgName,
|
|
|
- v.org_id orgId,
|
|
|
- v.org_path orgPath
|
|
|
- from mediator_video_days_check v
|
|
|
- where v.org_path like concat((select o.path
|
|
|
- from t_org o
|
|
|
- where o.id = #{request.orgId}), '%')
|
|
|
- group by v.equipment_code,
|
|
|
- v.org_id,
|
|
|
- v.org_path,
|
|
|
- v.org_name
|
|
|
- order by v.org_id
|
|
|
- </select>-->
|
|
|
-
|
|
|
- <select id="selectChannels" resultType="com.xunmei.iot.vo.videoDays.VideoDaysCheckChannelVo">
|
|
|
- select v.id channelId,
|
|
|
- v.channel_code channelCode,
|
|
|
- v.channel_name channelName,
|
|
|
- v.plan_days planDays,
|
|
|
- case v.lose_date
|
|
|
- when 'null' then true
|
|
|
- when '[]' then true
|
|
|
- else false
|
|
|
- end channelStatus
|
|
|
- from mediator_video_days_check v,
|
|
|
- (select max(vdc.update_time) maxUpdateTime,
|
|
|
- vdc.channel_code
|
|
|
- from mediator_video_days_check vdc
|
|
|
- where vdc.org_id = #{orgId}
|
|
|
- and vdc.equipment_code = #{equipmentCode}
|
|
|
- group by vdc.channel_code) a
|
|
|
- where v.org_id = #{orgId}
|
|
|
- and v.equipment_code = #{equipmentCode}
|
|
|
- and v.update_time = a.maxUpdateTime
|
|
|
- and v.channel_code = a.channel_code
|
|
|
- order by v.channel_code
|
|
|
- </select>
|
|
|
-
|
|
|
- <resultMap id="ChannelSingleDetailVo" type="com.xunmei.iot.vo.videoDays.VideoDaysCheckChannelDetailVo">
|
|
|
- <result column="updateTime" property="updateTime"/>
|
|
|
- <result column="planStAndEdDay" property="planStAndEdDay"
|
|
|
- typeHandler="com.xunmei.iot.typeHandler.TimeVoTypeHandler"/>
|
|
|
- <result column="planDays" property="planDays"/>
|
|
|
- <result column="realDays" property="realDays"/>
|
|
|
- <result column="loseDate" property="loseDate"/>
|
|
|
- <result column="channelCode" property="channelCode"/>
|
|
|
- <result column="equipmentCode" property="equipmentCode"/>
|
|
|
- <result column="earliestVideoTime" property="earliestVideoTime"/>
|
|
|
- </resultMap>
|
|
|
-
|
|
|
- <select id="selectChannelDetailById" resultMap="ChannelSingleDetailVo">
|
|
|
- select v.update_time updateTime,
|
|
|
- v.channel_name channelName,
|
|
|
- v.check_date planStAndEdDay,
|
|
|
- v.plan_days planDays,
|
|
|
- v.real_days realDays,
|
|
|
- v.lose_date loseDate,
|
|
|
- v.channel_code channelCode,
|
|
|
- v.equipment_code equipmentCode,
|
|
|
- v.earliest_video_time earliestVideoTime
|
|
|
- from mediator_video_days_check v
|
|
|
- where v.equipment_code = #{equipmentcode}
|
|
|
- and v.channel_code = #{channelcode}
|
|
|
- </select>
|
|
|
- <select id="selectPageByOrgIdAndTimeAndStatus" resultMap="VideoDaysCheckPageVo">
|
|
|
- select distinctrow d.guid equipmentCode,
|
|
|
- d.`name` as deviceName,
|
|
|
- d.org_name orgName,
|
|
|
- d.org_id orgId,
|
|
|
- d.org_path orgPath,
|
|
|
- b.`name` as brandName
|
|
|
- from t_device d
|
|
|
- inner join t_org o on d.org_id = o.id and o.deleted = 0
|
|
|
- INNER JOIN t_device d1 on d.`code`=d1.host_code and d1.deleted=0
|
|
|
- LEFT JOIN t_brand b on d.brand_id =b.id
|
|
|
- where d.deleted=0 and d.category_id=#{request.categoryId} and d.org_path like CONCAT(#{request.path},'%')
|
|
|
- <if test="request.status==0">
|
|
|
- <!-- 正常状态 : INNER JOIN 查询 计划天数=实际天数的通道 -->
|
|
|
- and d.guid in
|
|
|
- (
|
|
|
- SELECT DISTINCT
|
|
|
- d.host_code
|
|
|
- FROM
|
|
|
- t_device d
|
|
|
- INNER JOIN mediator_video_days_check c ON d.host_code = c.equipment_code AND d.`code` = c.channel_code
|
|
|
- where d.category_id=3713671711473664
|
|
|
- and d.deleted=0
|
|
|
- and c.real_days=c.plan_days
|
|
|
- and c.update_time <![CDATA[>=]]> #{request.startTime}
|
|
|
- and c.update_time <![CDATA[<=]]> #{request.endTime}
|
|
|
- and d.org_path like CONCAT(#{request.path}, '%')
|
|
|
- )
|
|
|
- </if>
|
|
|
- <if test="request.status!=null and request.status==1">
|
|
|
- <!--有缺失状态 : INNER JOIN 查询 计划天数!=实际天数的通道 -->
|
|
|
- and d.guid in
|
|
|
- (
|
|
|
- SELECT DISTINCT
|
|
|
- d.host_code
|
|
|
- FROM
|
|
|
- t_device d
|
|
|
- INNER JOIN mediator_video_days_check c ON d.host_code = c.equipment_code AND d.`code` = c.channel_code
|
|
|
- where d.category_id=3713671711473664
|
|
|
- and d.deleted=0
|
|
|
- and c.real_days != c.plan_days
|
|
|
- and c.update_time <![CDATA[>=]]> #{request.startTime}
|
|
|
- and c.update_time <![CDATA[<=]]> #{request.endTime}
|
|
|
- and d.org_path like CONCAT(#{request.path}, '%')
|
|
|
- )
|
|
|
- </if>
|
|
|
- <if test="request.status!=null and request.status==2">
|
|
|
- <!--首日缺失状态 : INNER JOIN c.status=1的通道 -->
|
|
|
- and d.guid in
|
|
|
- (
|
|
|
- SELECT DISTINCT
|
|
|
- d.host_code
|
|
|
- FROM
|
|
|
- t_device d
|
|
|
- INNER JOIN mediator_video_days_check c ON d.host_code = c.equipment_code AND d.`code` = c.channel_code
|
|
|
- where d.category_id=3713671711473664
|
|
|
- and d.deleted=0
|
|
|
- and c.status=1
|
|
|
- and c.update_time <![CDATA[>=]]> #{request.startTime}
|
|
|
- and c.update_time <![CDATA[<=]]> #{request.endTime}
|
|
|
- and d.org_path like CONCAT(#{request.path}, '%')
|
|
|
- )
|
|
|
- </if>
|
|
|
- <!--未上报状态 : 上报通道数量与主机下实际通道数量对比,存在差异则说明存在未上报通道数据 -->
|
|
|
- <if test="request.status!=null and request.status==3">
|
|
|
- and d.guid in (
|
|
|
- <!-- 查询从未上报过的数据-->
|
|
|
- select DISTINCT t1.host_code from ( SELECT DISTINCT
|
|
|
- d.host_code,c.equipment_code,c.channel_code
|
|
|
- FROM
|
|
|
- t_device d
|
|
|
- LEFT JOIN mediator_video_days_check c ON d.host_code = c.equipment_code AND d.`code` = c.channel_code
|
|
|
- where d.category_id=3713671711473664 and d.deleted=0 and d.org_path like CONCAT(#{request.path}, '%')
|
|
|
- ) t1 where t1.equipment_code is null
|
|
|
-
|
|
|
- UNION
|
|
|
- <!--查询存在历史上报的主机通道 -->
|
|
|
- select DISTINCT t2.host_code from (
|
|
|
- SELECT DISTINCT
|
|
|
- d.host_code,c.equipment_code,c.channel_code
|
|
|
- FROM
|
|
|
- t_device d
|
|
|
- LEFT JOIN mediator_video_days_check c ON d.host_code = c.equipment_code AND d.`code` = c.channel_code
|
|
|
- where d.category_id=3713671711473664 and d.deleted=0 and c.update_time <![CDATA[<]]> #{request.startTime}
|
|
|
- and d.org_path like CONCAT(#{request.path}, '%')
|
|
|
- ) t2 where t2.equipment_code is not null
|
|
|
- )
|
|
|
- </if>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectChannelsByTime" resultType="com.xunmei.iot.vo.videoDays.VideoDaysCheckChannelVo">
|
|
|
- select d.id channelId,
|
|
|
- d.`code` channelCode,
|
|
|
- d.name channelName,
|
|
|
- c.plan_days planDays,
|
|
|
- c.real_days realDays,
|
|
|
- c.update_time updateTime,
|
|
|
- if(c.plan_days = c.real_days,1,0) channelStatus,
|
|
|
- c.status AS status
|
|
|
- from t_device d
|
|
|
- left join mediator_video_days_check c on d.host_code = c.equipment_code and d.`code` = c.channel_code
|
|
|
- where d.org_path like CONCAT(#{request.path},'%')
|
|
|
- and d.host_code = #{equipmentCode}
|
|
|
- and d.category_id = 3713671711473664
|
|
|
- and d.deleted = 0
|
|
|
- <if test="request.status==0">
|
|
|
- <!-- 正常状态 : 计划天数=实际天数-->
|
|
|
- and c.plan_days=c.real_days
|
|
|
- and c.update_time >= #{request.startTime} and c.update_time <![CDATA[<=]]> #{request.endTime}
|
|
|
- </if>
|
|
|
- <if test="request.status==1">
|
|
|
- <!-- 有缺失 : 计划天数!=实际天数-->
|
|
|
- and c.plan_days!=c.real_days
|
|
|
- and c.update_time >= #{request.startTime} and c.update_time <![CDATA[<=]]> #{request.endTime}
|
|
|
- </if>
|
|
|
- <if test="request.status==2">
|
|
|
- <!-- 有缺失 : 计划天数!=实际天数-->
|
|
|
- and c.status=1
|
|
|
- and c.update_time >= #{request.startTime} and c.update_time <![CDATA[<=]]> #{request.endTime}
|
|
|
- </if>
|
|
|
- <if test="request.status==3">
|
|
|
- <!-- 未上报 : 计划天数!=实际天数-->
|
|
|
- and ( c.update_time <![CDATA[<]]> #{request.startTime} or c.plan_days is null)
|
|
|
- </if>
|
|
|
- order by d.`code` + 0
|
|
|
- </select>
|
|
|
- <!-- <select id="totalVideoData" resultType="java.util.Map">
|
|
|
- select a.id as did,a.org_path as path ,a.channel_code as channelCode,a.update_time as updateTime from mediator_video_days_check a where
|
|
|
- a.update_time between #{dayOfStartTime} and #{dayOfEndTime} and a.plan_days > a.real_days
|
|
|
- and a.org_id in
|
|
|
- <foreach collection="orgIds" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </select>-->
|
|
|
- <select id="totalVideoData" resultType="java.util.Map">
|
|
|
- select a.id as did,a.org_path as path ,a.channel_code as channelCode,a.update_time as updateTime from
|
|
|
- mediator_video_days_check a where
|
|
|
- date(JSON_EXTRACT(a.check_date, '$.ed')) between #{dayOfStartTime} and #{dayOfEndTime} and a.plan_days >
|
|
|
- a.real_days
|
|
|
- and a.org_id in
|
|
|
- <foreach collection="orgIds" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="totalVideoDataLog" resultType="java.util.Map">
|
|
|
- select a.id as did,a.org_path as path ,a.channel_code as channelCode,a.update_time as updateTime
|
|
|
- from mediator_video_days_check_log a where
|
|
|
- a.update_time between #{dayOfStartTime} and #{dayOfEndTime} and a.plan_days > a.real_days
|
|
|
- and a.org_id in
|
|
|
- <foreach collection="orgIds" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </select>
|
|
|
- <select id="totalDeviceNum" resultType="java.util.Map">
|
|
|
- select COUNT(*) as num,org_path as path from t_device a WHERE a.category_id = #{categoryId} AND a.deleted = 0
|
|
|
- and a.org_id in
|
|
|
- <foreach collection="orgIds" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- group by org_path
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="totalHostOffData" resultType="java.util.Map">
|
|
|
- select a.org_path as path, a.id as ofid, a.device_id as deviceId,a.create_time as updateTime from
|
|
|
- t_host_alarm_record a left join t_device b on a.device_id=b.id where
|
|
|
- a.device_type=3713671510851584 and a.alarm_code = '050' and a.alarm_status = 1 and b.deleted = 0
|
|
|
- and a.create_time>=#{startTime} and #{endTime}>= a.create_time
|
|
|
- and a.org_id in
|
|
|
- <foreach collection="orgIds" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="selectWebPageData" resultType="com.xunmei.iot.vo.videoDays.VideoDayCheckWebPageVo">
|
|
|
- SELECT
|
|
|
- c.id AS id,
|
|
|
- d.org_id AS orgId,
|
|
|
- c.update_time AS updateTime,
|
|
|
- d.org_name AS orgName,
|
|
|
- d.NAME AS channelName,
|
|
|
- pd.name AS equipmentName,
|
|
|
- c.real_days AS realDays,
|
|
|
- c.plan_days AS planDays,
|
|
|
- d.CODE AS channelCode,
|
|
|
- d.host_code AS equipmentCode
|
|
|
- FROM
|
|
|
- t_device d
|
|
|
- inner join t_org o on d.org_id = o.id and o.deleted = 0
|
|
|
- LEFT JOIN mediator_video_days_check c ON d.host_code = c.equipment_code
|
|
|
- AND d.`code` = c.channel_code
|
|
|
- inner join t_device pd on pd.`guid` = d.host_code and pd.category_id = 3713671510851584
|
|
|
-
|
|
|
- <where>
|
|
|
- d.deleted = 0 AND d.category_id = 3713671711473664
|
|
|
- <if test="pageDto.channelName != null and pageDto.channelName != ''">
|
|
|
- and d.name like concat('%',#{pageDto.channelName},'%')
|
|
|
- </if>
|
|
|
- <if test="pageDto.equipmentName != null and pageDto.equipmentName != ''">
|
|
|
- and pd.name like concat('%',#{pageDto.equipmentName},'%')
|
|
|
- </if>
|
|
|
- <if test="pageDto.orgId != null">
|
|
|
- and d.org_id = #{pageDto.orgId}
|
|
|
- </if>
|
|
|
- <if test="pageDto.checkSub == true ">
|
|
|
- and d.org_path like concat(#{pageDto.orgPath},'%')
|
|
|
- </if>
|
|
|
- <if test="pageDto.startTime != null ">
|
|
|
- and c.update_time >= #{pageDto.startTime}
|
|
|
- </if>
|
|
|
- <if test="pageDto.endTime != null ">
|
|
|
- and c.update_time <= #{pageDto.endTime}
|
|
|
- </if>
|
|
|
- <if test="pageDto.loseDateStr != null ">
|
|
|
- and c.lose_date like CONCAT('%',#{pageDto.loseDateStr},'%')
|
|
|
- </if>
|
|
|
- <choose>
|
|
|
- <when test="pageDto.status != null ">
|
|
|
- <if test="pageDto.status==1 ">
|
|
|
- and c.real_days=c.plan_days
|
|
|
- </if>
|
|
|
- <if test="pageDto.status==2 ">
|
|
|
- and c.real_days <![CDATA[<]]> c.plan_days
|
|
|
- </if>
|
|
|
- <if test="pageDto.status==3 ">
|
|
|
- and c.plan_days is null
|
|
|
- </if>
|
|
|
- </when>
|
|
|
- </choose>
|
|
|
- </where>
|
|
|
- order by c.update_time desc,d.id
|
|
|
- </select>
|
|
|
-
|
|
|
- <select id="getWebDetailVo" resultType="com.xunmei.iot.vo.videoDays.VideoDayCheckWebDetailVo">
|
|
|
- select c.update_time as updateTime,
|
|
|
- c.org_name as orgName,
|
|
|
- c.channel_name as channelName,
|
|
|
- c.equipment_name as equipmentName,
|
|
|
- c.real_days as realDays,
|
|
|
- c.plan_days as planDays,
|
|
|
- c.channel_code as channelCode,
|
|
|
- c.check_date as checkDate,
|
|
|
- c.lose_date as loseDate,
|
|
|
- d.ip as ip
|
|
|
-
|
|
|
-
|
|
|
- from mediator_video_days_check c
|
|
|
- left join t_device d on c.equipment_code = d.id
|
|
|
- where c.id = #{id}
|
|
|
- </select>
|
|
|
-
|
|
|
-
|
|
|
- <select id="selectVideoLoseDevice" resultType="com.xunmei.iot.vo.videoDays.VideoDayCheckWebPageVo">
|
|
|
- SELECT
|
|
|
- c.id AS id,
|
|
|
- d.org_id AS orgId,
|
|
|
- c.update_time AS updateTime,
|
|
|
- d.org_name AS orgName,
|
|
|
- d.NAME AS channelName,
|
|
|
- pd.name AS equipmentName,
|
|
|
- c.real_days AS realDays,
|
|
|
- c.plan_days AS planDays,
|
|
|
- d.CODE AS channelCode,
|
|
|
- d.host_code AS equipmentCode
|
|
|
- FROM
|
|
|
- t_device d
|
|
|
- inner join t_org o on d.org_id = o.id and o.deleted = 0
|
|
|
- LEFT JOIN mediator_video_days_check c ON d.host_code = c.equipment_code
|
|
|
- AND d.`code` = c.channel_code
|
|
|
- inner join t_device pd on pd.`guid` = d.host_code and pd.category_id = 3713671510851584
|
|
|
-
|
|
|
- <where>
|
|
|
- d.deleted = 0 AND d.category_id = 3713671711473664
|
|
|
- and c.real_days != c.plan_days and d.org_id = #{orgId}
|
|
|
- and c.update_time >= #{startTime}
|
|
|
- and c.update_time <= #{endTime}
|
|
|
- </where>
|
|
|
- order by c.update_time desc,d.id
|
|
|
- </select>
|
|
|
- <select id="selectNotReportChannels" resultType="com.xunmei.iot.vo.videoDays.VideoDaysCheckChannelVo">
|
|
|
- select d.id channelId,
|
|
|
- d.`code` channelCode,
|
|
|
- d.name channelName,
|
|
|
- c.plan_days planDays,
|
|
|
- c.real_days realDays,
|
|
|
- c.update_time updateTime,
|
|
|
- if(c.plan_days = c.real_days,1,0) channelStatus,
|
|
|
- c.status AS status
|
|
|
- from t_device d
|
|
|
- left join mediator_video_days_check c on d.host_code = c.equipment_code AND d.`code` = c.channel_code
|
|
|
- WHERE d.category_id = 3713671711473664
|
|
|
- AND d.deleted = 0
|
|
|
- and d.org_path like CONCAT(#{request.path}, '%')
|
|
|
- and d.host_code = #{equipmentCode} and c.plan_days is null
|
|
|
- <if test="codeList != null and codeList.size>0">
|
|
|
- and c.channel_code not in
|
|
|
- <foreach collection="codeList" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </select>
|
|
|
- <select id="getVideoDaysCheckAlarmNum" resultType="java.lang.Integer">
|
|
|
- select count(c.id)
|
|
|
- from t_org o
|
|
|
- inner join mediator_video_days_check c on c.org_id = o.id and o.deleted = 0
|
|
|
- INNER JOIN t_device d on c.equipment_code=d.host_code and d.`code`=c.channel_code and d.deleted=0
|
|
|
- where c.org_id=#{request.orgId}
|
|
|
- <if test="request.date != null">
|
|
|
- and c.update_time >= #{request.date}
|
|
|
- </if>
|
|
|
- <if test="request.startTime != null and request.endTime != null">
|
|
|
- and c.update_time between #{request.startTime} and #{request.endTime}
|
|
|
- </if>
|
|
|
- and c.real_days != c.plan_days and ((d.asset_status >= 4
|
|
|
- and d.asset_status != 8) or d.asset_status IS NULL)
|
|
|
- </select>
|
|
|
- <select id="totalLxwzxData" resultType="java.util.Map">
|
|
|
- select COUNT(*) as num,a.org_path as path from mediator_video_integrity_check a where
|
|
|
- a.record_date = #{parse} and
|
|
|
- a.org_id in
|
|
|
- <foreach collection="orgIds" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- group by a.org_path
|
|
|
- </select>
|
|
|
-</mapper>
|