<?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="Ywalarmeventcodebean" type="cn.vp.XXX.model.YwalarmeventcodeBean"/> -->	<typeAlias alias="Ywalarmeventcode" type="cn.im.alarmeventcode.YwalarmeventcodeBean"/>
	
	<sql id="condition_Ywalarmeventcode">
		where 1=1
		<isNotEmpty prepend='AND ' property='LIKEalarmcodeid'>
			(alarmcodeid like '%$LIKEalarmcodeid$%'   )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='alarmcodeid'>
			(alarmcodeid = #alarmcodeid#  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEalarmcodetype'>
			(alarmcodetype like '%$LIKEalarmcodetype$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='alarmcodetype'>
			(alarmcodetype = #alarmcodetype# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEalarmcode'>
			(alarmcode like '%$LIKEalarmcode$%'   )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='alarmcode'>
			(alarmcode = #alarmcode#  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEalarmname'>
			(alarmname like '%$LIKEalarmname$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='alarmname'>
			(alarmname = #alarmname# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEparentcode'>
			(parentcode like '%$LIKEparentcode$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='parentcode'>
			(parentcode = #parentcode# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEfullpath'>
			(fullpath like '%$LIKEfullpath$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='fullpath'>
			(fullpath = #fullpath# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEfaultcause'>
			(faultcause like '%$LIKEfaultcause$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='faultcause'>
			(faultcause = #faultcause# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEfaultdescription'>
			(faultdescription like '%$LIKEfaultdescription$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='faultdescription'>
			(faultdescription = #faultdescription# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEisenable'>
			(isenable like '%$LIKEisenable$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='isenable'>
			(isenable = #isenable# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEcreateaccount'>
			(createaccount like '%$LIKEcreateaccount$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='createaccount'>
			(createaccount = #createaccount# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEcreatetime'>
			(createtime like '%$LIKEcreatetime$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='createtime'>
			(createtime = #createtime# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEmodifyaccount'>
			(modifyaccount like '%$LIKEmodifyaccount$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='modifyaccount'>
			(modifyaccount = #modifyaccount# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEmodifytime'>
			(modifytime like '%$LIKEmodifytime$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='modifytime'>
			(modifytime = #modifytime# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEremarks'>
			(remarks like '%$LIKEremarks$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='remarks'>
			(remarks = #remarks# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEextend1'>
			(extend1 like '%$LIKEextend1$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='extend1'>
			(extend1 = #extend1# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEextend2'>
			(extend2 like '%$LIKEextend2$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='extend2'>
			(extend2 = #extend2# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEextend3'>
			(extend3 like '%$LIKEextend3$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='extend3'>
			(extend3 = #extend3# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEextend4'>
			(extend4 like '%$LIKEextend4$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='extend4'>
			(extend4 = #extend4# )
		</isNotEmpty>
		<isNotEmpty property='tableparam'>
			$tableparam$
		</isNotEmpty>
		<isNotEmpty property='order'>
			$order$
		</isNotEmpty>
	</sql>
	
	<!-- add object -->
	<insert id="insert_Ywalarmeventcode" parameterClass="java.util.Map">
		insert into 
		ywalarmeventcode(
		<dynamic prepend=" ">  
			<isNotEmpty prepend=',' property='alarmcodeid'>alarmcodeid</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmcode'>alarmcode</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmcodetype'>alarmcodetype</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmname'>alarmname</isNotEmpty>
			<isNotEmpty prepend=',' property='parentcode'>parentcode</isNotEmpty>
			<isNotEmpty prepend=',' property='fullpath'>fullpath</isNotEmpty>
			<isNotEmpty prepend=',' property='faultcause'>faultcause</isNotEmpty>
			<isNotEmpty prepend=',' property='faultdescription'>faultdescription</isNotEmpty>
			<isNotEmpty prepend=',' property='isenable'>isenable</isNotEmpty>
			<isNotEmpty prepend=',' property='cjry'>createaccount</isNotEmpty>
			<isNotEmpty prepend=',' property='cjrq'>createtime</isNotEmpty>
			<isNotEmpty prepend=',' property='xgry'>modifyaccount</isNotEmpty>
			<isNotEmpty prepend=',' property='xgrq'>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='alarmcodeid'>#alarmcodeid#</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmcode'>#alarmcode#</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmcodetype'>#alarmcodetype#</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmname'>#alarmname#</isNotEmpty>
			<isNotEmpty prepend=',' property='parentcode'>#parentcode#</isNotEmpty>
			<isNotEmpty prepend=',' property='fullpath'>#fullpath#</isNotEmpty>
			<isNotEmpty prepend=',' property='faultcause'>#faultcause#</isNotEmpty>
			<isNotEmpty prepend=',' property='faultdescription'>#faultdescription#</isNotEmpty>
			<isNotEmpty prepend=',' property='isenable'>#isenable#</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='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_Ywalarmeventcode" parameterClass="java.util.Map">
		update ywalarmeventcode 
		<dynamic prepend="set ">   
			<isNotEmpty prepend=',' property='alarmcodetype'>alarmcodetype=#alarmcodetype#</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmcode'>alarmcode=#alarmcode#</isNotEmpty>
			<isNotEmpty prepend=',' property='alarmname'>alarmname=#alarmname#</isNotEmpty>
			<isNotEmpty prepend=',' property='parentcode'>parentcode=#parentcode#</isNotEmpty>
			<isNotEmpty prepend=',' property='fullpath'>fullpath=#fullpath#</isNotEmpty>
			<isNotEmpty prepend=',' property='faultcause'>faultcause=#faultcause#</isNotEmpty>
			<isNotEmpty prepend=',' property='faultdescription'>faultdescription=#faultdescription#</isNotEmpty>
			<isNotEmpty prepend=',' property='isenable'>isenable=#isenable#</isNotEmpty>
			<isNotEmpty prepend=',' property='xgry'>modifyaccount=#xgry#</isNotEmpty>
			<isNotEmpty prepend=',' property='xgrq'>modifytime=#xgrq#</isNotEmpty>
			<isNotEmpty prepend=',' property='remarks'>remarks=#remarks#</isNotEmpty>
			<isNotEmpty prepend=',' property='extend1'>extend1=#extend1#</isNotEmpty>
			<isNotEmpty prepend=',' property='extend2'>extend2=#extend2#</isNotEmpty>
			<isNotEmpty prepend=',' property='extend3'>extend3=#extend3#</isNotEmpty>
			<isNotEmpty prepend=',' property='extend4'>extend4=#extend4#</isNotEmpty>

		</dynamic>
		where alarmcodeid = #XGTJalarmcodeid#

	</update>
	
	<!-- delete object -->
	<delete id="delete_Ywalarmeventcode" parameterClass="java.util.Map">
		delete from ywalarmeventcode 
		<include refid="condition_Ywalarmeventcode"/>
	</delete>
	
	<!-- batch delete object -->
	<delete id="batch_delete_Ywalarmeventcode" parameterClass="java.util.Map">
		delete from ywalarmeventcode 
		where 1=1
			<isNotEmpty prepend='AND ' property='keyword'>
			key  in (#keyword#)
			</isNotEmpty>
	</delete>
	
	<!-- query objects by page-->
	<select id="query_Ywalarmeventcode" resultClass="java.util.HashMap" parameterClass="java.util.Map">
		select a.*,b.alarmname as alarmcodetypeNa from (
		select 
			alarmcodeid,alarmcode,alarmcodetype,alarmname,parentcode,fullpath,faultcause,faultdescription,isenable,createaccount,createtime,modifyaccount,modifytime,remarks,extend1,extend2,extend3,extend4
		from ywalarmeventcode 
		WHERE 1 = 1 AND fullpath is not null
		<isNotEmpty prepend='AND ' property='LIKEalarmcodeid'>
			(alarmcodeid like '%$LIKEalarmcodeid$%'   )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='alarmcodeid'>
			(alarmcodeid = #alarmcodeid#  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEalarmcodetype'>
			(alarmcodetype like '%$LIKEalarmcodetype$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='alarmcodetype'>
			(alarmcodetype = #alarmcodetype# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEalarmcode'>
			(alarmcode like '%$LIKEalarmcode$%'   )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='alarmcode'>
			(alarmcode = #alarmcode#  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEalarmname'>
			(alarmname like '%$LIKEalarmname$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='alarmname'>
			(alarmname = #alarmname# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEparentcode'>
			(parentcode like '%$LIKEparentcode$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='parentcode'>
			(parentcode = #parentcode# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEfullpath'>
			(fullpath like '%$LIKEfullpath$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='fullpath'>
			(fullpath = #fullpath# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEfaultcause'>
			(faultcause like '%$LIKEfaultcause$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='faultcause'>
			(faultcause = #faultcause# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEfaultdescription'>
			(faultdescription like '%$LIKEfaultdescription$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='faultdescription'>
			(faultdescription = #faultdescription# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEisenable'>
			(isenable like '%$LIKEisenable$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='isenable'>
			(isenable = #isenable# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEcreateaccount'>
			(createaccount like '%$LIKEcreateaccount$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='createaccount'>
			(createaccount = #createaccount# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEcreatetime'>
			(createtime like '%$LIKEcreatetime$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='createtime'>
			(createtime = #createtime# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEmodifyaccount'>
			(modifyaccount like '%$LIKEmodifyaccount$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='modifyaccount'>
			(modifyaccount = #modifyaccount# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEmodifytime'>
			(modifytime like '%$LIKEmodifytime$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='modifytime'>
			(modifytime = #modifytime# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEremarks'>
			(remarks like '%$LIKEremarks$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='remarks'>
			(remarks = #remarks# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEextend1'>
			(extend1 like '%$LIKEextend1$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='extend1'>
			(extend1 = #extend1# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEextend2'>
			(extend2 like '%$LIKEextend2$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='extend2'>
			(extend2 = #extend2# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEextend3'>
			(extend3 like '%$LIKEextend3$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='extend3'>
			(extend3 = #extend3# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEextend4'>
			(extend4 like '%$LIKEextend4$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='extend4'>
			(extend4 = #extend4# )
		</isNotEmpty>
		<isNotEmpty property='tableparam'>
			$tableparam$
		</isNotEmpty>
		<isNotEmpty property='order'>
			$order$
		</isNotEmpty>
		
		) a
		left join ywalarmeventcode b on a.parentcode = b.alarmcode where b.fullpath is NULL
	</select>
	
	<select id="query_YwalarmeventcodeByTree" resultClass="java.util.HashMap" parameterClass="java.util.Map">
		select 
			alarmcodeid,alarmcode,alarmname,parentcode,alarmcodetype
		from ywalarmeventcode 
		where 1=1
		AND fullpath is NULL
		<isNotEmpty prepend='AND ' property='parentcode'>
			(parentcode = #parentcode# )
		</isNotEmpty>
		<isNotEmpty property='tableparam'>
			$tableparam$
		</isNotEmpty>
		<isNotEmpty property='order'>
			$order$
		</isNotEmpty>
	</select>
	
	<!-- query objects totalcount -->
	<select id="count_Ywalarmeventcode" resultClass="java.lang.Integer" parameterClass="java.util.Map">
		select count(*) from ywalarmeventcode 
		<include refid="condition_Ywalarmeventcode"/>			
	</select>
	
	<!-- batch add objects -->
	<insert id="batch_insert_Ywalarmeventcode" parameterClass="java.util.List">
	 	<![CDATA[
          INSERT
      	]]>
      	<iterate conjunction=" " > 
			into ywalarmeventcode(
			 <![CDATA[ 
				alarmcodeid,alarmcodetype,alarmcode,alarmname,isenable,createaccount,createtime,modifyaccount,modifytime,remarks,extend1,extend2,extend3,extend4
			)values
			 ]]>  		 
			 <![CDATA[ 
				(
				#list[].alarmcodeid#,#list[].alarmcodetype#,	#list[].alarmcode#,#list[].alarmname#,#list[].isenable#,#list[].createaccount#,#list[].createtime#,#list[].modifyaccount#,#list[].modifytime#,#list[].remarks#,#list[].extend1#,#list[].extend2#,#list[].extend3#,#list[].extend4#
				)
			]]>    
    	</iterate> 
	</insert>
</sqlMap>











