<?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="Xtcl">
	<!-- <typeAlias alias="Xtclbean" type="com.vp.XXX.model.XtclBean"/> -->

	<sql id="condition_Xtcl">
		where 1=1
		<isNotEmpty prepend='AND ' property='LIKExh'>
			(xh like '%$LIKExh$%'
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='xh'>
			(xh = #xh# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEcsdl'>
			(csdl like '%$LIKEcsdl$%')
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='csdl'>
			(csdl = #csdl# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEcslm'>
			(cslm like '%$LIKEcslm$%')
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='cslm'>
			(cslm = #cslm# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEcsdm'>
			(csdm like '%$LIKEcsdm$%')
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='startLIKEcsdm'>
			(csdm like '$startLIKEcsdm$%')
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='csdm'>
			(csdm = #csdm# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEcsmc'>
			(csmc like '%$LIKEcsmc$%')
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='csmc'>
			(csmc = #csmc# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='LIKEcspx'>
			(cspx like '%$LIKEcspx$%')
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='cspx'>
			(cspx = #cspx# )
		</isNotEmpty>
		<isNotEmpty prepend='AND ' property='limitcspx'>
				<![CDATA[ cspx <= #limitcspx#]]>
		</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='tableparam'>
			$tableparam$
		</isNotEmpty>
		<isNotEmpty property='order'>
			$order$
		</isNotEmpty>
	</sql>

	<!-- ???? -->
	<insert id="insert_Xtcl" parameterClass="java.util.Map">
		insert into Xtcl(
		<isNotNull prepend='' property='xh'>xh</isNotNull>
		<isNotNull prepend=',' property='csdl'>csdl</isNotNull>
		<isNotNull prepend=',' property='cslm'>cslm</isNotNull>
		<isNotNull prepend=',' property='csdm'>csdm</isNotNull>
		<isNotNull prepend=',' property='csmc'>csmc</isNotNull>
		<isNotNull prepend=',' property='cspx'>cspx</isNotNull>
		<isNotNull prepend=',' property='cjry'>cjry</isNotNull>
		<isNotNull prepend=',' property='cjrq'>cjrq</isNotNull>
		<isNotNull prepend=',' property='xgry'>xgry</isNotNull>
		<isNotNull prepend=',' property='xgrq'>xgrq</isNotNull>
		<isNotNull prepend=',' property='bz'>bz</isNotNull>

		)values(
		<isNotNull prepend='' property='xh'>#xh#</isNotNull>
		<isNotNull prepend=',' property='csdl'>#csdl#</isNotNull>
		<isNotNull prepend=',' property='cslm'>#cslm#</isNotNull>
		<isNotNull prepend=',' property='csdm'>#csdm#</isNotNull>
		<isNotNull prepend=',' property='csmc'>#csmc#</isNotNull>
		<isNotNull prepend=',' property='cspx'>#cspx#</isNotNull>
		<isNotNull prepend=',' property='cjry'>#cjry#</isNotNull>
		<isNotNull prepend=',' property='cjrq'>#cjrq#</isNotNull>
		<isNotNull prepend=',' property='xgry'>#xgry#</isNotNull>
		<isNotNull prepend=',' property='xgrq'>#xgrq#</isNotNull>
		<isNotNull prepend=',' property='bz'>#bz#</isNotNull>

		)
	</insert>

	<!-- ??? -->
	<update id="update_Xtcl" parameterClass="java.util.Map">
		update Xtcl
		<dynamic prepend="set">  
			<isNotEmpty prepend=',' property='csdl'>csdl=#csdl#</isNotEmpty>
			<isNotEmpty prepend=',' property='cslm'>cslm=#cslm#</isNotEmpty>
			<isNotEmpty prepend=',' property='csdm'>csdm=#csdm#</isNotEmpty>
			<isNotEmpty prepend=',' property='csmc'>csmc=#csmc#</isNotEmpty>
			<isNotEmpty prepend=',' property='cspx'>cspx=#cspx#</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>
		</dynamic>  
		where 1=1
		<isNotEmpty prepend='AND ' property='xh'>
			xh= #xh#
		</isNotEmpty>

	</update>

	<!-- ??? -->
	<delete id="delete_Xtcl" parameterClass="java.util.Map">
		delete from Xtcl
		<include refid="condition_Xtcl" />
	</delete>

	<!-- ??????? -->
	<delete id="batch_delete_Xtcl" parameterClass="java.util.Map">
		delete from Xtcl
		where 1=1
		<isNotNull prepend='AND ' property='keyword'>
			key in (#keyword#)
		</isNotNull>
	</delete>

	<!-- ??? -->
	<select id="query_Xtcl" resultClass="java.util.HashMap"
		parameterClass="java.util.Map">
		select
		xh,csdl,cslm,csdm,csmc,cspx,cjry,cjrq,xgry,xgrq,bz
		from Xtcl
		<include refid="condition_Xtcl" />
	<!-- 	<isNotEmpty prepend=' ' property='start'>
			limit #start# ,#limit#
		</isNotEmpty>
		 -->
	</select>
	<select id="query_Xtcl_task" resultClass="java.util.HashMap" parameterClass="java.util.Map">
		select csdl,cslm,csdm,csmc
		from Xtcl
		where 1=1 
		<isNotEmpty prepend='AND ' property='csdl'>
			 csdl  in ($csdl$)
		</isNotEmpty>
		order by cspx asc
	</select>

	<select id="query_Xtcl_alarm" resultClass="java.util.HashMap" parameterClass="java.util.Map">
		select csdl,cslm,csdm,csmc
		from Xtcl  where csdl='ywAlarmSubType'
			<isNotEmpty prepend='AND ' property='startLIKEcsdm'>
				(csdm like '$startLIKEcsdm$%') and  length(csdm)=length (#startLIKEcsdm#)+2
			</isNotEmpty>
		order by cspx asc
	</select>


	<!-- ??????? -->
	<select id="count_Xtcl" resultClass="java.lang.Integer"
		parameterClass="java.util.Map">
		select count(*) from Xtcl
		<include refid="condition_Xtcl" />
	</select>

	<!-- ???????? -->
	<insert id="batch_insert_Xtcl" parameterClass="java.util.List">
	 	<![CDATA[
          INSERT ALL
      	]]>
		<iterate conjunction=" ">
			into Xtcl(
			 <![CDATA[ 
				xh,csdl,cslm,csdm,csmc,cspx,cjry,cjrq,xgry,xgrq,bz
			)values
			 ]]>  		 
			 <![CDATA[ 
				(
			#list[].xh#
				)
			]]>
		</iterate>
	</insert>


</sqlMap>











