<?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="Nhywjtledydpglbean" type="cn.vp.XXX.model.NhywjtledydpglBean"/> -->
    <typeAlias alias="Nhywjtledydpgl" type="cn.im.nhywjtledydpgl.NhywjtledydpglBean"/>

    <sql id="condition_Nhywjtledydpgl">
        where 1=1
        <isNotEmpty prepend='AND ' property='LIKExh'>
            (xh like '%$LIKExh$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='xh'>
            (xh = #xh# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEledmc'>
            (ledmc like '%$LIKEledmc$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEmc'>
            (ledmc like '%$LIKEmc$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='ledmc'>
            (ledmc = #ledmc# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEledbh'>
            (ledbh like '%$LIKEledbh$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='ledbh'>
            (ledbh = #ledbh# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEsccs'>
            (sccs like '%$LIKEsccs$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='sccs'>
            (sccs = #sccs# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEpp'>
            (pp like '%$LIKEpp$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='pp'>
            (pp = #pp# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEggxh'>
            (ggxh like '%$LIKEggxh$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='ggxh'>
            (ggxh = #ggxh# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEqybh'>
            (qybh like '%$LIKEqybh$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='qybh'>
            (qybh = #qybh# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEqymc'>
            (qymc like '%$LIKEqymc$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='qymc'>
            (qymc = #qymc# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKElkh'>
            (lkh like '%$LIKElkh$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='lkh'>
            (lkh = #lkh# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKElkmc'>
            (lkmc like '%$LIKElkmc$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='lkmc'>
            (lkmc = #lkmc# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKElkxw'>
            (lkxw like '%$LIKElkxw$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='lkxw'>
            (lkxw = #lkxw# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEazsj'>
            (azsj like '%$LIKEazsj$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='azsj'>
            (azsj = #azsj# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEazdw'>
            (azdw like '%$LIKEazdw$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='azdw'>
            (azdw = #azdw# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEqdfs'>
            (qdfs like '%$LIKEqdfs$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='qdfs'>
            (qdfs = #qdfs# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEsszbx'>
            (sszbx like '%$LIKEsszbx$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='sszbx'>
            (sszbx = #sszbx# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEjd'>
            (jd like '%$LIKEjd$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='jd'>
            (jd = #jd# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEwd'>
            (wd like '%$LIKEwd$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='wd'>
            (wd = #wd# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKExhdjj'>
            (xhdjj like '%$LIKExhdjj$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='xhdjj'>
            (xhdjj = #xhdjj# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEcjry'>
            (cjry like '%$LIKEcjry$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='cjry'>
            (cjry = #cjry# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEcjrq'>
            (cjrq like '%$LIKEcjrq$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='cjrq'>
            (cjrq = #cjrq# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKExgry'>
            (xgry like '%$LIKExgry$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='xgry'>
            (xgry = #xgry# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKExgrq'>
            (xgrq like '%$LIKExgrq$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='xgrq'>
            (xgrq = #xgrq# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEbz'>
            (bz like '%$LIKEbz$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='bz'>
            (bz = #bz# )
        </isNotEmpty>
        <isNotEmpty property='emptyremarks'>
            <isEqual prepend='AND ' property='emptyremarks' compareValue="0">
                (bz is null or bz =' ' )
            </isEqual>
            <isEqual prepend='AND ' property='emptyremarks' compareValue="1">
                (bz is not null and bz !=' ' )
            </isEqual>
        </isNotEmpty>

        <isNotEmpty prepend='AND ' property='LIKEkz1'>
            (kz1 like '%$LIKEkz1$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='kz1'>
            (kz1 = #kz1# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEkz2'>
            (kz2 like '%$LIKEkz2$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='kz2'>
            (kz2 = #kz2# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEkz3'>
            (kz3 like '%$LIKEkz3$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='kz3'>
            (kz3 = #kz3# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEkz4'>
            (kz4 like '%$LIKEkz4$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='kz4'>
            (kz4 = #kz4# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='state'>
            (state =#state# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='sbzt'>
            (sbzt =#sbzt# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='LIKEip'>
            (ip like '%$LIKEip$%' )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='ip'>
            (ip = #ip# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='statusupbatch'>
            (statusupbatch =#statusupbatch# )
        </isNotEmpty>
        <isNotEmpty prepend='AND ' property='currentstate'>
            (a.STATE = #currentstate# )
        </isNotEmpty>
        <isNotEmpty property='tableparam'>
            $tableparam$
        </isNotEmpty>
        <isNotEmpty property='order'>
            $order$
        </isNotEmpty>
    </sql>

    <!-- add object -->
    <insert id="insert_Nhywjtledydpgl" parameterClass="java.util.Map">
        insert into
        nhywjtledydpgl(
        <dynamic prepend=" ">
            <isNotEmpty prepend=',' property='xh'>xh</isNotEmpty>
            <isNotEmpty prepend=',' property='ledmc'>ledmc</isNotEmpty>
            <isNotEmpty prepend=',' property='ledbh'>ledbh</isNotEmpty>
            <isNotEmpty prepend=',' property='sccs'>sccs</isNotEmpty>
            <isNotEmpty prepend=',' property='pp'>pp</isNotEmpty>
            <isNotEmpty prepend=',' property='ggxh'>ggxh</isNotEmpty>
            <isNotEmpty prepend=',' property='qybh'>qybh</isNotEmpty>
            <isNotEmpty prepend=',' property='qymc'>qymc</isNotEmpty>
            <isNotEmpty prepend=',' property='lkh'>lkh</isNotEmpty>
            <isNotEmpty prepend=',' property='lkmc'>lkmc</isNotEmpty>
            <isNotEmpty prepend=',' property='lkxw'>lkxw</isNotEmpty>
            <isNotEmpty prepend=',' property='azsj'>azsj</isNotEmpty>
            <isNotEmpty prepend=',' property='azdw'>azdw</isNotEmpty>
            <isNotEmpty prepend=',' property='qdfs'>qdfs</isNotEmpty>
            <isNotEmpty prepend=',' property='sszbx'>sszbx</isNotEmpty>
            <isNotEmpty prepend=',' property='jd'>jd</isNotEmpty>
            <isNotEmpty prepend=',' property='wd'>wd</isNotEmpty>
            <isNotEmpty prepend=',' property='xhdjj'>xhdjj</isNotEmpty>
            <isNotEmpty prepend=',' property='cjry'>cjry</isNotEmpty>
            <isNotEmpty prepend=',' property='cjrq'>cjrq</isNotEmpty>
            <isNotEmpty prepend=',' property='xgry'>xgry</isNotEmpty>
            <isNotEmpty prepend=',' property='xgrq'>xgrq</isNotEmpty>
            <isNotEmpty prepend=',' property='bz'>bz</isNotEmpty>
            <isNotEmpty prepend=',' property='kz1'>kz1</isNotEmpty>
            <isNotEmpty prepend=',' property='kz2'>kz2</isNotEmpty>
            <isNotEmpty prepend=',' property='kz3'>kz3</isNotEmpty>
            <isNotEmpty prepend=',' property='kz4'>kz4</isNotEmpty>

        </dynamic>
        <![CDATA[
	        ) values ( 
	    ]]>
        <dynamic prepend=" ">
            <isNotEmpty prepend=',' property='xh'>#xh#</isNotEmpty>
            <isNotEmpty prepend=',' property='ledmc'>#ledmc#</isNotEmpty>
            <isNotEmpty prepend=',' property='ledbh'>#ledbh#</isNotEmpty>
            <isNotEmpty prepend=',' property='sccs'>#sccs#</isNotEmpty>
            <isNotEmpty prepend=',' property='pp'>#pp#</isNotEmpty>
            <isNotEmpty prepend=',' property='ggxh'>#ggxh#</isNotEmpty>
            <isNotEmpty prepend=',' property='qybh'>#qybh#</isNotEmpty>
            <isNotEmpty prepend=',' property='qymc'>#qymc#</isNotEmpty>
            <isNotEmpty prepend=',' property='lkh'>#lkh#</isNotEmpty>
            <isNotEmpty prepend=',' property='lkmc'>#lkmc#</isNotEmpty>
            <isNotEmpty prepend=',' property='lkxw'>#lkxw#</isNotEmpty>
            <isNotEmpty prepend=',' property='azsj'>#azsj#</isNotEmpty>
            <isNotEmpty prepend=',' property='azdw'>#azdw#</isNotEmpty>
            <isNotEmpty prepend=',' property='qdfs'>#qdfs#</isNotEmpty>
            <isNotEmpty prepend=',' property='sszbx'>#sszbx#</isNotEmpty>
            <isNotEmpty prepend=',' property='jd'>#jd#</isNotEmpty>
            <isNotEmpty prepend=',' property='wd'>#wd#</isNotEmpty>
            <isNotEmpty prepend=',' property='xhdjj'>#xhdjj#</isNotEmpty>
            <isNotEmpty prepend=',' property='cjry'>#cjry#</isNotEmpty>
            <isNotEmpty prepend=',' property='cjrq'>#cjrq#</isNotEmpty>
            <isNotEmpty prepend=',' property='xgry'>#xgry#</isNotEmpty>
            <isNotEmpty prepend=',' property='xgrq'>#xgrq#</isNotEmpty>
            <isNotEmpty prepend=',' property='bz'>#bz#</isNotEmpty>
            <isNotEmpty prepend=',' property='kz1'>#kz1#</isNotEmpty>
            <isNotEmpty prepend=',' property='kz2'>#kz2#</isNotEmpty>
            <isNotEmpty prepend=',' property='kz3'>#kz3#</isNotEmpty>
            <isNotEmpty prepend=',' property='kz4'>#kz4#</isNotEmpty>

        </dynamic>
        <![CDATA[
	        ) 
	    ]]>
    </insert>

    <!-- edit object  -->
    <update id="update_Nhywjtledydpgl" parameterClass="java.util.Map">
        update nhywjtledydpgl
        <dynamic prepend="set ">
            <isNotEmpty prepend=',' property='ledmc'>ledmc=#ledmc#</isNotEmpty>
            <isNotEmpty prepend=',' property='ledbh'>ledbh=#ledbh#</isNotEmpty>
            <isNotEmpty prepend=',' property='sccs'>sccs=#sccs#</isNotEmpty>
            <isNotEmpty prepend=',' property='pp'>pp=#pp#</isNotEmpty>
            <isNotEmpty prepend=',' property='ggxh'>ggxh=#ggxh#</isNotEmpty>
            <isNotEmpty prepend=',' property='qybh'>qybh=#qybh#</isNotEmpty>
            <isNotEmpty prepend=',' property='qymc'>qymc=#qymc#</isNotEmpty>
            <isNotEmpty prepend=',' property='lkh'>lkh=#lkh#</isNotEmpty>
            <isNotEmpty prepend=',' property='lkmc'>lkmc=#lkmc#</isNotEmpty>
            <isNotEmpty prepend=',' property='lkxw'>lkxw=#lkxw#</isNotEmpty>
            <isNotEmpty prepend=',' property='azsj'>azsj=#azsj#</isNotEmpty>
            <isNotEmpty prepend=',' property='azdw'>azdw=#azdw#</isNotEmpty>
            <isNotEmpty prepend=',' property='qdfs'>qdfs=#qdfs#</isNotEmpty>
            <isNotEmpty prepend=',' property='sszbx'>sszbx=#sszbx#</isNotEmpty>
            <isNotEmpty prepend=',' property='jd'>jd=#jd#</isNotEmpty>
            <isNotEmpty prepend=',' property='wd'>wd=#wd#</isNotEmpty>
            <isNotEmpty prepend=',' property='xhdjj'>xhdjj=#xhdjj#</isNotEmpty>
            <isNotEmpty prepend=',' property='cjry'>cjry=#cjry#</isNotEmpty>
            <isNotEmpty prepend=',' property='cjrq'>cjrq=#cjrq#</isNotEmpty>
            <isNotEmpty prepend=',' property='xgry'>xgry=#xgry#</isNotEmpty>
            <isNotEmpty prepend=',' property='xgrq'>xgrq=#xgrq#</isNotEmpty>
            <isNotEmpty prepend=',' property='bz'>bz=#bz#</isNotEmpty>
            <isNotEmpty prepend=',' property='kz1'>kz1=#kz1#</isNotEmpty>
            <isNotEmpty prepend=',' property='kz2'>kz2=#kz2#</isNotEmpty>
            <isNotEmpty prepend=',' property='kz3'>kz3=#kz3#</isNotEmpty>
            <isNotEmpty prepend=',' property='kz4'>kz4=#kz4#</isNotEmpty>
            <isNotEmpty prepend=',' property='detectionswitch'>detectionswitch=#detectionswitch#</isNotEmpty>
            <isNotEmpty prepend=',' property='detectionstarttime'>detectionstarttime=#detectionstarttime#</isNotEmpty>
        </dynamic>
        where xh = #XGTJxh#
        <isNotEmpty prepend='AND ' property='XGTJledmc'>ledmc = #XGTJledmc#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJledbh'>ledbh = #XGTJledbh#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJsccs'>sccs = #XGTJsccs#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJpp'>pp = #XGTJpp#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJggxh'>ggxh = #XGTJggxh#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJqybh'>qybh = #XGTJqybh#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJqymc'>qymc = #XGTJqymc#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJlkh'>lkh = #XGTJlkh#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJlkmc'>lkmc = #XGTJlkmc#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJlkxw'>lkxw = #XGTJlkxw#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJazsj'>azsj = #XGTJazsj#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJazdw'>azdw = #XGTJazdw#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJqdfs'>qdfs = #XGTJqdfs#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJsszbx'>sszbx = #XGTJsszbx#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJjd'>jd = #XGTJjd#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJwd'>wd = #XGTJwd#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJxhdjj'>xhdjj = #XGTJxhdjj#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJcjry'>cjry = #XGTJcjry#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJcjrq'>cjrq = #XGTJcjrq#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJxgry'>xgry = #XGTJxgry#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJxgrq'>xgrq = #XGTJxgrq#</isNotEmpty>

        <isNotEmpty prepend='AND ' property='XGTJlifetime'>lifetime=#XGTJlifetime#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJdetectionswitch'>detectionswitch=#XGTJdetectionswitch#</isNotEmpty>
        <isNotEmpty prepend='AND ' property='XGTJdetectionstarttime'>detectionstarttime=#XGTJdetectionstarttime#
        </isNotEmpty>

    </update>

    <update id="updateJtydpJdWdByXh" parameterClass="java.util.Map">
		update nhywjtledydpgl set  jd = #jd# , wd=#wd#, xgry=#xgry#,xgrq=#xgrq#  where  xh = #xh#
	</update>

    <!-- delete object -->
    <delete id="delete_Nhywjtledydpgl" parameterClass="java.util.Map">
        delete from nhywjtledydpgl  where xh = #xh#
    </delete>

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

    <!-- query objects by page-->
    <select id="query_Nhywjtledydpgl" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select a.*,b.csdm,b.csmc from (
        select * from nhywjtledydpgl
        <include refid="condition_Nhywjtledydpgl"/>
        )a left join xtcl b on b.csdm= detectionswitch and b.csdl = 'ywTaskEnable'

    </select>
    <!-- query objects by page-->
    <select id="get_Nhywjtledydpgl" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select * from nhywjtledydpgl
        <include refid="condition_Nhywjtledydpgl"/>
    </select>
    <!-- query objects totalcount -->
    <select id="count_Nhywjtledydpgl" resultClass="java.lang.Integer" parameterClass="java.util.Map">
        select count(*) from nhywjtledydpgl
        <include refid="condition_Nhywjtledydpgl"/>
    </select>

    <!-- batch add objects -->
    <insert id="batch_insert_Nhywjtledydpgl" parameterClass="java.util.List">
        <![CDATA[
          INSERT
      	]]>
        <iterate conjunction=" ">
            into nhywjtledydpgl(
            <![CDATA[
				xh,ledmc,ledbh,sccs,pp,ggxh,qybh,qymc,lkh,lkmc,lkxw,azsj,azdw,qdfs,sszbx,jd,wd,xhdjj,cjry,cjrq,xgry,xgrq,bz,kz1,kz2,kz3,kz4
			)values
			 ]]>
            <![CDATA[
				(
				#list[].xh#,#list[].ledmc#,#list[].ledbh#,#list[].sccs#,#list[].pp#,#list[].ggxh#,#list[].qybh#,#list[].qymc#,#list[].lkh#,#list[].lkmc#,#list[].lkxw#,#list[].azsj#,#list[].azdw#,#list[].qdfs#,#list[].sszbx#,#list[].jd#,#list[].wd#,#list[].xhdjj#,#list[].cjry#,#list[].cjrq#,#list[].xgry#,#list[].xgrq#,#list[].bz#,#list[].kz1#,#list[].kz2#,#list[].kz3#,#list[].kz4#
				)
			]]>
        </iterate>
    </insert>

    <select id="statisticsYDPOnlineRate" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select   count(*) as totalcount,
        SUM(case when a.state is not null and  a.state=1  then 1 else 0 end) as ydponlinenum,
        SUM(case when  a.state =0 or a.state is null then 1 else 0 end) as ydpunonlinenum
        from nhywjtledydpgl a
	</select>

    <select id="query_NhywjtledydpglStatus" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select
        xh,ledmc,ledbh,sccs,pp,ggxh,qybh,qymc,lkh,lkmc,lkxw,azsj,azdw,qdfs,sszbx,jd,wd,xhdjj,cjry,cjrq,xgry,xgrq,bz,kz1,kz2,kz3,kz4,state
        from nhywjtledydpgl
        <include refid="condition_Nhywjtledydpgl"/>

    </select>
    <select id="count_NhywjtledydpglStatus" resultClass="java.lang.Integer" parameterClass="java.util.Map">
        select count(xh)
        from nhywjtledydpgl t
        <include refid="condition_Nhywjtledydpgl"/>
    </select>

    <select id="query_NhywjtledydpglStatusUnonline" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select b.* from(
        select
        xh,ledmc,ledbh,sccs,pp,ggxh,qybh,qymc,lkh,lkmc,lkxw,azsj,azdw,qdfs,sszbx,jd,wd,xhdjj,cjry,cjrq,xgry,xgrq,bz,kz1,kz2,kz3,kz4,state
        from nhywjtledydpgl t
        <include refid="condition_Nhywjtledydpgl"/>
        )b
    </select>
    <select id="count_NhywjtledydpglStatusUnonline" resultClass="java.lang.Integer" parameterClass="java.util.Map">
        select count(xh) from nhywjtledydpgl t
        <include refid="condition_Nhywjtledydpgl"/>
    </select>

    <select id="query_Ywydphistorystate" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select
        xh,ledmc,ledbh,sccs,pp,ggxh,qybh,qymc,lkh,lkmc,lkxw,azsj,azdw,qdfs,sszbx,jd,wd,xhdjj,cjry,cjrq,xgry,xgrq,bz,kz1,kz2,kz3,kz4,b.xjsj,b.sbzt
        from (select* from nhywjtledydpgl t
        <include refid="condition_Nhywjtledydpgl"/>
        )t inner join NHYWJTLEDYDPZT b on t.xh=b.sbid
        <isNotEmpty prepend="and" property="startTime">
            <![CDATA[ b.xjsj >= #startTime# ]]>
        </isNotEmpty>
        <isNotEmpty prepend="and" property="endTime">
            <![CDATA[ b.xjsj <=#endTime# ]]>
        </isNotEmpty>
    </select>
    <select id="count_Ywydphistorystate" resultClass="java.lang.Integer" parameterClass="java.util.Map">
        select count(*) from (select * from nhywjtledydpgl t
        <include refid="condition_Nhywjtledydpgl"/>
        )t inner join NHYWJTLEDYDPZT b on t.xh=b.sbid
        <isNotEmpty prepend="and" property="startTime">
            <![CDATA[ b.xjsj >= #startTime# ]]>
        </isNotEmpty>
        <isNotEmpty prepend="and" property="endTime">
            <![CDATA[ b.xjsj <=#endTime# ]]>
        </isNotEmpty>
    </select>


    <select id="query_Ywydpstatusinfo" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select a.*,b.ledbh ,b.ledmc from (
        select statusupbatch,xh from ywledydpstatusinfo
        <include refid="condition_Nhywjtledydpgl"/>
        GROUP BY statusupbatch,xh ) a
        left join NHYWJTLEDYDPGL b on a.xh = b.xh
    </select>
    <select id="count_Ywydpstatusinfo" resultClass="java.lang.Integer" parameterClass="java.util.Map">
        select count(*) from (
        select statusupbatch,xh from ywledydpstatusinfo
        <include refid="condition_Nhywjtledydpgl"/>
        GROUP BY statusupbatch,xh ) a left join NHYWJTLEDYDPGL b on a.xh = b.xh
    </select>


    <select id="query_YwNoTaskydpstatusinfo" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select a.*,b.csmc from (select xh,ledmc,ledbh,detectionswitch from NHYWJTLEDYDPGL
        where xh not in (select xh from ywledydpstatusinfo b
        <include refid="condition_Nhywjtledydpgl"/>
        and xh=b.xh)) a left join xtcl b on a.detectionswitch = b.csdm and b.csdl = 'ywTaskEnable'
    </select>

    <select id="count_YwNoTaskydpstatusinfo" resultClass="java.lang.Integer" parameterClass="java.util.Map">
        select count(xh) from NHYWJTLEDYDPGL where xh not in (select xh from ywledydpstatusinfo b
        <include refid="condition_Nhywjtledydpgl"/>
        and xh=b.xh)
    </select>
    <!-- 根据 xh 批量更新启用状态 -->
    <update id="edit_Ywydpinfo" parameterClass="java.util.Map">
        update NHYWJTLEDYDPGL
        <dynamic prepend="set ">
            <isNotEmpty prepend=',' property='detectionswitch'>detectionswitch=#detectionswitch#</isNotEmpty>
            <isNotEmpty prepend=',' property='modifyaccount'>xgry=#modifyaccount#</isNotEmpty>
            <isNotEmpty prepend=',' property='modifytime'>xgrq=#modifytime#</isNotEmpty>
        </dynamic>
        where xh in
        <iterate open="(" close=")" conjunction="," property="keys">
            #keys[]#
        </iterate>
    </update>


    <select id="query_YwAllydpstatusinfo" resultClass="java.util.HashMap" parameterClass="java.util.Map">
        select
        xh,ledmc,ledbh,sccs,pp,ggxh,qybh,qymc,lkh,lkmc,lkxw,azsj,azdw,qdfs,sszbx,jd,wd,xhdjj,cjry,
        cjrq,xgry,xgrq,bz,kz1,kz2,kz3,kz4,state,
        qybh xzbh,( select xzmc from Ptxzs where xzbh=qybh) xzmc,ip,
        (select csmc from Xtcl where csdl='nhywjtledydpglCurrentState' and csdm=state)status,ledmc name,repairstate,
        (select alarmname from ywalarmeventcode where alarmcode=repairstate)repairstatename
        from nhywjtledydpgl t
        <include refid="condition_Nhywjtledydpgl"/>
    </select>

    <select id="count_YwAllydpstatusinfo" resultClass="java.lang.Integer" parameterClass="java.util.Map">
        select
        count(xh)
        from nhywjtledydpgl t
        <include refid="condition_Nhywjtledydpgl"/>
    </select>
    <update id="update_NhywledydpCurrentState" parameterClass="java.util.Map">
        update nhywjtledydpgl
        <dynamic prepend="set ">
            <isNotEmpty prepend=',' property='repairstate'>repairstate=#repairstate#</isNotEmpty>
        </dynamic>
        where xh = #XGTJxh#
    </update>
    <update id="update_NhywjtledydpglRemarks" parameterClass="java.util.Map">
        update nhywjtledydpgl set xgry=#xgry#,xgrq=#xgrq#, bz = #bz#
        <dynamic prepend=", ">
            <isNotEmpty prepend=',' property='repairstate'>repairstate=#repairstate#</isNotEmpty>
            <isNotEmpty prepend=',' property='state'>state=#state#</isNotEmpty>
        </dynamic>
        where xh = #XGTJxh#
    </update>

</sqlMap>











