<?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="" >
<!-- 	<typeAlias alias="Ywalarmrulefordevicebean" type="cn.vp.XXX.model.YwalarmrulefordeviceBean"/> -->	<typeAlias alias="Ywalarmrulefordevice" type="cn.im.ywgl.YwalarmrulefordeviceBean"/>
	
	<sql id="condition_Ywalarmrulefordevice">
		where 1=1
		<isNotEmpty prepend='AND' property='LIKErelateid'>
			(relateid like '%$LIKErelateid$%'   )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='relateid'>
			(relateid = #relateid#  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEalarmruleid'>
			(alarmruleid like '%$LIKEalarmruleid$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='alarmruleid'>
			(alarmruleid = #alarmruleid# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEalarmsource'>
			(alarmsource like '%$LIKEalarmsource$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='alarmsource'>
			(alarmsource = #alarmsource# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEalarmtype'>
			(alarmtype like '%$LIKEalarmtype$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='alarmtype'>
			(alarmtype = #alarmtype# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKElinkdeviceid'>
			(linkdeviceid like '%$LIKElinkdeviceid$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='linkdeviceid'>
			(linkdeviceid = #linkdeviceid# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKElinkdevicenum'>
			(linkdevicenum like '%$LIKElinkdevicenum$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='linkdevicenum'>
			(linkdevicenum = #linkdevicenum# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKElinkchannelnum'>
			(linkchannelnum like '%$LIKElinkchannelnum$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='linkchannelnum'>
			(linkchannelnum = #linkchannelnum# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKElinkdevicename'>
			(linkdevicename like '%$LIKElinkdevicename$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='linkdevicename'>
			(linkdevicename = #linkdevicename# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEdetectionswitch'>
			(detectionswitch like '%$LIKEdetectionswitch$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='detectionswitch'>
			(detectionswitch = #detectionswitch# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEdetectionstarttime'>
			(detectionstarttime like '%$LIKEdetectionstarttime$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='detectionstarttime'>
			(detectionstarttime = #detectionstarttime# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEcreateaccount'>
			(createaccount like '%$LIKEcreateaccount$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='createaccount'>
			(createaccount = #createaccount# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEcreatetime'>
			(createtime like '%$LIKEcreatetime$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='createtime'>
			(createtime = #createtime# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEmodifyaccount'>
			(modifyaccount like '%$LIKEmodifyaccount$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='modifyaccount'>
			(modifyaccount = #modifyaccount# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEmodifytime'>
			(modifytime like '%$LIKEmodifytime$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='modifytime'>
			(modifytime = #modifytime# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEremarks'>
			(remarks like '%$LIKEremarks$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='remarks'>
			(remarks = #remarks# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEextend1'>
			(extend1 like '%$LIKEextend1$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='extend1'>
			(extend1 = #extend1# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEextend2'>
			(extend2 like '%$LIKEextend2$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='extend2'>
			(extend2 = #extend2# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEextend3'>
			(extend3 like '%$LIKEextend3$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='extend3'>
			(extend3 = #extend3# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEextend4'>
			(extend4 like '%$LIKEextend4$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='extend4'>
			(extend4 = #extend4# )
		</isNotEmpty>
		<isNotEmpty property='tableparam'>
			$tableparam$
		</isNotEmpty>
		<isNotEmpty property='order'>
			$order$
		</isNotEmpty>
	</sql>
	
	<!-- add object -->
	<insert id="insert_Ywalarmrulefordevice" parameterClass="java.util.Map">
		insert into 
		ywalarmrulefordevice(
		<dynamic prepend=" ">  
			<isNotEmpty prepend=',' property='relateid'>relateid</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmruleid'>alarmruleid</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmsource'>alarmsource</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmtype'>alarmtype</isNotEmpty>
			<isNotEmpty prepend=',' property='linkdeviceid'>linkdeviceid</isNotEmpty>
			<isNotEmpty prepend=',' property='linkdevicenum'>linkdevicenum</isNotEmpty>
			<isNotEmpty prepend=',' property='linkchannelnum'>linkchannelnum</isNotEmpty>
			<isNotEmpty prepend=',' property='linkdevicename'>linkdevicename</isNotEmpty>
			<isNotEmpty prepend=',' property='detectionswitch'>detectionswitch</isNotEmpty>
			<isNotEmpty prepend=',' property='detectionstarttime'>detectionstarttime</isNotEmpty>
			<isNotEmpty prepend=',' property='createaccount'>createaccount</isNotEmpty>
			<isNotEmpty prepend=',' property='createtime'>createtime</isNotEmpty>
			<isNotEmpty prepend=',' property='modifyaccount'>modifyaccount</isNotEmpty>
			<isNotEmpty prepend=',' property='modifytime'>modifytime</isNotEmpty>
			<isNotEmpty prepend=',' property='remarks'>remarks</isNotEmpty>
			<isNotEmpty prepend=',' property='extend1'>extend1</isNotEmpty>
			<isNotEmpty prepend=',' property='extend2'>extend2</isNotEmpty>
			<isNotEmpty prepend=',' property='extend3'>extend3</isNotEmpty>
			<isNotEmpty prepend=',' property='extend4'>extend4</isNotEmpty>

		</dynamic>  
	    <![CDATA[ 
	        ) values ( 
	    ]]>  
	     <dynamic prepend=" "> 
			<isNotEmpty prepend=',' property='relateid'>#relateid#</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmruleid'>#alarmruleid#</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmsource'>#alarmsource#</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmtype'>#alarmtype#</isNotEmpty>
			<isNotEmpty prepend=',' property='linkdeviceid'>#linkdeviceid#</isNotEmpty>
			<isNotEmpty prepend=',' property='linkdevicenum'>#linkdevicenum#</isNotEmpty>
			<isNotEmpty prepend=',' property='linkchannelnum'>#linkchannelnum#</isNotEmpty>
			<isNotEmpty prepend=',' property='linkdevicename'>#linkdevicename#</isNotEmpty>
			<isNotEmpty prepend=',' property='detectionswitch'>#detectionswitch#</isNotEmpty>
			<isNotEmpty prepend=',' property='detectionstarttime'>#detectionstarttime#</isNotEmpty>
			<isNotEmpty prepend=',' property='createaccount'>#createaccount#</isNotEmpty>
			<isNotEmpty prepend=',' property='createtime'>#createtime#</isNotEmpty>
			<isNotEmpty prepend=',' property='modifyaccount'>#modifyaccount#</isNotEmpty>
			<isNotEmpty prepend=',' property='modifytime'>#modifytime#</isNotEmpty>
			<isNotEmpty prepend=',' property='remarks'>#remarks#</isNotEmpty>
			<isNotEmpty prepend=',' property='extend1'>#extend1#</isNotEmpty>
			<isNotEmpty prepend=',' property='extend2'>#extend2#</isNotEmpty>
			<isNotEmpty prepend=',' property='extend3'>#extend3#</isNotEmpty>
			<isNotEmpty prepend=',' property='extend4'>#extend4#</isNotEmpty>

		 </dynamic>  
	    <![CDATA[ 
	        ) 
	    ]]> 
	</insert>
	
	<!-- edit object  -->
	<update id="update_Ywalarmrulefordevice" parameterClass="java.util.Map">
		update ywalarmrulefordevice 
		<dynamic prepend="set ">   
			
			<isNotEmpty prepend=',' property='alarmruleid'>alarmruleid=#alarmruleid#</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmsource'>alarmsource=#alarmsource#</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmtype'>alarmtype=#alarmtype#</isNotEmpty>
			<isNotEmpty prepend=',' property='linkdeviceid'>linkdeviceid=#linkdeviceid#</isNotEmpty>
			<isNotEmpty prepend=',' property='linkdevicenum'>linkdevicenum=#linkdevicenum#</isNotEmpty>
			<isNotEmpty prepend=',' property='linkchannelnum'>linkchannelnum=#linkchannelnum#</isNotEmpty>
			<isNotEmpty prepend=',' property='linkdevicename'>linkdevicename=#linkdevicename#</isNotEmpty>
			<isNotEmpty prepend=',' property='detectionswitch'>detectionswitch=#detectionswitch#</isNotEmpty>
			<isNotEmpty prepend=',' property='detectionstarttime'>detectionstarttime=#detectionstarttime#</isNotEmpty>
			<isNotEmpty prepend=',' property='createaccount'>createaccount=#createaccount#</isNotEmpty>
			<isNotEmpty prepend=',' property='createtime'>createtime=#createtime#</isNotEmpty>
			<isNotEmpty prepend=',' property='modifyaccount'>modifyaccount=#modifyaccount#</isNotEmpty>
			<isNotEmpty prepend=',' property='modifytime'>modifytime=#modifytime#</isNotEmpty>
			<isNotEmpty prepend=',' property='remarks'>remarks=#remarks#</isNotEmpty>
			<isNotEmpty prepend=',' property='extend1'>extend1=#extend1#</isNotEmpty>
			<isNotEmpty prepend=',' property='extend2'>extend2=#extend2#</isNotEmpty>
			<isNotEmpty prepend=',' property='extend3'>extend3=#extend3#</isNotEmpty>
			<isNotEmpty prepend=',' property='extend4'>extend4=#extend4#</isNotEmpty>

		</dynamic>
		where 1=1 
			<isNotEmpty prepend='AND' property='XGTJrelateid'> relateid = #XGTJrelateid#</isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJalarmruleid'> alarmruleid = #XGTJalarmruleid# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJalarmsource'> alarmsource = #XGTJalarmsource# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJalarmtype'> alarmtype = #XGTJalarmtype# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJlinkdeviceid'> linkdeviceid = #XGTJlinkdeviceid# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJlinkdevicenum'> linkdevicenum = #XGTJlinkdevicenum# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJlinkchannelnum'> linkchannelnum = #XGTJlinkchannelnum# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJlinkdevicename'> linkdevicename = #XGTJlinkdevicename# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJdetectionswitch'> detectionswitch = #XGTJdetectionswitch# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJdetectionstarttime'> detectionstarttime = #XGTJdetectionstarttime# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJcreateaccount'> createaccount = #XGTJcreateaccount# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJcreatetime'> createtime = #XGTJcreatetime# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJmodifyaccount'> modifyaccount = #XGTJmodifyaccount# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJmodifytime'> modifytime = #XGTJmodifytime# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJremarks'> remarks = #XGTJremarks# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJextend1'> extend1 = #XGTJextend1# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJextend2'> extend2 = #XGTJextend2# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJextend3'> extend3 = #XGTJextend3# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJextend4'> extend4 = #XGTJextend4# </isNotEmpty>

	</update>
	
	<!-- delete object -->
	<delete id="delete_Ywalarmrulefordevice" parameterClass="java.util.Map">
		delete from ywalarmrulefordevice 
		<include refid="condition_Ywalarmrulefordevice"/>
	</delete>
	
	<!-- batch delete object -->
	<delete id="batch_delete_Ywalarmrulefordevice" parameterClass="java.util.Map">
		delete from ywalarmrulefordevice 
		where 
		<isNotEmpty prepend=' ' property='ids'>
			relateid in
			<iterate open="("  close=")"  conjunction=","  property="ids">
				#ids[]#  
			</iterate>
		</isNotEmpty>
	</delete>
	
	<!-- query objects by page-->
	<select id="query_Ywalarmrulefordevice" resultClass="java.util.HashMap" parameterClass="java.util.Map">
			
		select a.*,b.csmc as detectionswitchMc from (
		select 
			relateid,alarmruleid,alarmsource,alarmtype,linkdeviceid,linkdevicenum,linkchannelnum,linkdevicename,detectionswitch,detectionstarttime,createaccount,createtime,modifyaccount,modifytime,remarks,extend1,extend2,extend3,extend4
		from ywalarmrulefordevice 
		<include refid="condition_Ywalarmrulefordevice"/>
		<!-- <isNotEmpty prepend=' ' property='start'>
			limit #start# ,#limit#
		</isNotEmpty> -->
		) a 
		left join xtcl b on a.detectionswitch = b.csdm and b.csdl='ywTaskEnable'
					
	</select>
	
	<!-- query objects totalcount -->
	<select id="count_Ywalarmrulefordevice" resultClass="java.lang.Integer" parameterClass="java.util.Map">
		select count(*) from ywalarmrulefordevice 
		<include refid="condition_Ywalarmrulefordevice"/>			
	</select>
	
	<!-- batch add objects -->
	<insert id="batch_insert_Ywalarmrulefordevice" parameterClass="java.util.List">
	 	<![CDATA[
          INSERT
      	]]>
      	<iterate conjunction=" " > 
			into ywalarmrulefordevice(
			 <![CDATA[ 
				relateid,alarmruleid,alarmsource,alarmtype,linkdeviceid,linkdevicenum,linkchannelnum,linkdevicename,detectionswitch,detectionstarttime,createaccount,createtime,modifyaccount,modifytime,remarks,extend1,extend2,extend3,extend4
			)values
			 ]]>  		 
			 <![CDATA[ 
				(
				#list[].relateid#,#list[].alarmruleid#,#list[].alarmsource#,#list[].alarmtype#,#list[].linkdeviceid#,#list[].linkdevicenum#,#list[].linkchannelnum#,#list[].linkdevicename#,#list[].detectionswitch#,#list[].detectionstarttime#,#list[].createaccount#,#list[].createtime#,#list[].modifyaccount#,#list[].modifytime#,#list[].remarks#,#list[].extend1#,#list[].extend2#,#list[].extend3#,#list[].extend4#
				)
			]]>    
    	</iterate> 
	</insert>
	
	<!-- 根据 relateid 批量更新启用状态 -->
	<update id="edit_Ywalarmrulefordevice" parameterClass="java.util.Map">
		update Ywalarmrulefordevice 
		<dynamic prepend="set ">   		
			<isNotEmpty prepend=',' property='detectionswitch'>detectionswitch=#detectionswitch#</isNotEmpty>			
			<isNotEmpty prepend=',' property='modifyaccount'>modifyaccount=#modifyaccount#</isNotEmpty>
			<isNotEmpty prepend=',' property='modifytime'>modifytime=#modifytime#</isNotEmpty>
		</dynamic>
		where  
		<isNotEmpty prepend=' ' property='keys'>
			relateid in
			<iterate open="("  close=")"  conjunction=","  property="keys">
				#keys[]#  
			</iterate>
		</isNotEmpty>
	</update>
	
	
	<!-- 监控告警类型查询 -->
	<select id="get_leftVideoDevice" parameterClass="java.util.Map" resultClass="java.util.HashMap">
		select channellistid as id , videonum as linkdevicenum, channelnum as linkchannelnum, channelname as deviceName,b.channelsetname from  ywvideochannelsetlist a,ywvideochannelset b 
		where a.channelsetid = b.channelsetid
		and a.channellistid not in (select linkdeviceid from ywalarmrulefordevice where alarmsource=#alarmsource# and alarmtype=#alarmtype#)
		<isNotEmpty prepend='and' property='deviceName'>
			a.channelname like '%$deviceName$%'  
		</isNotEmpty>
		<isNotEmpty prepend='and' property='deviceId'>
			a.channelsetid = #deviceId# 
		</isNotEmpty>		
		order by a.createtime desc 
		
	</select>
	<select id="get_leftVideoDeviceCount" parameterClass="java.util.Map" resultClass="java.lang.Integer">
		select count(*) from  ywvideochannelsetlist a,ywvideochannelset b 
		where a.channelsetid = b.channelsetid
		and a.channellistid not in (select linkdeviceid from ywalarmrulefordevice where alarmsource=#alarmsource# and alarmtype=#alarmtype#)
		<isNotEmpty prepend='and' property='deviceName'>
			a.channelname like '%$deviceName$%'  
		</isNotEmpty>
		<isNotEmpty prepend='and' property='deviceId'>
			a.channelsetid = #deviceId# 
		</isNotEmpty>	
	</select>
	
	
	<!-- 服务器告警类型查询 -->
	<select id="get_leftServerDevice" parameterClass="java.util.Map" resultClass="java.util.HashMap">
		select machineid as id ,  machinenum as linkdevicenum,  machinename as linkdevicename,
		machinebrand as extend4, machinebrandtype as extend3
		from  ywmachineinfo 
		where machineid not in (select linkdeviceid from ywalarmrulefordevice where alarmsource=#alarmsource# and alarmtype=#alarmtype#)
		<isNotEmpty prepend='and' property='deviceName'>
			machinename like '%$deviceName$%'  
		</isNotEmpty>
		order by createtime desc 
		<!-- limit #start# ,#limit# -->
		
	</select>
	<select id="get_leftServerDeviceCount" parameterClass="java.util.Map" resultClass="java.lang.Integer">
		select count(*) from ywmachineinfo 
		where machineid not in (select linkdeviceid from ywalarmrulefordevice where alarmsource=#alarmsource# and alarmtype=#alarmtype#)
		<isNotEmpty prepend='and' property='deviceName'>
			machinename like '%$deviceName$%'  
		</isNotEmpty>
	</select>
	
	<!-- 应用系统告警类型查询 -->
	<select id="get_leftSoftDevice" parameterClass="java.util.Map" resultClass="java.util.HashMap">	
		select softwareid as id, softwaretype as linkdevicenum, softwareservername as extend4,softwarename as deviceName,b.listname from ywsoftwareinfo a,
		ywsoftwarelist b where a.listid=b.listid  
		and a.softwareid not in (select linkdeviceid from ywalarmrulefordevice where alarmsource=#alarmsource# and alarmtype=#alarmtype#)
		<isNotEmpty prepend='and' property='deviceName'>
			a.softwarename like '%$deviceName$%'  
		</isNotEmpty>
		<isNotEmpty prepend='and' property='deviceId'>
			a.listid = #deviceId#
		</isNotEmpty>
		order by a.createtime desc 
		<!-- limit #start# ,#limit# -->
	</select>
	
	<select id="get_leftSoftDeviceCount" parameterClass="java.util.Map" resultClass="java.lang.Integer">	
		select count(*) from ywsoftwareinfo a,
		ywsoftwarelist b where a.listid=b.listid 
		and a.softwareid not in (select linkdeviceid from ywalarmrulefordevice where alarmsource=#alarmsource# and alarmtype=#alarmtype#)
		<isNotEmpty prepend='and' property='deviceName'>
			a.softwarename like '%$deviceName$%'  
		</isNotEmpty>
		<isNotEmpty prepend='and' property='deviceId'>
			a.listid = #deviceId#
		</isNotEmpty>
	</select>
	
	<!-- 服务器 硬盘 告警类型查询 -->
	<select id="get_leftDiskDevice" parameterClass="java.util.Map" resultClass="java.util.HashMap">
		select harddiskid as id, harddisknum as linkdevicenum, harddiskbrandtype as linkdevicename,
		 storagecapacity as extend4, harddiskdrive as extend3,b.machinename
		from ywmachineharddisk a, ywmachineinfo b where a.machineid = b.machineid 
		and a.harddiskid not in (select linkdeviceid from ywalarmrulefordevice where alarmsource=#alarmsource# and alarmtype=#alarmtype#)
		<isNotEmpty prepend='and' property='deviceName'>
			harddiskdrive like '%$deviceName$%'  
		</isNotEmpty>
		<isNotEmpty prepend='and' property='deviceId'>
			a.machineid = #deviceId#
		</isNotEmpty>
		order by a.createtime desc 
		<!-- limit #start# ,#limit# -->
		
	</select>
	<select id="get_leftDiskDeviceCount" parameterClass="java.util.Map" resultClass="java.lang.Integer">
		select count(*) from ywmachineharddisk a, ywmachineinfo b where a.machineid = b.machineid 
		and a.harddiskid not in (select linkdeviceid from ywalarmrulefordevice where alarmsource=#alarmsource# and alarmtype=#alarmtype#)
		<isNotEmpty prepend='and' property='deviceName'>
			harddiskdrive like '%$deviceName$%'  
		</isNotEmpty>
		<isNotEmpty prepend='and' property='deviceId'>
			a.machineid = #deviceId#
		</isNotEmpty>
	</select>
	
	<!-- 服务器 cpu 告警类型查询 -->	
	<select id="get_leftCPUdevice" parameterClass="java.util.Map" resultClass="java.util.HashMap">
		select a.cpuid as id, a.cpunum as linkdevicenum, a.cpumodel as linkdevicename,
		a.cpubrand as extend4,a.cpucoresnum as extend3,b.machinename
		from ywmachinecpu a,ywmachineinfo b where a.machineid = b.machineid   
		and a.cpuid not in (select linkdeviceid from ywalarmrulefordevice where alarmsource=#alarmsource# and alarmtype=#alarmtype#)
		<isNotEmpty prepend='and' property='deviceName'>
			a.cpumodel like '%$deviceName$%'  
		</isNotEmpty>
		<isNotEmpty prepend='and' property='deviceId'>
			a.machineid = #deviceId#
		</isNotEmpty>
		order by a.createtime desc 
		<!-- limit #start# ,#limit# -->		
	</select>
	<select id="get_leftCPUdeviceCount" parameterClass="java.util.Map" resultClass="java.lang.Integer">
		select count(*)
		from ywmachinecpu a,ywmachineinfo b where a.machineid = b.machineid   
		and a.cpuid not in (select linkdeviceid from ywalarmrulefordevice where alarmsource=#alarmsource# and alarmtype=#alarmtype#)
		<isNotEmpty prepend='and' property='deviceName'>
			a.cpumodel like '%$deviceName$%'  
		</isNotEmpty>
		<isNotEmpty prepend='and' property='deviceId'>
			a.machineid = #deviceId#
		</isNotEmpty>
	</select>
	
	<!-- 服务器 cpu 告警类型查询 -->	
	<select id="get_leftMemorydevice" parameterClass="java.util.Map" resultClass="java.util.HashMap">
		select a.memoryid as id, a.memorynum as linkdevicenum, a.memorybrandtype as linkdevicename,
		a.memorybrand as extend4,a.memorycapacity as extend3,b.machinename
		from ywmachinememory a,ywmachineinfo b where a.machineid = b.machineid   
		and a.memoryid not in (select linkdeviceid from ywalarmrulefordevice where alarmsource=#alarmsource# and alarmtype=#alarmtype#)
		<isNotEmpty prepend='and' property='deviceName'>
			a.memorybrandtype like '%$deviceName$%'  
		</isNotEmpty>
		<isNotEmpty prepend='and' property='deviceId'>
			a.machineid = #deviceId#
		</isNotEmpty>
		order by a.createtime desc 
		<!-- limit #start# ,#limit#	 -->	
	</select>
	<select id="get_leftMemorydeviceCount" parameterClass="java.util.Map" resultClass="java.lang.Integer">
		select count(*)
		from ywmachinememory a,ywmachineinfo b where a.machineid = b.machineid   
		and a.memoryid not in (select linkdeviceid from ywalarmrulefordevice where alarmsource=#alarmsource# and alarmtype=#alarmtype#)
		<isNotEmpty prepend='and' property='deviceName'>
			a.memorybrandtype like '%$deviceName$%'  
		</isNotEmpty>
		<isNotEmpty prepend='and' property='deviceId'>
			a.machineid = #deviceId#
		</isNotEmpty>
	</select>
	 
</sqlMap>



