<?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="Gjbhxxbean" type="cn.vp.XXX.model.GjbhxxBean"/> -->	
	
	<sql id="condition_Gjbhxx">
		where 1=1
		<isNotEmpty prepend='AND' property='LIKExh'>
			(xh like '%$LIKExh$%'    )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='xh'>
			(xh = #xh#  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEgjbh'>
			(gjbh like '%$LIKEgjbh$%'    )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='gjbh'>
			(gjbh = #gjbh# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEgjmc'>
			(gjmc like '%$LIKEgjmc$%'    )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='gjmc'>
			(gjmc = #gjmc# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEgjjb'>
			(gjjb like '%$LIKEgjjb$%'    )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='gjjb'>
			(gjjb = #gjjb# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEbjfl'>
			(bjfl like '%$LIKEbjfl$%'    )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='bjfl'>
			(bjfl = #bjfl# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEgjsbdy'>
			(gjsbdy like '%$LIKEgjsbdy$%'    )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='gjsbdy'>
			(gjsbdy = #gjsbdy# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKExxlx'>
			(xxlx like '%$LIKExxlx$%'    )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='xxlx'>
			(xxlx = #xxlx# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEbz'>
			(bz like '%$LIKEbz$%'    )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='bz'>
			(bz = #bz# )
		</isNotEmpty>
		<isNotEmpty property='tableparam'>
			$tableparam$
		</isNotEmpty>
		<isNotEmpty property='order'>
			$order$
		</isNotEmpty>
	</sql>
	
	<!-- add object -->
	<insert id="insert_Gjbhxx" parameterClass="java.util.Map">
		insert into 
		gjbhxx(
		<dynamic prepend=" ">  
			<isNotEmpty prepend=',' property='xh'>xh</isNotEmpty>
			<isNotEmpty prepend=',' property='gjbh'>gjbh</isNotEmpty>
			<isNotEmpty prepend=',' property='gjmc'>gjmc</isNotEmpty>
			<isNotEmpty prepend=',' property='gjjb'>gjjb</isNotEmpty>
			<isNotEmpty prepend=',' property='bjfl'>bjfl</isNotEmpty>
			<isNotEmpty prepend=',' property='gjsbdy'>gjsbdy</isNotEmpty>
			<isNotEmpty prepend=',' property='xxlx'>xxlx</isNotEmpty>
			<isNotEmpty prepend=',' property='bz'>bz</isNotEmpty>

		</dynamic>  
	    <![CDATA[ 
	        ) values ( 
	    ]]>  
	     <dynamic prepend=" "> 
			<isNotEmpty prepend=',' property='xh'>#xh#</isNotEmpty>
			<isNotEmpty prepend=',' property='gjbh'>#gjbh#</isNotEmpty>
			<isNotEmpty prepend=',' property='gjmc'>#gjmc#</isNotEmpty>
			<isNotEmpty prepend=',' property='gjjb'>#gjjb#</isNotEmpty>
			<isNotEmpty prepend=',' property='bjfl'>#bjfl#</isNotEmpty>
			<isNotEmpty prepend=',' property='gjsbdy'>#gjsbdy#</isNotEmpty>
			<isNotEmpty prepend=',' property='xxlx'>#xxlx#</isNotEmpty>
			<isNotEmpty prepend=',' property='bz'>#bz#</isNotEmpty>

		 </dynamic>  
	    <![CDATA[ 
	        ) 
	    ]]> 
	</insert>
	
	<!-- edit object  -->
	<update id="update_Gjbhxx" parameterClass="java.util.Map">
		update gjbhxx 
		<dynamic prepend="set ">   
			
			<isNotEmpty prepend=',' property='gjbh'>gjbh=#gjbh#</isNotEmpty>
			<isNotEmpty prepend=',' property='gjmc'>gjmc=#gjmc#</isNotEmpty>
			<isNotEmpty prepend=',' property='gjjb'>gjjb=#gjjb#</isNotEmpty>
			<isNotEmpty prepend=',' property='bjfl'>bjfl=#bjfl#</isNotEmpty>
			<isNotEmpty prepend=',' property='gjsbdy'>gjsbdy=#gjsbdy#</isNotEmpty>
			<isNotEmpty prepend=',' property='xxlx'>xxlx=#xxlx#</isNotEmpty>
			<isNotEmpty prepend=',' property='bz'>bz=#bz#</isNotEmpty>

		</dynamic>
		where 1=1 
			<isNotEmpty prepend='AND' property='XGTJxh'> xh = #XGTJxh#</isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJgjbh'> gjbh = #XGTJgjbh# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJgjmc'> gjmc = #XGTJgjmc# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJgjjb'> gjjb = #XGTJgjjb# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJbjfl'> bjfl = #XGTJbjfl# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJgjsbdy'> gjsbdy = #XGTJgjsbdy# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJxxlx'> xxlx = #XGTJxxlx# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJbz'> bz = #XGTJbz# </isNotEmpty>

	</update>
	
	<!-- delete object -->
	<delete id="delete_Gjbhxx" parameterClass="java.util.Map">
		delete from gjbhxx 
		<include refid="condition_Gjbhxx"/>
	</delete>
	
	<!-- query objects by page-->
	<select id="query_Gjbhxx" resultClass="java.util.HashMap" parameterClass="java.util.Map">
		select a.*,c.csmc as bjflmc,d.csmc as gjsbdymc from (
			select 
				xh,gjbh,gjmc,gjjb,bjfl,gjsbdy,xxlx,bz
			from gjbhxx 
			<include refid="condition_Gjbhxx"/>
		)a 
		left join xtcl c on a.bjfl = c.csdm AND c.csdl= 'alarmKind'
		left join xtcl d on a.gjsbdy = d.csdm AND d.csdl= 'alarmDeviceDefine'		
	</select>
	
	<!-- query objects totalcount -->
	<select id="count_Gjbhxx" resultClass="java.lang.Integer" parameterClass="java.util.Map">
		select count(*) from gjbhxx 
		<include refid="condition_Gjbhxx"/>			
	</select>
</sqlMap>











