| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- <?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.IotDvrDiskMapper">
- <resultMap id="selectHostPageMap" type="com.xunmei.iot.vo.dvrDisk.DvrDiskPageVo">
- <result column="id" property="id"/>
- <result column="equipmentCode" property="equipmentCode"/>
- <result column="equipmentName" property="equipmentName"/>
- <result column="ip" property="ip"/>
- <result column="orgId" property="orgId"/>
- <result column="orgName" property="orgName"/>
- <result column="affiliated_area" property="affiliatedArea"/>
- <result column="affiliated_bank" property="affiliatedBank"/>
- <result column="netState" property="netState"/>
- <!-- <result column="status" property="status"/>-->
- <!-- <result column="alarmTime" property="alarmTime"/>-->
- <!-- <result column="detailInfo" property="detailInfo"-->
- <!-- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>-->
- <collection property="diskInfos" column="equipmentCode=equipmentCode"
- select="selectDiskInfo">
- <result column="id" property="id"/>
- <result column="org_id" property="orgId"/>
- <result column="host_code" property="hostCode"/>
- <result column="disk_index" property="diskIndex"/>
- <result column="disk_name" property="diskName"/>
- <result column="total" property="total"/>
- <result column="available" property="available"/>
- </collection>
- </resultMap>
- <resultMap id="selectAppHostPageMap" type="com.xunmei.iot.vo.dvrDisk.DvrDiskAppPageVo">
- <result column="equipmentCode" property="equipmentCode"/>
- <result column="equipmentName" property="equipmentName"/>
- <result column="check_time" property="stateUpdateTime"/>
- <result column="orgName" property="orgName"/>
- <result column="state" property="state"/>
- <collection property="diskInfos" column="equipmentCode=equipmentCode,state=state"
- select="selectDiskInfo">
- <result column="id" property="id"/>
- <result column="org_id" property="orgId"/>
- <result column="host_code" property="hostCode"/>
- <result column="disk_index" property="diskIndex"/>
- <result column="disk_name" property="diskName"/>
- <result column="total" property="total"/>
- <result column="available" property="available"/>
- <result column="state" property="state"/>
- </collection>
- </resultMap>
- <select id="selectHostPage" resultMap="selectHostPageMap">
- SELECT
- d.id,
- d.equipment_code AS equipmentCode,
- d.equipment_name AS equipmentName,
- d.net_address as ip,
- d.org_name AS orgName,
- o.affiliated_area,
- o.affiliated_bank,
- d.producer as brand,
- dd.state as netState
- <!-- dhd.check_status AS `status`,-->
- <!-- dhd.check_time AS alarmTime,-->
- <!-- dhd.detail_info as detailInfo-->
- FROM
- iot_device d
- inner join sys_org o on d.org_id =o.id and o.deleted=0 and o.is_lock='0'
- left join iot_device_detection dd on d.equipment_code =dd.equipment_code
- <!-- LEFT JOIN iot_dvr_hard_disk_detection dhd ON d.equipment_code = dhd.equipment_code-->
- WHERE
- d.category_id=#{pageDto.categoryId}
- <if test="pageDto.checkSub==true">
- and d.org_path like concat(#{orgPath},"%")
- </if>
- <if test="pageDto.checkSub==false">
- and d.org_id = #{pageDto.orgId}
- </if>
- <if test="pageDto.hostName!=null and pageDto.hostName!=''">
- and d.equipment_name like concat('%', #{pageDto.hostName},'%')
- </if>
- <if test="pageDto.netState!=null">
- and dd.state=#{pageDto.netState}
- </if>
- <!-- <if test="pageDto.status !=null">-->
- <!-- and dhd.`status` = #{pageDto.status}-->
- <!-- </if>-->
- <!-- <if test="pageDto.alarmStartTime !=null">-->
- <!-- and dhd.alarm_time >= #{pageDto.alarmStartTime}-->
- <!-- </if>-->
- <!-- <if test="pageDto.alarmEndTime !=null">-->
- <!-- and #{pageDto.alarmEndTime}>= dhd.`alarm_time`-->
- <!-- </if>-->
- and d.deleted=0
- </select>
- <select id="selectDiskInfo" resultType="com.xunmei.common.core.domain.iot.domain.IotDvrDisk">
- select id,
- available,
- `disk_index`,
- `disk_name`,
- `total`,
- `host_code`,
- `org_id`,
- state
- from iot_dvr_disk
- where host_code = #{equipmentCode}
- and deleted=0
- <if test="state==0 or state==1">
- and state=#{state}
- </if>
- <if test="state==2">
- and state is null
- </if>
- </select>
- <select id="getRecordAlarmHistoryList"
- resultType="com.xunmei.iot.vo.dvrDisk.DvrDiskAlarmHistoryPageVo">
- SELECT
- r.id,
- r.org_id AS orgId,
- r.org_name AS orgName,
- r.device_name AS deviceName,
- r.alarm_status as status,
- r.alarm_type AS alarmType,
- r.alarm_start_time AS alarmStartTime,
- r.alarm_end_time AS alarmEndTime,
- r.alarm_detail as alarmDetail
- FROM
- t_host_alarm_record r
- where r.device_type=3713671510851584 AND r.assets_type=3713670431768576
- <if test="pageDto.deviceId != null">
- and r.device_id = #{pageDto.deviceId}
- </if>
- <if test="pageDto.status != null">
- and r.alarm_status = #{pageDto.status}
- </if>
- <if test="pageDto.diskName != null">
- and r.alarm_detail like concat('%"',#{pageDto.diskName},'"%')
- </if>
- <if test="pageDto.alarmCode != null">
- and r.alarm_code= #{pageDto.alarmCode}
- </if>
- <if test="pageDto.alarmStartTime != null and pageDto.alarmEndTime != null">
- and ((r.alarm_start_time is not null and r.alarm_end_time is not null and
- r.alarm_end_time>=#{pageDto.alarmStartTime} and #{pageDto.alarmEndTime}>=r.alarm_start_time)
- or (r.alarm_end_time is null and r.alarm_start_time>= #{pageDto.alarmStartTime} and
- #{pageDto.alarmEndTime}>=r.alarm_start_time )
- or (r.alarm_start_time is null and r.alarm_end_time>= #{pageDto.alarmStartTime} and
- #{pageDto.alarmEndTime}>=r.alarm_end_time)
- )
- </if>
- order by r.alarm_start_time desc
- </select>
- <select id="diskStatistic" resultType="com.xunmei.iot.vo.dvrDisk.DvrDiskStatisticVo">
- SELECT count(0) AS dvrTotal,
- SUM(dd.count) AS diskTotal,
- SUM(dd.exceptionCount) as diskExceptionCount
- FROM iot_device d
- LEFT JOIN (SELECT host_code,count(0) as count,SUM(if(state=1,1,0)) as exceptionCount from iot_dvr_disk WHERE
- deleted=0 group by host_code) dd on dd.host_code =d.equipment_code
- where d.deleted=0 and d.category_id=#{pageDto.categoryId}
- <if test="pageDto.checkSub==true">
- and d.org_path like concat(#{orgPath},"%")
- </if>
- <if test="pageDto.checkSub==false">
- and d.org_id = #{pageDto.orgId}
- </if>
- </select>
- <select id="selectAppHostPage" resultMap="selectAppHostPageMap">
- SELECT
- d.id,
- d.equipment_code AS equipmentCode,
- d.equipment_name AS equipmentName,
- d.org_name AS orgName,
- dd.check_time,
- #{pageDto.state} as state
- FROM
- iot_device d
- left join iot_dvr_hard_disk_detection dd on d.equipment_code=dd.equipment_code
- WHERE
- d.category_id=#{pageDto.categoryId} and d.deleted=0
- <if test="pageDto.checkSub==true">
- and d.org_path like concat(#{orgPath},"%")
- </if>
- <if test="pageDto.checkSub==false">
- and d.org_id = #{pageDto.orgId}
- </if>
- <if test="pageDto.state==0 or pageDto.state==1">
- and d.equipment_code in (select host_code from iot_dvr_disk where deleted=0 and state=#{pageDto.state}
- <if test="pageDto.checkSub==true">
- and org_path like concat(#{orgPath},"%")
- </if>
- <if test="pageDto.checkSub==false">
- and org_id = #{pageDto.orgId}
- </if>
- group by host_code
- )
- </if>
- <if test="pageDto.state==2">
- and (dd.check_status=1 or dd.check_status is null)
- </if>
- </select>
- <select id="selectDiskCount" resultType="com.xunmei.common.core.domain.iot.domain.IotDvrDisk">
- select *
- from iot_dvr_disk d
- inner join sys_org o on o.id = d.org_id
- where o.deleted = 0
- and d.deleted = 0
- and o.path like concat(#{orgPath}, '%')
- </select>
- </mapper>
|