<?xml version="1.0" encoding="gbk" standalone="no"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="" >

	<!-- 查询异常的服务 -->
	<select id="getAbnormalServers" parameterClass="java.util.Map" resultClass="java.util.HashMap">
		select '服务业务' as type,id,serverName as name from CaOperationServerInfo where status = '7' 		
	</select>

	<!-- 查询异常的相机数 -->
	<select id="getAbnormalCameraCount" parameterClass="java.util.Map" resultClass="java.lang.Integer">
		select count(*) from CaVideoSource where videoStatus &lt;> '1'
	</select>
	
	<!-- 查询正常的服务 -->
	<select id="getNormalServers" parameterClass="java.util.Map" resultClass="java.util.HashMap">
		select '服务业务' as type,id,serverName as name from CaOperationServerInfo where status &lt;> '7' 
	</select>
	
	<!-- 查询正常的相机数 -->
	<select id="getNormalCameraCount" parameterClass="java.util.Map" resultClass="java.lang.Integer">
		select count(*) from CaVideoSource where videoStatus = '1'
	</select>
	
	<!-- 查询异常的相机信息 -->
	<select id="getAbnormalCamera" resultClass="java.util.HashMap" parameterClass="java.util.Map">	
		select id,videoName,ipAddress,vdId,channelId,case videoStatus when '1' then '正常'
		 when '2' then '帧率过低' when '3' then '视频丢包' when '4' then '视频中断' when '5' then '相机移位'
		 when '6' then '相机遮挡' when '7' then '画面失焦' when '8' then '亮度过低' when '9' then '亮度过高'
		 when '10' then '无效场景' end as videoStatus
		from CaVideoSource where videoStatus &lt;> '1'
		<isNotEmpty prepend=' ' property='start'>
			limit #start# ,#limit#
		</isNotEmpty>
	</select>
	
	<!-- 查询正常的相机信息 -->
	<select id="getNormalCamera" resultClass="java.util.HashMap" parameterClass="java.util.Map">	
		select id,videoName,ipAddress,vdId,channelId,case videoStatus when '1' then '正常'
		 when '2' then '帧率过低' when '3' then '视频丢包' when '4' then '视频中断' when '5' then '相机移位'
		 when '6' then '相机遮挡' when '7' then '画面失焦' when '8' then '亮度过低' when '9' then '亮度过高'
		 when '10' then '无效场景' end as videoStatus
		from CaVideoSource where videoStatus = '1'
		<isNotEmpty prepend=' ' property='start'>
			limit #start# ,#limit#
		</isNotEmpty>
	</select>
	
	<!-- 根据id查询某一个服务的信息 -->
	<select id="getServerInfoById" parameterClass="java.util.Map" resultClass="java.util.HashMap">	
		select id,serverId,serverName,nodeId,cpuUsage,memoryUsage,case status when '1' then '已创建' 
		 when '2' then '重启中' when '3' then '运行中' when '4' then '正在被移除' when '5' then '已终止' when '6' then '已退出' 
		 when '7' then '异常停止' end as status from CaOperationServerInfo where id = #id#
	</select>
	
	<!-- 根据 id 查询一条记录 -->
	<select id="getCaVideoSourceById" resultClass="java.util.HashMap" parameterClass="java.util.Map">
	
		select id,videoName,ipAddress,vdId,channelId,case videoStatus when '1' then '正常'
		 when '2' then '帧率过低' when '3' then '视频丢包' when '4' then '视频中断' when '5' then '相机移位'
		 when '6' then '相机遮挡' when '7' then '画面失焦' when '8' then '亮度过低' when '9' then '亮度过高'
		 when '10' then '无效场景' end as videoStatus
		from CaVideoSource where id = #id#
	</select>
	
	<!-- 获取相机信息 -->
	<select id="query_CaVideoSource" resultClass="java.util.HashMap" parameterClass="java.util.Map">
		
		select * from CaVideoSource where 1=1
		<isNotEmpty prepend='' property='page'>
			limit $page$,$size$
		</isNotEmpty>
	</select>
	
	<select id="query_CaVideoSourceCount" resultClass="java.lang.Integer" parameterClass="java.util.Map">
		select count(*) from CaVideoSource 
	</select>
	
	<!-- 查询节点下的服务状态  分页-->
	<select id="getNodeServerStatus" parameterClass="java.util.Map" resultClass="java.util.HashMap">
		select a.nodeName,a.memoryTotal,b.serverName,case b.status when '1' then '已创建' when '2' then '重启中' 
		 when '3' then '运行中' when '4' then '正在被移除' when '5' then '已中止' when '6' then '已退出' 
		 when '7' then '异常停止' end as status,b.cpuUsage,b.memoryUsage    
		from CaOperationNodeInfo a , CaOperationServerInfo b
		where a.nodeId = b.nodeId  
		<isNotEmpty prepend=' ' property='start'>
			limit #start# ,#limit#
		</isNotEmpty>
	</select>
	
	<select id="getNodeServerStatusCount" parameterClass="java.util.Map" resultClass="java.lang.Integer">
		select count(*) from CaOperationNodeInfo a ,CaOperationServerInfo b
		where a.nodeId = b.nodeId 
	</select>
	
</sqlMap>











