<?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="Ywvideosyncaccountbean" type="cn.vp.XXX.model.YwvideosyncaccountBean"/> -->	<typeAlias alias="Ywvideosyncaccount" type="cn.im.videosync.YwvideosyncaccountBean"/>
	
	<sql id="condition_Ywvideosyncaccount">
		where 1=1
		<isNotEmpty prepend='AND' property='LIKEsyncid'>
			(syncid like '%$LIKEsyncid$%'   )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='syncid'>
			(syncid = #syncid#  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEsyncaccount'>
			(syncaccount like '%$LIKEsyncaccount$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='syncaccount'>
			(syncaccount = #syncaccount# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEsyncmodel'>
			(syncmodel like '%$LIKEsyncmodel$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='syncmodel'>
			(syncmodel = #syncmodel# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEsyncstarttime'>
			(syncstarttime like '%$LIKEsyncstarttime$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='syncstarttime'>
			(syncstarttime = #syncstarttime# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEsyncintervaltime'>
			(syncintervaltime like '%$LIKEsyncintervaltime$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='syncintervaltime'>
			(syncintervaltime = #syncintervaltime# )
		</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_Ywvideosyncaccount" parameterClass="java.util.Map">
		insert into 
		ywvideosyncaccount(
		<dynamic prepend=" ">  
			<isNotEmpty prepend=',' property='syncid'>syncid</isNotEmpty>
			<isNotEmpty prepend=',' property='syncaccount'>syncaccount</isNotEmpty>
			<isNotEmpty prepend=',' property='syncmodel'>syncmodel</isNotEmpty>
			<isNotEmpty prepend=',' property='syncstarttime'>syncstarttime</isNotEmpty>
			<isNotEmpty prepend=',' property='syncintervaltime'>syncintervaltime</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='syncid'>#syncid#</isNotEmpty>
			<isNotEmpty prepend=',' property='syncaccount'>#syncaccount#</isNotEmpty>
			<isNotEmpty prepend=',' property='syncmodel'>#syncmodel#</isNotEmpty>
			<isNotEmpty prepend=',' property='syncstarttime'>#syncstarttime#</isNotEmpty>
			<isNotEmpty prepend=',' property='syncintervaltime'>#syncintervaltime#</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_Ywvideosyncaccount" parameterClass="java.util.Map">
		update ywvideosyncaccount 
		<dynamic prepend="set ">   
			
			<isNotEmpty prepend=',' property='syncaccount'>syncaccount=#syncaccount#</isNotEmpty>
			<isNotEmpty prepend=',' property='syncmodel'>syncmodel=#syncmodel#</isNotEmpty>
			<isNotEmpty prepend=',' property='syncstarttime'>syncstarttime=#syncstarttime#</isNotEmpty>
			<isNotEmpty prepend=',' property='syncintervaltime'>syncintervaltime=#syncintervaltime#</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 1=1 
			<isNotEmpty prepend='AND' property='XGTJsyncid'> syncid = #XGTJsyncid#</isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJsyncaccount'> syncaccount = #XGTJsyncaccount# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJsyncmodel'> syncmodel = #XGTJsyncmodel# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJsyncstarttime'> syncstarttime = #XGTJsyncstarttime# </isNotEmpty>
			<isNotEmpty prepend='AND' property='XGTJsyncintervaltime'> syncintervaltime = #XGTJsyncintervaltime# </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_Ywvideosyncaccount" parameterClass="java.util.Map">
		delete from ywvideosyncaccount 
		<include refid="condition_Ywvideosyncaccount"/>
	</delete>
	
	<!-- batch delete object -->
	<delete id="batch_delete_Ywvideosyncaccount" parameterClass="java.util.Map">
		delete from ywvideosyncaccount 
		where 1=1
			<isNotEmpty prepend='AND' property='keyword'>
			key  in (#keyword#)
			</isNotEmpty>
	</delete>
	
	<!-- query objects by page-->
	<select id="query_Ywvideosyncaccount" resultClass="java.util.HashMap" parameterClass="java.util.Map">
		select 
			syncid,syncaccount,syncmodel,syncstarttime,syncintervaltime,createaccount,createtime,modifyaccount,modifytime,remarks,extend1,extend2,extend3,extend4
		from ywvideosyncaccount 
		<include refid="condition_Ywvideosyncaccount"/>		
	</select>
	
	<!-- query objects totalcount -->
	<select id="count_Ywvideosyncaccount" resultClass="java.lang.Integer" parameterClass="java.util.Map">
		select count(*) from ywvideosyncaccount 
		<include refid="condition_Ywvideosyncaccount"/>			
	</select>

	<select id="get_ptxzs" resultClass="java.util.HashMap" parameterClass="java.util.Map">
		select * from PTXZS where xzbh in (select admincatalogue from ywvideosyncchannel group by admincatalogue)
	</select>
	
	<select id="listVideosyncchannelToChannelSet" resultClass="java.util.HashMap" parameterClass="java.util.Map">
		select 
			(select xzmc from ptxzs b where b.xzbh=a.admincatalogue) as xzmc,
			videonum as sbbh,channelnum as tdbh,channelname as tdmc
		from ywvideosyncchannel a
		where 1=1
		<isNotEmpty prepend='AND' property='xzbh'>
			(admincatalogue = #xzbh#  or (admincatalogue in (select xzbh from ptxzs where sjxzbh = #xzbh#)) )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEtdmc'>
			(channelname like '%$LIKEtdmc$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEsbbh'>
			(videonum like '%$LIKEsbbh$%'  )
		</isNotEmpty>
		and (a.videonum,a.channelnum) 
			not in (select videonum,channelnum from ywvideochannelsetlist 
						where 1=1
						<isNotEmpty prepend='AND' property='channelsetid'>
							channelsetid = #channelsetid#
						</isNotEmpty>
					)
		<isNotEmpty property='order'>
			$order$
		</isNotEmpty>
	</select>
	
	<select id="count_listVideosyncchannelToChannelSet" resultClass="java.lang.Integer" parameterClass="java.util.Map">
		select count(*) from ywvideosyncchannel a
		where 1=1
		<isNotEmpty prepend='AND' property='xzbh'>
			(admincatalogue = #xzbh#  or (admincatalogue in (select xzbh from ptxzs where sjxzbh = #xzbh#)) )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEtdmc'>
			(channelname like '%$LIKEtdmc$%'  )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEsbbh'>
			(videonum like '%$LIKEsbbh$%'  )
		</isNotEmpty>
		and (a.videonum,a.channelnum) 
			not in (select videonum,channelnum from ywvideochannelsetlist 
						where 1=1
						<isNotEmpty prepend='AND' property='channelsetid'>
							channelsetid = #channelsetid#
						</isNotEmpty>
					)
	</select>

	<!-- batch add objects -->
	<insert id="batch_insert_Ywvideosyncaccount" parameterClass="java.util.List">
	 	<![CDATA[
          INSERT
      	]]>
      	<iterate conjunction=" " > 
			into ywvideosyncaccount(
			 <![CDATA[ 
				syncid,syncaccount,syncmodel,syncstarttime,syncintervaltime,createaccount,createtime,modifyaccount,modifytime,remarks,extend1,extend2,extend3,extend4
			)values
			 ]]>  		 
			 <![CDATA[ 
				(
				#list[].syncid#,#list[].syncaccount#,#list[].syncmodel#,#list[].syncstarttime#,#list[].syncintervaltime#,#list[].createaccount#,#list[].createtime#,#list[].modifyaccount#,#list[].modifytime#,#list[].remarks#,#list[].extend1#,#list[].extend2#,#list[].extend3#,#list[].extend4#
				)
			]]>    
    	</iterate> 
	</insert>
</sqlMap>











