<?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="Ywvideocurrentstatebean" type="cn.vp.XXX.model.YwvideocurrentstateBean"/> -->
    <typeAlias alias="Ywvideocurrentstate" type="cn.yw.ywvideocurrentstate.YwvideocurrentstateBean"/>

    <sql id="condition_Ywvideocurrentstate">
        where 1=1
        <isNotEmpty prepend='AND ' property='LIKEcurrentstateid'>
            (currentstateid like '%$LIKEcurrentstateid$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='currentstateid'>
            (currentstateid = #currentstateid# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvideonum'>
            (videonum like '%$LIKEvideonum$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='videonum'>
            (videonum = #videonum# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEchannelnum'>
            (channelnum like '%$LIKEchannelnum$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='channelnum'>
            (channelnum = #channelnum# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEchannelname'>
            (channelname like '%$LIKEchannelname$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='channelname'>
            (channelname = #channelname# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvideocatalog'>
            (videocatalog like '%$LIKEvideocatalog$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='videocatalog'>
            (videocatalog = #videocatalog# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEcurrentstate'>
            (currentstate like '%$LIKEcurrentstate$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='currentstate'>
            (currentstate = #currentstate# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEcurrentstatetime'>
            (currentstatetime like '%$LIKEcurrentstatetime$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='currentstatetime'>
            (currentstatetime = #currentstatetime# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEisonline'>
            (isonline like '%$LIKEisonline$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='isonline'>
            (isonline = #isonline# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEplayfail'>
            (playfail like '%$LIKEplayfail$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='playfail'>
            (playfail = #playfail# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEnetworkerror'>
            (networkerror like '%$LIKEnetworkerror$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='networkerror'>
            (networkerror = #networkerror# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvqcstate'>
            (vqcstate like '%$LIKEvqcstate$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='vqcstate'>
            (vqcstate = #vqcstate# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvqcfailuretype'>
            (vqcfailuretype like '%$LIKEvqcfailuretype$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='vqcfailuretype'>
            (vqcfailuretype = #vqcfailuretype# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvqcfailurecause'>
            (vqcfailurecause like '%$LIKEvqcfailurecause$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='vqcfailurecause'>
            (vqcfailurecause = #vqcfailurecause# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvqctaskid'>
            (vqctaskid like '%$LIKEvqctaskid$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='vqctaskid'>
            (vqctaskid = #vqctaskid# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvideostatus'>
            (videostatus like '%$LIKEvideostatus$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='videostatus'>
            (videostatus = #videostatus# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvideofailurecause'>
            (videofailurecause like '%$LIKEvideofailurecause$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='videofailurecause'>
            (videofailurecause = #videofailurecause# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvqdstate'>
            (vqdstate like '%$LIKEvqdstate$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='vqdstate'>
            (vqdstate = #vqdstate# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEnosignalstatus'>
            (nosignalstatus like '%$LIKEnosignalstatus$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='nosignalstatus'>
            (nosignalstatus = #nosignalstatus# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEimgclearstatus'>
            (imgclearstatus like '%$LIKEimgclearstatus$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='imgclearstatus'>
            (imgclearstatus = #imgclearstatus# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEimgcontraststatus'>
            (imgcontraststatus like '%$LIKEimgcontraststatus$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='imgcontraststatus'>
            (imgcontraststatus = #imgcontraststatus# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEimgcolorstatus'>
            (imgcolorstatus like '%$LIKEimgcolorstatus$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='imgcolorstatus'>
            (imgcolorstatus = #imgcolorstatus# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEimglightstatus'>
            (imglightstatus like '%$LIKEimglightstatus$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='imglightstatus'>
            (imglightstatus = #imglightstatus# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvideofreezestatus'>
            (videofreezestatus like '%$LIKEvideofreezestatus$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='videofreezestatus'>
            (videofreezestatus = #videofreezestatus# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvideojitterstatus'>
            (videojitterstatus like '%$LIKEvideojitterstatus$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='videojitterstatus'>
            (videojitterstatus = #videojitterstatus# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvideoupheavalstatus'>
            (videoupheavalstatus like '%$LIKEvideoupheavalstatus$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='videoupheavalstatus'>
            (videoupheavalstatus = #videoupheavalstatus# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvideocodeerrorstatus'>
            (videocodeerrorstatus like '%$LIKEvideocodeerrorstatus$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='videocodeerrorstatus'>
            (videocodeerrorstatus = #videocodeerrorstatus# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvideonoisestatus'>
            (videonoisestatus like '%$LIKEvideonoisestatus$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='videonoisestatus'>
            (videonoisestatus = #videonoisestatus# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvideorollstripestatus'>
            (videorollstripestatus like '%$LIKEvideorollstripestatus$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='videorollstripestatus'>
            (videorollstripestatus = #videorollstripestatus# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvqdfailuretype'>
            (vqdfailuretype like '%$LIKEvqdfailuretype$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='vqdfailuretype'>
            (vqdfailuretype = #vqdfailuretype# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvqdfailurecause'>
            (vqdfailurecause like '%$LIKEvqdfailurecause$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='vqdfailurecause'>
            (vqdfailurecause = #vqdfailurecause# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvqdtaskid'>
            (vqdtaskid like '%$LIKEvqdtaskid$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='vqdtaskid'>
            (vqdtaskid = #vqdtaskid# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKErecordstate'>
            (recordstate like '%$LIKErecordstate$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='recordstate'>
            (recordstate = #recordstate# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKErecordfailuretype'>
            (recordfailuretype like '%$LIKErecordfailuretype$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='recordfailuretype'>
            (recordfailuretype = #recordfailuretype# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKErecordfailurecause'>
            (recordfailurecause like '%$LIKErecordfailurecause$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='recordfailurecause'>
            (recordfailurecause = #recordfailurecause# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKErecordtaskid'>
            (recordtaskid like '%$LIKErecordtaskid$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='recordtaskid'>
            (recordtaskid = #recordtaskid# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvideolabelstatus'>
            (videolabelstatus like '%$LIKEvideolabelstatus$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='videolabelstatus'>
            (videolabelstatus = #videolabelstatus# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvideolabeltime'>
            (videolabeltime like '%$LIKEvideolabeltime$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='videolabeltime'>
            (videolabeltime = #videolabeltime# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEvideolabelaccount'>
            (videolabelaccount like '%$LIKEvideolabelaccount$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='videolabelaccount'>
            (videolabelaccount = #videolabelaccount# )
        </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 prepend='AND ' property='xzbh'>
            (d.xzbh = #xzbh# or (d.xzbh in (select xzbh from ptxzs where sjxzbh = #xzbh#)) )
        </isNotEmpty>
        <isNotEmpty property='tableparam'>
            $tableparam$
        </isNotEmpty>
        <isNotEmpty property='order'>
            $order$
        </isNotEmpty>
    </sql>

    <!-- add object -->
    <insert id="insert_Ywvideocurrentstate" parameterClass="java.util.Map">
        insert into
        ywvideocurrentstate(
        <dynamic prepend=" ">
            <isNotEmpty prepend=',' property='currentstateid'>currentstateid</isNotEmpty>
            <isNotEmpty prepend=',' property='currentstate'>currentstate</isNotEmpty>
            <isNotEmpty prepend=',' property='videonum'>videonum</isNotEmpty>
            <isNotEmpty prepend=',' property='channelnum'>channelnum</isNotEmpty>
            <isNotEmpty prepend=',' property='channelname'>channelname</isNotEmpty>
            <isNotEmpty prepend=',' property='videocatalog'>videocatalog</isNotEmpty>
            <isNotEmpty prepend=',' property='currentstatetime'>currentstatetime</isNotEmpty>
            <isNotEmpty prepend=',' property='isonline'>isonline</isNotEmpty>
            <isNotEmpty prepend=',' property='playfail'>playfail</isNotEmpty>
            <isNotEmpty prepend=',' property='networkerror'>networkerror</isNotEmpty>
            <isNotEmpty prepend=',' property='vqcstate'>vqcstate</isNotEmpty>
            <isNotEmpty prepend=',' property='vqcfailuretype'>vqcfailuretype</isNotEmpty>
            <isNotEmpty prepend=',' property='vqcfailurecause'>vqcfailurecause</isNotEmpty>
            <isNotEmpty prepend=',' property='vqctaskid'>vqctaskid</isNotEmpty>
            <isNotEmpty prepend=',' property='videostatus'>videostatus</isNotEmpty>
            <isNotEmpty prepend=',' property='videofailurecause'>videofailurecause</isNotEmpty>
            <isNotEmpty prepend=',' property='vqdstate'>vqdstate</isNotEmpty>
            <isNotEmpty prepend=',' property='nosignalstatus'>nosignalstatus</isNotEmpty>
            <isNotEmpty prepend=',' property='imgclearstatus'>imgclearstatus</isNotEmpty>
            <isNotEmpty prepend=',' property='imgcontraststatus'>imgcontraststatus</isNotEmpty>
            <isNotEmpty prepend=',' property='imgcolorstatus'>imgcolorstatus</isNotEmpty>
            <isNotEmpty prepend=',' property='imglightstatus'>imglightstatus</isNotEmpty>
            <isNotEmpty prepend=',' property='videofreezestatus'>videofreezestatus</isNotEmpty>
            <isNotEmpty prepend=',' property='videojitterstatus'>videojitterstatus</isNotEmpty>
            <isNotEmpty prepend=',' property='videoupheavalstatus'>videoupheavalstatus</isNotEmpty>
            <isNotEmpty prepend=',' property='videocodeerrorstatus'>videocodeerrorstatus</isNotEmpty>
            <isNotEmpty prepend=',' property='videonoisestatus'>videonoisestatus</isNotEmpty>
            <isNotEmpty prepend=',' property='videorollstripestatus'>videorollstripestatus</isNotEmpty>
            <isNotEmpty prepend=',' property='vqdfailuretype'>vqdfailuretype</isNotEmpty>
            <isNotEmpty prepend=',' property='vqdfailurecause'>vqdfailurecause</isNotEmpty>
            <isNotEmpty prepend=',' property='vqdtaskid'>vqdtaskid</isNotEmpty>
            <isNotEmpty prepend=',' property='recordstate'>recordstate</isNotEmpty>
            <isNotEmpty prepend=',' property='recordfailuretype'>recordfailuretype</isNotEmpty>
            <isNotEmpty prepend=',' property='recordfailurecause'>recordfailurecause</isNotEmpty>
            <isNotEmpty prepend=',' property='recordtaskid'>recordtaskid</isNotEmpty>
            <isNotEmpty prepend=',' property='videolabelstatus'>videolabelstatus</isNotEmpty>
            <isNotEmpty prepend=',' property='videolabeltime'>videolabeltime</isNotEmpty>
            <isNotEmpty prepend=',' property='videolabelaccount'>videolabelaccount</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='currentstateid'>#currentstateid#</isNotEmpty>
            <isNotEmpty prepend=',' property='currentstate'>#currentstate#</isNotEmpty>
            <isNotEmpty prepend=',' property='videonum'>#videonum#</isNotEmpty>
            <isNotEmpty prepend=',' property='channelnum'>#channelnum#</isNotEmpty>
            <isNotEmpty prepend=',' property='channelname'>#channelname#</isNotEmpty>
            <isNotEmpty prepend=',' property='videocatalog'>#videocatalog#</isNotEmpty>
            <isNotEmpty prepend=',' property='currentstatetime'>#currentstatetime#</isNotEmpty>
            <isNotEmpty prepend=',' property='isonline'>#isonline#</isNotEmpty>
            <isNotEmpty prepend=',' property='playfail'>#playfail#</isNotEmpty>
            <isNotEmpty prepend=',' property='networkerror'>#networkerror#</isNotEmpty>
            <isNotEmpty prepend=',' property='vqcstate'>#vqcstate#</isNotEmpty>
            <isNotEmpty prepend=',' property='vqcfailuretype'>#vqcfailuretype#</isNotEmpty>
            <isNotEmpty prepend=',' property='vqcfailurecause'>#vqcfailurecause#</isNotEmpty>
            <isNotEmpty prepend=',' property='vqctaskid'>#vqctaskid#</isNotEmpty>
            <isNotEmpty prepend=',' property='videostatus'>#videostatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='videofailurecause'>#videofailurecause#</isNotEmpty>
            <isNotEmpty prepend=',' property='vqdstate'>#vqdstate#</isNotEmpty>
            <isNotEmpty prepend=',' property='nosignalstatus'>#nosignalstatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='imgclearstatus'>#imgclearstatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='imgcontraststatus'>#imgcontraststatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='imgcolorstatus'>#imgcolorstatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='imglightstatus'>#imglightstatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='videofreezestatus'>#videofreezestatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='videojitterstatus'>#videojitterstatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='videoupheavalstatus'>#videoupheavalstatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='videocodeerrorstatus'>#videocodeerrorstatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='videonoisestatus'>#videonoisestatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='videorollstripestatus'>#videorollstripestatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='vqdfailuretype'>#vqdfailuretype#</isNotEmpty>
            <isNotEmpty prepend=',' property='vqdfailurecause'>#vqdfailurecause#</isNotEmpty>
            <isNotEmpty prepend=',' property='vqdtaskid'>#vqdtaskid#</isNotEmpty>
            <isNotEmpty prepend=',' property='recordstate'>#recordstate#</isNotEmpty>
            <isNotEmpty prepend=',' property='recordfailuretype'>#recordfailuretype#</isNotEmpty>
            <isNotEmpty prepend=',' property='recordfailurecause'>#recordfailurecause#</isNotEmpty>
            <isNotEmpty prepend=',' property='recordtaskid'>#recordtaskid#</isNotEmpty>
            <isNotEmpty prepend=',' property='videolabelstatus'>#videolabelstatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='videolabeltime'>#videolabeltime#</isNotEmpty>
            <isNotEmpty prepend=',' property='videolabelaccount'>#videolabelaccount#</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_Ywvideocurrentstate" parameterClass="java.util.Map">
        update ywvideocurrentstate
        <dynamic prepend="set ">
            <isNotEmpty prepend=',' property='videonum'>videonum=#videonum#</isNotEmpty>
            <isNotEmpty prepend=',' property='channelnum'>channelnum=#channelnum#</isNotEmpty>
            <isNotEmpty prepend=',' property='channelname'>channelname=#channelname#</isNotEmpty>
            <isNotEmpty prepend=',' property='videocatalog'>videocatalog=#videocatalog#</isNotEmpty>
            <isNotEmpty prepend=',' property='currentstatetime'>currentstatetime=#currentstatetime#</isNotEmpty>
            <isNotEmpty prepend=',' property='isonline'>isonline=#isonline#</isNotEmpty>
            <isNotEmpty prepend=',' property='playfail'>playfail=#playfail#</isNotEmpty>
            <isNotEmpty prepend=',' property='networkerror'>networkerror=#networkerror#</isNotEmpty>
            <isNotEmpty prepend=',' property='vqcstate'>vqcstate=#vqcstate#</isNotEmpty>
            <isNotEmpty prepend=',' property='vqcfailuretype'>vqcfailuretype=#vqcfailuretype#</isNotEmpty>
            <isNotEmpty prepend=',' property='vqcfailurecause'>vqcfailurecause=#vqcfailurecause#</isNotEmpty>
            <isNotEmpty prepend=',' property='vqctaskid'>vqctaskid=#vqctaskid#</isNotEmpty>
            <isNotEmpty prepend=',' property='videostatus'>videostatus=#videostatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='videofailurecause'>videofailurecause=#videofailurecause#</isNotEmpty>
            <isNotEmpty prepend=',' property='vqdstate'>vqdstate=#vqdstate#</isNotEmpty>
            <isNotEmpty prepend=',' property='nosignalstatus'>nosignalstatus=#nosignalstatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='imgclearstatus'>imgclearstatus=#imgclearstatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='imgcontraststatus'>imgcontraststatus=#imgcontraststatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='imgcolorstatus'>imgcolorstatus=#imgcolorstatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='videofreezestatus'>videofreezestatus=#videofreezestatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='videojitterstatus'>videojitterstatus=#videojitterstatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='videoupheavalstatus'>videoupheavalstatus=#videoupheavalstatus#
            </isNotEmpty>
            <isNotEmpty prepend=',' property='videocodeerrorstatus'>videocodeerrorstatus=#videocodeerrorstatus#
            </isNotEmpty>
            <isNotEmpty prepend=',' property='videonoisestatus'>videonoisestatus=#videonoisestatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='videorollstripestatus'>videorollstripestatus=#videorollstripestatus#
            </isNotEmpty>
            <isNotEmpty prepend=',' property='vqdfailuretype'>vqdfailuretype=#vqdfailuretype#</isNotEmpty>
            <isNotEmpty prepend=',' property='vqdfailurecause'>vqdfailurecause=#vqdfailurecause#</isNotEmpty>
            <isNotEmpty prepend=',' property='vqdtaskid'>vqdtaskid=#vqdtaskid#</isNotEmpty>
            <isNotEmpty prepend=',' property='recordstate'>recordstate=#recordstate#</isNotEmpty>
            <isNotEmpty prepend=',' property='recordfailuretype'>recordfailuretype=#recordfailuretype#</isNotEmpty>
            <isNotEmpty prepend=',' property='recordfailurecause'>recordfailurecause=#recordfailurecause#</isNotEmpty>
            <isNotEmpty prepend=',' property='recordtaskid'>recordtaskid=#recordtaskid#</isNotEmpty>
            <isNotEmpty prepend=',' property='videolabelstatus'>videolabelstatus=#videolabelstatus#</isNotEmpty>
            <isNotEmpty prepend=',' property='videolabeltime'>videolabeltime=#videolabeltime#</isNotEmpty>
            <isNotEmpty prepend=',' property='videolabelaccount'>videolabelaccount=#videolabelaccount#</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>

            <isNotEmpty prepend=',' property='repairstate'>repairstate=#repairstate#</isNotEmpty>
        </dynamic>
        where currentstateid = #XGTJcurrentstateid#
        <isNotEmpty prepend='AND ' property='XGTJcurrentstate'>currentstate = #XGTJcurrentstate#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvideonum'>videonum = #XGTJvideonum#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJchannelnum'>channelnum = #XGTJchannelnum#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJchannelname'>channelname = #XGTJchannelname#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvideocatalog'>videocatalog = #XGTJvideocatalog#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJcurrentstatetime'>currentstatetime = #XGTJcurrentstatetime#
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJisonline'>isonline = #XGTJisonline#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJplayfail'>playfail = #XGTJplayfail#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJnetworkerror'>networkerror = #XGTJnetworkerror#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvqcstate'>vqcstate = #XGTJvqcstate#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvqcfailuretype'>vqcfailuretype = #XGTJvqcfailuretype#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvqcfailurecause'>vqcfailurecause = #XGTJvqcfailurecause#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvqctaskid'>vqctaskid = #XGTJvqctaskid#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvideostatus'>videostatus = #XGTJvideostatus#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvideofailurecause'>videofailurecause = #XGTJvideofailurecause#
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvqdstate'>vqdstate = #XGTJvqdstate#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJnosignalstatus'>nosignalstatus = #XGTJnosignalstatus#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJimgclearstatus'>imgclearstatus = #XGTJimgclearstatus#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJimgcontraststatus'>imgcontraststatus = #XGTJimgcontraststatus#
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJimgcolorstatus'>imgcolorstatus = #XGTJimgcolorstatus#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvideofreezestatus'>videofreezestatus = #XGTJvideofreezestatus#
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvideojitterstatus'>videojitterstatus = #XGTJvideojitterstatus#
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvideoupheavalstatus'>videoupheavalstatus = #XGTJvideoupheavalstatus#
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvideocodeerrorstatus'>videocodeerrorstatus =
            #XGTJvideocodeerrorstatus#
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvideonoisestatus'>videonoisestatus = #XGTJvideonoisestatus#
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvideorollstripestatus'>videorollstripestatus =
            #XGTJvideorollstripestatus#
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvqdfailuretype'>vqdfailuretype = #XGTJvqdfailuretype#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvqdfailurecause'>vqdfailurecause = #XGTJvqdfailurecause#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvqdtaskid'>vqdtaskid = #XGTJvqdtaskid#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJrecordstate'>recordstate = #XGTJrecordstate#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJrecordfailuretype'>recordfailuretype = #XGTJrecordfailuretype#
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJrecordfailurecause'>recordfailurecause = #XGTJrecordfailurecause#
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJrecordtaskid'>recordtaskid = #XGTJrecordtaskid#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvideolabelstatus'>videolabelstatus = #XGTJvideolabelstatus#
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvideolabeltime'>videolabeltime = #XGTJvideolabeltime#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJvideolabelaccount'>videolabelaccount = #XGTJvideolabelaccount#
        </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_Ywvideocurrentstate" parameterClass="java.util.Map">
        delete from ywvideocurrentstate where  (currentstateid = #currentstateid# )
   </delete>

    <!-- batch delete object -->
    <delete id="batch_delete_Ywvideocurrentstate" parameterClass="java.util.Map">
        delete from ywvideocurrentstate   where key in (#keyword#)
    </delete>

    <!-- query objects by page-->
    <select id="query_Ywvideocurrentstate" resultClass="java.util.HashMap" parameterClass="java.util.Map"
            remapResults="true">
        select a.*, e.sbip,e.cjmc,f.xzbh as xzbh, f.bz,f.xh ,(select xzmc from ptxzs where xzbh=a.videocatalog) as xzmc,
        (select alarmname from ywalarmeventcode where alarmcode=repairstate)repairstatename
        from ywvideocurrentstate a
        right join sbtdspsr f on (f.sbbh=a.videonum and f.tdbh=a.channelnum )
        left join sbxx e on (a.videonum=e.sbbh)
        where f.kz3 is not null and f.kz3 != '1'
        <isNotEmpty prepend='AND ' property='currentstateid'>
            (a.currentstateid = #currentstateid# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='isonline'>
            (a.isonline = #isonline# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='vqdstate'>
            (a.vqdstate = #vqdstate# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='recordstate'>
            (a.recordstate = #recordstate# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='xzbh'>
            <![CDATA[ f.xzbh in ]]>
            <iterate property="xzbh" conjunction="," open="(" close=")">
                #xzbh[]#
            </iterate>
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='videonum'>
            (a.videonum = #videonum# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='channelnum'>
            (a.channelnum = #channelnum# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEremarks'>
            (f.bz like '%$LIKEremarks$%' )
        </isNotEmpty>
        <isNotEmpty property='emptyremarks'>
            <isEqual prepend='AND ' property='emptyremarks' compareValue="0">
                (f.bz is null or f.bz=' ')
            </isEqual>
            <isEqual prepend='AND ' property='emptyremarks' compareValue="1">
                (f.bz is not null and f.bz!=' ')
            </isEqual>
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEchannelname'>
            (a.channelname like '%$LIKEchannelname$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='currentstate'>
            (a.currentstate = #currentstate# )
        </isNotEmpty>
        <isNotEmpty property='tableparam'>
            $tableparam$
        </isNotEmpty>
        <isNotEmpty prepend=' ' property='order'>
            $order$
        </isNotEmpty>
    </select>
    <!-- 详细展示 -->
    <select id="query_Ywvideocurrentstate_detail" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select
        a.videonum,a.channelnum,a.channelname,a.videocatalog,e.videoip
        from ywvideocurrentstate a

        right join sbtdspsr d on (d.sbbh=a.videonum and d.tdbh=a.channelnum )
        left join ywarchivevideoinfo e on (e.videonum=a.videonum and e.channelnum=a.channelnum )
        where d.kz3 is not null  and d.kz3 != '1'
        <isNotEmpty prepend='AND ' property='videocatalog'>
            (d.xzbh = #videocatalog#  <!-- or (d.xzbh in (select xzbh from ptxzs where sjxzbh = #videocatalog#))  -->)
        </isNotEmpty>
        <isNotEmpty property='tableparam'>
            $tableparam$
        </isNotEmpty>
        <isNotEmpty prepend=' ' property='order'>
            $order$
        </isNotEmpty>
        <!-- <isNotEmpty prepend=' ' property='start'>
            limit $start$ ,$limit$
        </isNotEmpty> -->
    </select>
    <select id="count_Ywvideocurrentstate_detail" resultClass="java.lang.Integer" parameterClass="java.util.Map">
        select count(*)
        from ywvideocurrentstate a
        right JOIN sbtdspsr d on (d.sbbh=a.videonum and d.tdbh=a.channelnum )
        LEFT JOIN ywarchivevideoinfo e on (e.videonum=a.videonum and e.channelnum=a.channelnum )
        where d.kz3 is not null  and d.kz3 != '1'
        <isNotEmpty prepend='AND ' property='videocatalog'>
            (d.xzbh= #xzbh# or d.xzbh in(select xzbh from ptxzs start with sjxzbh=#xzbh# connect by prior xzbh= sjxzbh)
            )
        </isNotEmpty>

        <isNotEmpty property='tableparam'>
            $tableparam$
        </isNotEmpty>
    </select>

    <!-- query objects totalcount -->
    <select id="count_Ywvideocurrentstate" resultClass="java.lang.Integer" parameterClass="java.util.Map">
        select count(*)
        from ywvideocurrentstate a
        right JOIN sbtdspsr d on (d.sbbh=a.videonum and d.tdbh=a.channelnum )
        where  d.kz3 is not null  and d.kz3 != '1'
        <isNotEmpty prepend='AND ' property='currentstateid'>
            (a.currentstateid = #currentstateid# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='isonline'>
            (isonline = #isonline# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='vqdstate'>
            (vqdstate = #vqdstate# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='recordstate'>
            (recordstate = #recordstate# )
        </isNotEmpty>

        <isNotEmpty prepend='AND ' property='xzbh'>
            <![CDATA[ d.xzbh in ]]>
            <iterate property="xzbh" conjunction="," open="(" close=")">
                #xzbh[]#
            </iterate>
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='videonum'>
            (a.videonum = #videonum# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='channelnum'>
            (a.channelnum = #channelnum# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEchannelname'>
            (a.channelname like '%$LIKEchannelname$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='currentstate'>
            (a.currentstate = #currentstate# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEremarks'>
            (d.bz like '%$LIKEremarks$%' )
        </isNotEmpty>
        <isNotEmpty property='emptyremarks'>
            <isEqual prepend='AND ' property='emptyremarks' compareValue="0">
                (d.bz is null or d.bz=' ')
            </isEqual>
            <isEqual prepend='AND ' property='emptyremarks' compareValue="1">
                (d.bz is not null and trim(d.bz)!=' ')
            </isEqual>
        </isNotEmpty>
        <isNotEmpty property='tableparam'>
            $tableparam$
        </isNotEmpty>
    </select>

    <!-- batch add objects -->
    <insert id="batch_insert_Ywvideocurrentstate" parameterClass="java.util.List">
        <![CDATA[
          INSERT
      	]]>
        <iterate conjunction=" ">
            into ywvideocurrentstate(
            <![CDATA[
				currentstateid,videonum,channelnum,channelname,videocatalog,currentstate,currentstatetime,isonline,playfail,networkerror,vqcstate,vqcfailuretype,vqcfailurecause,vqctaskid,videostatus,videofailurecause,vqdstate,nosignalstatus,imgclearstatus,imgcontraststatus,imgcolorstatus,imglightstatus,videofreezestatus,videojitterstatus,videoupheavalstatus,videocodeerrorstatus,videonoisestatus,videorollstripestatus,vqdfailuretype,vqdfailurecause,vqdtaskid,recordstate,recordfailuretype,recordfailurecause,recordtaskid,videolabelstatus,videolabeltime,videolabelaccount,createaccount,createtime,modifyaccount,modifytime,remarks,extend1,extend2,extend3,extend4
			)values
			 ]]>
            <![CDATA[
				(
				#list[].currentstateid#,#list[].videonum#,#list[].channelnum#,#list[].channelname#,#list[].videocatalog#,	#list[].currentstate#,#list[].currentstatetime#,#list[].isonline#,#list[].playfail#,#list[].networkerror#,#list[].vqcstate#,#list[].vqcfailuretype#,#list[].vqcfailurecause#,#list[].vqctaskid#,#list[].videostatus#,#list[].videofailurecause#,#list[].vqdstate#,#list[].nosignalstatus#,#list[].imgclearstatus#,#list[].imgcontraststatus#,#list[].imgcolorstatus#,#list[].imglightstatus#,#list[].videofreezestatus#,#list[].videojitterstatus#,#list[].videoupheavalstatus#,#list[].videocodeerrorstatus#,#list[].videonoisestatus#,#list[].videorollstripestatus#,#list[].vqdfailuretype#,#list[].vqdfailurecause#,#list[].vqdtaskid#,#list[].recordstate#,#list[].recordfailuretype#,#list[].recordfailurecause#,#list[].recordtaskid#,#list[].videolabelstatus#,#list[].videolabeltime#,#list[].videolabelaccount#,#list[].createaccount#,#list[].createtime#,#list[].modifyaccount#,#list[].modifytime#,#list[].remarks#,#list[].extend1#,#list[].extend2#,#list[].extend3#,#list[].extend4#
				)
			]]>
        </iterate>
    </insert>

    <select id="statisticsVideoOnlineRate_mysql" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select count(*) as totalCount
        (select COUNT(isonline) from ywvideocurrentstate a
        where 1=1
        and isonline = '1'
        ) as onlineNum,
        (select COUNT(*) from ywvideocurrentstate a
        where 1=1
        <![CDATA[
		and (isonline <> '1' or isonline is null)) as unonlineNum,
		]]>
        (select COUNT(vqdstate) from ywvideocurrentstate a
        where 1=1
        and vqdstate = '1') as intactNum,
        (select COUNT(*) from ywvideocurrentstate a
        where 1=1
        <![CDATA[
		and (vqdstate <> '1' or vqdstate is null)) as unIntactNum,
		]]>
        (select COUNT(recordstate) from ywvideocurrentstate a

        where 1=1

        and recordstate = '1') as recordIntactNum,

        (select COUNT(*) from ywvideocurrentstate a

        where 1=1

        <![CDATA[
		and (recordstate <> '1' or recordstate is null)) as unrecordIntactNum
		]]>
        from ywvideocurrentstate
    </select>
    <!--	<select id="statisticsVideoOnlineRate" resultClass="java.util.HashMap" parameterClass="java.util.Map">-->
    <!--		select -->
    <!--			count(*) as totalcount,-->
    <!--			SUM(case when a.isonline=1 then 1 else 0 end) as onlinenum,-->
    <!--			SUM(case when a.isonline=0  or a.isonline is null then 1 else 0 end) as unonlinenum,-->
    <!--			SUM(case when a.vqdstate=1 then 1 else 0 end) as intactnum,-->
    <!--			SUM(case when a.vqdstate=0 or a.vqdstate is null then 1 else 0 end) as unIntactnum,-->
    <!--			SUM(case when a.recordstate=1 then 1 else 0 end) as recordIntactnum,-->
    <!--			SUM(case when a.recordstate=0 or a.recordstate is null then 1 else 0 end) as unrecordIntactnum-->
    <!--		from ywvideocurrentstate a-->
    <!--		<isNotEmpty prepend=' ' property='bmbh'>-->
    <!--			LEFT JOIN sbtdjqqx b on (b.sbbh=a.videonum and b.tdbh=a.channelnum )-->
    <!--		</isNotEmpty>-->
    <!--		RIGHT JOIN ywvideosyncchannel d on (d.videonum=a.videonum and d.channelnum=a.channelnum )   -->
    <!--		WHERE 1=1  -->
    <!--		<isNotEmpty prepend='AND ' property='bmbh'>-->
    <!--			b.bmbh = #bmbh#-->
    <!--		</isNotEmpty>-->
    <!--	</select>-->

    <select id="statisticsVideoOnlineRate" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select   count(*) as totalcount,
        SUM(case when a.isonline is not null and  a.isonline!=0  then 1 else 0 end) as onlinenum,
        SUM(case when  a.isonline =0 or a.isonline is null then 1 else 0 end) as unonlinenum
        from ywvideocurrentstate a
        right join sbtdspsr d on (d.sbbh=a.videonum and d.tdbh=a.channelnum )
        where   d.kz3 is not null and d.kz3 != '1'
    </select>
    <select id="statisticsVideoIntactRate" resultClass="java.util.HashMap" parameterClass="java.util.Map">
		select count(*) as intactNum,
				(select count(*) as total from ywvideocurrentstate where  vqdstate=0 and currentstate!= 1) as unintactNum
		from ywvideocurrentstate  where currentstate =1 and  vqdstate=1
	</select>
    <select id="statisticsRecordIntactRate" resultClass="java.util.HashMap" parameterClass="java.util.Map">
		select count(*) as intactNum,
				(select count(*) as total from ywvideocurrentstate where  recordstate=0 and currentstate!= 1) as unintactNum
		from ywvideocurrentstate  where currentstate =1 and  recordstate=1
	</select>

    <select id="videoCurrentStateStatistics" resultClass="java.util.HashMap" parameterClass="java.util.Map">
          select 'total' csdm , 'total'csmc , count(*) cnt
          from ywvideocurrentstate a  right join sbtdspsr d on (d.sbbh=a.videonum and d.tdbh=a.channelnum )
          where   d.kz3 is not null   and d.kz3 != '1'
          union
          select 'abnormal' csdm ,'abnormal'csmc , count(*) cnt
          from ywvideocurrentstate a right join sbtdspsr d on (d.sbbh=a.videonum and d.tdbh=a.channelnum ) where isonline=0 or  isonline is null  and  d.kz3 is not null   and d.kz3 != '1'
          union
          select 'normal' csdm ,'normal'csmc , count(*) cnt
          from ywvideocurrentstate a  right join sbtdspsr d on (d.sbbh=a.videonum and d.tdbh=a.channelnum ) where a.isonline is not null and  isonline!=0
          and  d.kz3 is not null    and d.kz3 != '1'
    </select>
    <select id="vdqStatisticsRegion" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select d.xzbh videocatalog, (select XZMC from ptxzs where xzbh=d.xzbh) as videocatalogname,
        count(*) as jknum,
        (select count(1) from sbtdspsr e where   e.kz3 is not null
        and kz3 != '1' and  (e.xzbh = d.xzbh) ) as totalnum,
        SUM(case when a.isonline=0 or a.isonline is null then 1 else 0 end) as lxnum,
        SUM(case when a.isonline is not null and a.isonline!=0 then 1 else 0 end) as zxnum,
        SUM(case when a.vqdstate=0 then 1 else 0 end) as videoabnormalnum,
        SUM(case when a.vqdstate=1 then 1 else 0 end) as videonormalnum,
        SUM(case when a.nosignalstatus in (2,3,4) then 1 else 0 end) as nosignalstatusnum,
        SUM(case when a.videoocclusionstatus=0 then 1 else 0 end) as videoocclusionstatusnum,
        SUM(case when a.scenechangestatus=0 then 1 else 0 end) as scenechangestatusnum,
        SUM(case when a.imgtoodarkstatus=0 then 1 else 0 end) as imgtoodarkstatusnum,
        SUM(case when a.imgoverbrightstatus=0 then 1 else 0 end) as imgoverbrightstatusnum,
        SUM(case when a.imgclearstatus=0 then 1 else 0 end) as imgclearstatusnum,
        SUM(case when a.imgcolorstatus=0 then 1 else 0 end) as imgcolorstatusnum
        FROM ywvideocurrentstate a
        right JOIN sbtdspsr d on (d.sbbh=a.videonum and d.tdbh=a.channelnum )
        WHERE  d.kz3 is not null    and d.kz3 != '1'
        <isNotEmpty prepend='AND ' property='videocatalog'>
            (d.xzbh = #videocatalog# or (d.xzbh in (select xzbh from ptxzs where sjxzbh =
            #videocatalog#)) )
        </isNotEmpty>
        <isNotEmpty property='tableparam'>
            $tableparam$
        </isNotEmpty>
        GROUP BY d.xzbh
        <isNotEmpty property='order'>
            $order$
        </isNotEmpty>
    </select>
    <select id="count_vdqStatisticsRegion" resultClass="java.lang.Integer" parameterClass="java.util.Map">
        select count(*) from (
        select
        a.videocatalog
        FROM ywvideocurrentstate a
        <isNotEmpty prepend=' ' property='videocatalog'>
            LEFT JOIN sbtdspsr d on (d.sbbh=a.videonum and d.tdbh=a.channelnum )
            WHERE  d.kz3 is not null     and d.kz3 != '1'   and  (d.xzbh = #videocatalog# or (d.xzbh in (select xzbh from ptxzs where sjxzbh = #videocatalog#)) )
        </isNotEmpty>
        <isNotEmpty property='tableparam'>
            $tableparam$
        </isNotEmpty>
        GROUP BY a.videocatalog) m
    </select>
    <!-- 区域在线率统计  ============================  / start -->
    <select id="query_areaOnline" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select b.xzbh xzqh,b.xzmc,
        sum(f.mcount)mcount,sum(notonlinecount)notonlinecount,sum(onlinecount)onlinecount,sum(wxj)wxj from(
        <isEqual prepend="" property="alarmdevicetype" compareValue="1">
            select f.*,f.mcount-(onlinecount+notonlinecount) as wxj from (
            select d.xzbh xzqh ,
            (select count(*) from sbtdspsr e where e.xzbh = d.xzbh and  e.kz3 is not null  and e.kz3 != '1' ) as mcount,
            (select XZMC from ptxzs where xzbh=d.xzbh) as xzmc,
            SUM(case when a.isonline=0 or a.isonline is null then 1 else 0 end) as notonlinecount,
            SUM(case when a.isonline is not null and a.isonline!=0 then 1 else 0 end) as onlinecount
            from ywvideocurrentstate a
            LEFT JOIN sbtdspsr d on (d.sbbh=a.videonum and d.tdbh=a.channelnum )
            where   d.kz3 is not null  and d.kz3 != '1'
            <isNotEmpty prepend='AND ' property='xzbh'>
                <![CDATA[ d.xzbh in ]]>
                <iterate property="xzbh" conjunction="," open="(" close=")">
                    #xzbh[]#
                </iterate>
            </isNotEmpty>
            GROUP BY d.xzbh
            )f
        </isEqual>

        <isEqual prepend="" property="alarmdevicetype" compareValue="2">
            select f.*,f.mcount-(onlinecount+notonlinecount) as wxj from (
            select c.machineareanum xzqh,count(*)mcount ,
            (select XZMC from ptxzs where xzbh=c.MACHINEAREANUM) as xzmc,
            SUM(case when currentstate!=1 or currentstate is null then 1 else 0 end) as notonlinecount,
            SUM(case when currentstate=1 then 1 else 0 end) as onlinecount
            from ywmachinecurrentstate a right join ywmachineinfo c on a.machineid=c.machineid
            <isNotEmpty prepend='where' property='xzbh'>
                <![CDATA[ c.MACHINEAREANUM  in ]]>
                <iterate property="xzbh" conjunction="," open="(" close=")">
                    #xzbh[]#
                </iterate>
            </isNotEmpty>
            GROUP BY c.machineareanum
            ) f
        </isEqual>

        <isEqual prepend="" property="alarmdevicetype" compareValue="3">
            select f.*,f.mcount-(f.onlinecount+notonlinecount) as wxj from (
            select a.qybh xzqh ,count(*) mcount,
            (select xzmc from ptxzs where xzbh=a.qybh) as xzmc,
            SUM(case when state=0 or state is null then 1 else 0 end) as notonlinecount,
            SUM(case when state=1 then 1 else 0 end) as onlinecount
            from nhywjtxhdgl a
            <isNotEmpty prepend='where' property='xzbh'>
                <![CDATA[a.qybh   in ]]>
                <iterate property="xzbh" conjunction="," open="(" close=")">
                    #xzbh[]#
                </iterate>
            </isNotEmpty>
            group by a.qybh
            ) f

        </isEqual>

        <isEqual prepend="" property="alarmdevicetype" compareValue="4">
            select f.*,f.mcount-(onlinecount+notonlinecount) as wxj from (
            select qybh xzqh,count(*) mcount,
            (select XZMC from ptxzs where xzbh=qybh) as xzmc,
            SUM(case when state=0 or state is null then 1 else 0 end) as notonlinecount,
            SUM(case when state=1 then 1 else 0 end) as onlinecount
            from nhywjtledydpgl
            <isNotEmpty prepend='where' property='xzbh'>
                <![CDATA[qybh in ]]>
                <iterate property="xzbh" conjunction="," open="(" close=")">
                    #xzbh[]#
                </iterate>
            </isNotEmpty>
            group by qybh
            ) f
        </isEqual>
        <isEqual prepend="" property="alarmdevicetype" compareValue="10">
            select f.*,f.mcount-(onlinecount+notonlinecount) as wxj from (
            select regionid xzqh,count(*) mcount,
            (select XZMC from ptxzs where xzbh=regionid) as xzmc,
            SUM(case when state =0 or state is null then 1 else 0 end) as notonlinecount,
            SUM(case when state =1 then 1 else 0 end) as onlinecount
            from its.ksh_detector where detectortype='GVD'
            <isNotEmpty prepend='AND ' property='xzbh'>
                <![CDATA[regionid  in ]]>
                <iterate property="xzbh" conjunction="," open="(" close=")">
                    #xzbh[]#
                </iterate>
            </isNotEmpty>
            GROUP BY regionid
            ) f
        </isEqual>

        <isEqual prepend="" property="alarmdevicetype" compareValue="11">
            select f.*,f.mcount-(onlinecount+notonlinecount) as wxj from (
            select regionid xzqh,count(*) mcount,
            (select XZMC from ptxzs where xzbh=regionid) as xzmc,
            SUM(case when state =0 or state is null then 1 else 0 end) as notonlinecount,
            SUM(case when state =1 then 1 else 0 end) as onlinecount
            from its.ksh_detector where detectortype='SMARTSENSOR'
            <isNotEmpty prepend='AND ' property='xzbh'>
                <![CDATA[regionid  in ]]>
                <iterate property="xzbh" conjunction="," open="(" close=")">
                    #xzbh[]#
                </iterate>
            </isNotEmpty>
            GROUP BY regionid
            ) f
        </isEqual>

        <isEqual prepend="" property="alarmdevicetype" compareValue="12">
            select f.*,f.mcount-(onlinecount+notonlinecount) as wxj from (
            select gxdwbh xzqh,count(*) mcount,
            (select XZMC from ptxzs where xzbh=gxdwbh) as xzmc,
            SUM(case when state =0 or state is null then 1 else 0 end) as notonlinecount,
            SUM(case when state =1 then 1 else 0 end) as onlinecount
            from its.KSH_ZXLD
            <isNotEmpty prepend='where' property='xzbh'>
                <![CDATA[gxdwbh  in ]]>
                <iterate property="xzbh" conjunction="," open="(" close=")">
                    #xzbh[]#
                </iterate>
            </isNotEmpty>
            GROUP BY gxdwbh
            ) f
        </isEqual>
        ) f ,(SELECT t.xzbh,xzmc ,level FROM ptxzs t where level=2 START WITH sjxzbh='-1' CONNECT BY PRIOR xzbh=sjxzbh)
        b where f.xzqh in
        (select xzbh from ptxzs START WITH sjxzbh=b.xzbh CONNECT BY PRIOR xzbh=sjxzbh
        ) group by b.xzbh,b.xzmc order by b.xzbh asc
    </select>

    <select id="count_areaOnline" resultClass="java.lang.Integer" parameterClass="java.util.Map">
        select count(count(*)) from(
        <isEqual prepend="" property="alarmdevicetype" compareValue="1">
            select f.* from (
            select d.xzbh xzqh from ywvideocurrentstate a
            right JOIN sbtdspsr d on (d.sbbh=a.videonum and d.tdbh=a.channelnum )
            where  d.kz3 is not null    and d.kz3 != '1'
            <isNotEmpty prepend='AND ' property='xzbh'>
                <![CDATA[ d.xzbh in ]]>
                <iterate property="xzbh" conjunction="," open="(" close=")">
                    #xzbh[]#
                </iterate>
            </isNotEmpty>
            GROUP BY d.xzbh
            )f
        </isEqual>

        <isEqual prepend="" property="alarmdevicetype" compareValue="2">
            select f.* from (
            select c.MACHINEAREANUM xzqh
            from ywmachinecurrentstate a right join ywmachineinfo c on a.machineid=c.machineid
            <isNotEmpty prepend='where' property='xzbh'>
                <![CDATA[ c.MACHINEAREANUM  in ]]>
                <iterate property="xzbh" conjunction="," open="(" close=")">
                    #xzbh[]#
                </iterate>
            </isNotEmpty>
            GROUP BY c.MACHINEAREANUM
            ) f
        </isEqual>

        <isEqual prepend="" property="alarmdevicetype" compareValue="3">
            select f.* from (
            select a.qybh xzqh
            from nhywjtxhdgl a
            <isNotEmpty prepend='where' property='xzbh'>
                <![CDATA[a.qybh   in ]]>
                <iterate property="xzbh" conjunction="," open="(" close=")">
                    #xzbh[]#
                </iterate>
            </isNotEmpty>
            GROUP BY a.qybh
            ) f

        </isEqual>

        <isEqual prepend="" property="alarmdevicetype" compareValue="4">
            select f.* from (
            select qybh xzqh
            from nhywjtledydpgl
            <isNotEmpty prepend='where' property='xzbh'>
                <![CDATA[qybh in ]]>
                <iterate property="xzbh" conjunction="," open="(" close=")">
                    #xzbh[]#
                </iterate>
            </isNotEmpty>
            GROUP BY qybh
            ) f
        </isEqual>
        <isEqual prepend="" property="alarmdevicetype" compareValue="10">
            select f.* from (
            select regionid xzqh
            from its.ksh_detector where detectortype='GVD'
            <isNotEmpty prepend='AND ' property='xzbh'>
                <![CDATA[regionid  in ]]>
                <iterate property="xzbh" conjunction="," open="(" close=")">
                    #xzbh[]#
                </iterate>
            </isNotEmpty>
            GROUP BY regionid
            ) f
        </isEqual>

        <isEqual prepend="" property="alarmdevicetype" compareValue="11">
            select f.* from (
            select regionid xzqh
            from its.ksh_detector where detectortype='SMARTSENSOR'
            <isNotEmpty prepend='AND ' property='xzbh'>
                <![CDATA[regionid  in ]]>
                <iterate property="xzbh" conjunction="," open="(" close=")">
                    #xzbh[]#
                </iterate>
            </isNotEmpty>
            GROUP BY regionid
            ) f
        </isEqual>

        <isEqual prepend="" property="alarmdevicetype" compareValue="12">
            select f.* from (
            select gxdwbh xzqh
            from its.KSH_ZXLD
            <isNotEmpty prepend='where' property='xzbh'>
                <![CDATA[gxdwbh  in ]]>
                <iterate property="xzbh" conjunction="," open="(" close=")">
                    #xzbh[]#
                </iterate>
            </isNotEmpty>
            GROUP BY gxdwbh
            ) f
        </isEqual>
        ) f ,(SELECT t.xzbh,xzmc ,level FROM ptxzs t where level=2 START WITH sjxzbh='-1' CONNECT BY PRIOR xzbh=sjxzbh)
        b where f.xzqh in
        (select xzbh from ptxzs START WITH sjxzbh=b.xzbh CONNECT BY PRIOR xzbh=sjxzbh
        ) group by b.xzbh,b.xzmc order by b.xzbh asc
    </select>

    <!-- 监控点不在线信息 -->
    <select id="query_AreaNotonlineDetail" resultClass="java.util.HashMap" parameterClass="java.util.Map">

        <isEqual prepend="" property="alarmdevicetype" compareValue="1">
            select a.tdmc, a.xzbh, a.sbbh, a.tdbh,b.currentstateid,b.isonline,
            (select XZMC from ptxzs where xzbh=a.xzbh) as xzmc,
            (select sbip from sbxx where sbbh=a.sbbh) as sbip
            from sbtdspsr a
            left join ywvideocurrentstate b on a.sbbh=b.videonum and a.tdbh=b.channelnum
            where a.kz3 is not null    and a.kz3 != '1'
            <isNotEmpty prepend='AND ' property='xzbh'>
                (a.xzbh= #xzbh# or a.xzbh in(select xzbh from ptxzs start with sjxzbh=#xzbh# connect
                by prior xzbh= sjxzbh) )
            </isNotEmpty>
            <isNotEmpty property='tableparam'>
                $tableparam$
            </isNotEmpty>

        </isEqual>
    </select>

    <select id="count_AreaNotonlineDetail" resultClass="java.lang.Integer" parameterClass="java.util.Map">
        select count(*) from (
        select a.tdmc, a.xzbh , a.sbbh , a.tdbh,b.currentstateid,b.isonline
        from sbtdspsr a
        left join ywvideocurrentstate b on a.sbbh=b.videonum and a.tdbh=b.channelnum
        where a.kz3 is not null     and a.kz3 != '1'
        <isNotEmpty prepend='AND ' property='xzbh'>
            (a.xzbh= #xzbh# or a.xzbh in(select xzbh from ptxzs start with sjxzbh=#xzbh# connect by
            prior xzbh= sjxzbh) )
        </isNotEmpty>
        <isNotEmpty property='tableparam'>
            $tableparam$
        </isNotEmpty>
        )
    </select>


    <!-- led ,信点不在线信息 -->
    <select id="query_AreaNotonlineDeviceDetail" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        <isEqual prepend="" property="alarmdevicetype" compareValue="2">
            select a.MACHINEAREANUM as xzbh, a.machineid as sbbh, a.machinename as sbmc,
            (select XZMC from ptxzs where xzbh=a.MACHINEAREANUM) as xzmc
            from ywmachineinfo a left join ywmachinecurrentstate b on a.machineid= b.machineid where 1=1
            <isNotEmpty prepend='AND ' property='xzbh'>
                (a.MACHINEAREANUM= #xzbh# or a.MACHINEAREANUM in(select xzbh from ptxzs start with sjxzbh=#xzbh# connect
                by prior xzbh= sjxzbh) )
            </isNotEmpty>
            <isNotEmpty property='tableparam'>
                $tableparam$
            </isNotEmpty>
        </isEqual>

        <isEqual prepend="" property="alarmdevicetype" compareValue="3">
            select a.qybh as xzbh, a.xhdbh as sbbh, a.xhdmc as sbmc,
            (select XZMC from ptxzs where xzbh=a.qybh) as xzmc
            from nhywjtxhdgl a where 1=1
            <isNotEmpty prepend='AND ' property='xzbh'>
                (a.qybh= #xzbh# or a.qybh in(select xzbh from ptxzs start with sjxzbh=#xzbh# connect by prior xzbh=
                sjxzbh) )
            </isNotEmpty>
            <isNotEmpty property='tableparam'>
                $tableparam$
            </isNotEmpty>
        </isEqual>

        <isEqual prepend="" property="alarmdevicetype" compareValue="4">
            select a.qybh as xzbh, a.ledbh as sbbh, a.ledmc as sbmc,
            (select XZMC from ptxzs where xzbh=a.qybh) as xzmc
            from nhywjtledydpgl a where 1=1
            <isNotEmpty prepend='AND ' property='xzbh'>
                (a.qybh= #xzbh# or a.qybh in(select xzbh from ptxzs start with sjxzbh=#xzbh# connect by prior xzbh=
                sjxzbh) )
            </isNotEmpty>
            <isNotEmpty property='tableparam'>
                $tableparam$
            </isNotEmpty>
        </isEqual>

        <isEqual prepend="" property="alarmdevicetype" compareValue="10">
            select a.regionid as xzbh, a.bianma as sbbh, a.name as sbmc,
            (select XZMC from ptxzs where xzbh=a.regionid ) as xzmc
            from its.ksh_detector a where 1=1
            <isNotEmpty prepend='AND ' property='xzbh'>
                (a.regionid= #xzbh# or a.regionid in(select xzbh from ptxzs start with sjxzbh=#xzbh# connect by prior
                xzbh= sjxzbh) )
            </isNotEmpty>
            <isNotEmpty prepend='AND ' property='detectortype'>
                a.detectortype = #detectortype#
            </isNotEmpty>
            <isNotEmpty property='tableparam'>
                $tableparam$
            </isNotEmpty>
        </isEqual>
        <isEqual prepend="" property="alarmdevicetype" compareValue="11">
            select a.regionid as xzbh, a.bianma as sbbh, a.name as sbmc,
            (select XZMC from ptxzs where xzbh=a.regionid ) as xzmc
            from its.ksh_detector a where 1=1
            <isNotEmpty prepend='AND ' property='xzbh'>
                (a.regionid= #xzbh# or a.regionid in(select xzbh from ptxzs start with sjxzbh=#xzbh# connect by prior
                xzbh= sjxzbh) )
            </isNotEmpty>
            <isNotEmpty prepend='AND ' property='detectortype'>
                a.detectortype = #detectortype#
            </isNotEmpty>
            <isNotEmpty property='tableparam'>
                $tableparam$
            </isNotEmpty>
        </isEqual>
        <isEqual prepend="" property="alarmdevicetype" compareValue="12">
            select a.gxdwbh as xzbh, a.ldbh as sbbh, a.ldmc as sbmc,
            (select XZMC from ptxzs where xzbh=a.gxdwbh ) as xzmc
            from its.ksh_zxld a where 1=1
            <isNotEmpty prepend='AND ' property='xzbh'>
                (a.gxdwbh= #xzbh# or a.gxdwbh in(select xzbh from ptxzs start with sjxzbh=#xzbh# connect by prior xzbh=
                sjxzbh) )
            </isNotEmpty>
            <isNotEmpty property='tableparam'>
                $tableparam$
            </isNotEmpty>
        </isEqual>
    </select>

    <select id="count_AreaNotonlineDeviceDetail" resultClass="java.lang.Integer" parameterClass="java.util.Map">

        <isEqual prepend="" property="alarmdevicetype" compareValue="2">
            select count(*) from ywmachineinfo a left join ywmachinecurrentstate b on a.machineid= b.machineid
            where 1=1
            <isNotEmpty prepend='AND ' property='xzbh'>
                (a.MACHINEAREANUM= #xzbh# or a.MACHINEAREANUM in(select xzbh from ptxzs start with sjxzbh=#xzbh# connect
                by prior xzbh= sjxzbh) )
            </isNotEmpty>
            <isNotEmpty property='tableparam'>
                $tableparam$
            </isNotEmpty>
        </isEqual>

        <isEqual prepend="" property="alarmdevicetype" compareValue="3">
            select count(*)
            from nhywjtxhdgl a
            where 1=1
            <isNotEmpty prepend='AND ' property='xzbh'>
                (a.qybh= #xzbh# or a.qybh in(select xzbh from ptxzs start with sjxzbh=#xzbh# connect by prior xzbh=
                sjxzbh) )
            </isNotEmpty>
            <isNotEmpty property='tableparam'>
                $tableparam$
            </isNotEmpty>
        </isEqual>

        <isEqual prepend="" property="alarmdevicetype" compareValue="4">
            select count(*)
            from nhywjtledydpgl a
            where 1=1
            <isNotEmpty prepend='AND ' property='xzbh'>
                (a.qybh= #xzbh# or a.qybh in(select xzbh from ptxzs start with sjxzbh=#xzbh# connect by prior xzbh=
                sjxzbh) )
            </isNotEmpty>
            <isNotEmpty property='tableparam'>
                $tableparam$
            </isNotEmpty>
        </isEqual>
        <isEqual prepend="" property="alarmdevicetype" compareValue="10">
            select count(*) from its.ksh_detector a where 1=1
            <isNotEmpty prepend='AND ' property='xzbh'>
                (a.regionid= #xzbh# or a.regionid in(select xzbh from ptxzs start with sjxzbh=#xzbh# connect by prior
                xzbh= sjxzbh) )
            </isNotEmpty>
            <isNotEmpty prepend='AND ' property='detectortype'>
                a.detectortype = #detectortype#
            </isNotEmpty>
            <isNotEmpty property='tableparam'>
                $tableparam$
            </isNotEmpty>
        </isEqual>
        <isEqual prepend="" property="alarmdevicetype" compareValue="11">
            select count(*) from its.ksh_detector a where 1=1
            <isNotEmpty prepend='AND ' property='xzbh'>
                (a.regionid= #xzbh# or a.regionid in(select xzbh from ptxzs start with sjxzbh=#xzbh# connect by prior
                xzbh= sjxzbh) )
            </isNotEmpty>
            <isNotEmpty prepend='AND ' property='detectortype'>
                a.detectortype = #detectortype#
            </isNotEmpty>
            <isNotEmpty property='tableparam'>
                $tableparam$
            </isNotEmpty>
        </isEqual>
        <isEqual prepend="" property="alarmdevicetype" compareValue="12">
            select count(*) from its.ksh_zxld a where 1=1
            <isNotEmpty prepend='AND ' property='xzbh'>
                (a.gxdwbh= #xzbh# or a.gxdwbh in(select xzbh from ptxzs start with sjxzbh=#xzbh# connect by prior xzbh=
                sjxzbh) )
            </isNotEmpty>
            <isNotEmpty property='tableparam'>
                $tableparam$
            </isNotEmpty>
        </isEqual>
    </select>

    <!-- 区域在线率统计     ============================  / end-->

    <!-- 首页统计                监控故障类型 -->
    <select id="count_HomepageFalultType" resultClass="java.util.HashMap" parameterClass="java.util.Map">
		select 
			count(*) as zs,
			SUM(case when a.isonline=0 or a.isonline is null then 1 else 0 end) as sbbzx,
			SUM(case when a.networkerror=0 or a.networkerror is null then 1 else 0 end) as wlyc,
			SUM(case when a.vqcstate=0 or a.vqcstate is null then 1 else 0 end) as czyc,
			SUM(case when a.vqdstate=0 or a.vqdstate is null then 1 else 0 end) as zlzdyc,
			SUM(case when a.recordstate=0 or a.recordstate is null then 1 else 0 end) as lxyc
		from ywvideocurrentstate a
		RIGHT JOIN ywvideosyncchannel d on (d.videonum=a.videonum and d.channelnum=a.channelnum )
	</select>
    <!-- <select id="count_HomepageFalultType" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select count(*) as zs, 'zs' as name from  ywvideocurrentstate
        union all
        select count(*) as zs, 'sbbzx' as name from ywvideocurrentstate where isonline=0
        union all
        select count(*) as zs, 'wlyc' as name from ywvideocurrentstate where networkerror=0
        union all
        select count(*) as zs, 'czyc' as name from ywvideocurrentstate where vqcstate=0
        union all
        select count(*) as zs, 'zlzdyc' as name from ywvideocurrentstate where vqdstate=0
        union all
        select count(*) as zs, 'lxyc' as name from ywvideocurrentstate where recordstate=0
    </select> -->
    <!-- <select id="count_HomepageFalultType" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select count(*) as zs,
        (select count(*) from ywvideocurrentstate where isonline=0) as sbbzx,
        (select count(*) from ywvideocurrentstate where networkerror=0) as wlyc,
        (select count(*) from ywvideocurrentstate where vqcstate=0) as czyc,
        (select count(*) from ywvideocurrentstate where vqdstate=0) as zlzdyc,
        (select count(*) from ywvideocurrentstate where recordstate=0) as lxyc
        from ywvideocurrentstate
    </select> -->


    <!-- 首页查询    运维数据看板中间下面 -->
    <select id="query_videoState" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select a.*, b.sbip, c.xzmc
        from ywvideocurrentstate a
        left join sbxx b on a.videonum = b.sbbh
        left join ptxzs c on a.videocatalog = c.xzbh
        RIGHT JOIN sbtdspsr d on (d.sbbh=a.videonum and d.tdbh=a.channelnum )
        where d.kz3 is not null  and d.kz3 != '1'
        <isNotEmpty prepend='AND ' property='xzqh'>
            a.videocatalog = #xzqh#
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='normal'>
            (a.isonline is not null and a.isonline!=0)
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='abnormal'>
            (a.isonline=0 or a.isonline is null)
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='sbmc'>
            a.channelname like '%$sbmc$%'
        </isNotEmpty>
        <!-- <isNotEmpty prepend=' ' property='start'>
            limit $start$ ,$limit$
        </isNotEmpty> -->
    </select>
    <select id="count_videoState" resultClass="java.lang.Integer" parameterClass="java.util.Map">
        select count(*)
        from (
        select a.*, b.sbip, c.xzmc
        from ywvideocurrentstate a
        left join sbxx b on a.videonum = b.sbbh
        left join ptxzs c on a.videocatalog = c.xzbh
        RIGHT JOIN ywvideosyncchannel d on (d.videonum=a.videonum and d.channelnum=a.channelnum )

        where 1=1

        <isNotEmpty prepend='AND ' property='xzqh'>
            a.videocatalog = #xzqh#
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='normal'>
            (a.isonline is not null and a.isonline!=0)
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='abnormal'>
            (a.isonline=0 or a.isonline is null)
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='sbmc'>
            a.channelname like '%$sbmc$%'
        </isNotEmpty>
        ) e
    </select>


    <!-- 大屏设备行政树 -->
    <select id="getDpIntact" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select
        count(*) as total,
        sum(case when a.isonline is not null and a.isonline!=0 and a.vqcstate = 1 and a.vqdstate = 1 and recordstate =
        1 then 1 else 0 end) as
        intactnum
        from ywvideocurrentstate a
        RIGHT JOIN ywvideosyncchannel d on (d.videonum=a.videonum and d.channelnum=a.channelnum )
        where 1=1
        <isNotEmpty prepend=' ' property='tableparam'>
            $tableparam$
        </isNotEmpty>
        <!-- where videocatalog in ('04e24338cd296596f34c8d5cd5c8ff5d') -->
    </select>

    <select id="getDpVideoByXzbh" resultClass="java.util.HashMap" parameterClass="java.util.Map" remapResults="true">
        select
        a.videonum,a.channelnum,a.channelname,a.videocatalog,
        (case when isonline is not null and isonline !=0 then isonline else 0 end) as isonline,
        (case when vqcstate=1 then vqcstate else 0 end) as vqcstate,
        (case when vqdstate=1 then vqdstate else 0 end) as vqdstate,
        (case when recordstate=1 then recordstate else 0 end) as recordstate
        from ywvideocurrentstate a

        RIGHT JOIN ywvideosyncchannel d on (d.videonum=a.videonum and d.channelnum=a.channelnum )
        where 1=1

        <isNotEmpty property='tableparam'>
            $tableparam$
        </isNotEmpty>
        <!-- <isNotEmpty prepend=' ' property='start'>
            limit $start$ ,$limit$
        </isNotEmpty> -->
    </select>

    <select id="query_jsgs" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select id,name from jsgs t
        <isNotEmpty prepend='AND ' property='module'>
            t.module = #module#
        </isNotEmpty>
    </select>
    <!-- edit object  -->
    <update id="update_sbtdspsrRemarks" parameterClass="java.util.Map">
        update sbtdspsr
        <dynamic prepend="set ">
            <isNotEmpty prepend=',' property='remarks'>bz=#remarks#</isNotEmpty>
            <isNotEmpty prepend=',' property='xgry'>xgry=#xgry#</isNotEmpty>
            <isNotEmpty prepend=',' property='xgrq'>xgrq=#xgrq#</isNotEmpty>
        </dynamic>
        where xh = #XGTJid#
    </update>
    <update id="update_ywvideocurrentstateRepairState" parameterClass="java.util.Map">
        update ywvideocurrentstate
        <dynamic prepend="set ">
            <isNotEmpty prepend=',' property='repairstate'>repairstate=#repairstate#</isNotEmpty>
            <isNotEmpty prepend=',' property='modifyaccount'>modifyaccount=#modifyaccount#</isNotEmpty>
            <isNotEmpty prepend=',' property='modifytime'>modifytime=#modifytime#</isNotEmpty>
            <isNotEmpty prepend=',' property='isonline'>isonline=#isonline#</isNotEmpty>
        </dynamic>
        where videonum = #XGTJvideonum# and channelnum=#XGTJchannelnum#
    </update>
    <update id="update_jsgs" parameterClass="java.util.Map">
        update jsgs
        <dynamic prepend="set ">
            <isNotEmpty prepend=',' property='module'>module=#module#</isNotEmpty>
            <isNotEmpty prepend=',' property='name'>name=#name#</isNotEmpty>
        </dynamic>
        where id = #XGTJid#
    </update>


</sqlMap>











