<?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="Ptcdjsqx">

	<sql id="condition_Ptcdjsqx">
		where 1=1
		<isNotEmpty prepend='AND' property='LIKExh'>
			(xh like
			concat('%',#LIKExh# ,'%') )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='xh'>
			(xh = #xh# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEjsbh'>
			(jsbh like
			concat('%',#LIKEjsbh# ,'%') )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='jsbh'>
			(jsbh = #jsbh# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEcdbh'>
			(cdbh like
			concat('%',#LIKEcdbh# ,'%') )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='cdbh'>
			(cdbh = #cdbh# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEssxm'>
			(ssxm like
			concat('%',#LIKEssxm# ,'%') )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='ssxm'>
			(ssxm = #ssxm# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEcjry'>
			(cjry like
			concat('%',#LIKEcjry# ,'%') )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='cjry'>
			(cjry = #cjry# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEcjrq'>
			(cjrq like
			concat('%',#LIKEcjrq# ,'%') )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='cjrq'>
			(cjrq = #cjrq# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKExgry'>
			(xgry like
			concat('%',#LIKExgry# ,'%') )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='xgry'>
			(xgry = #xgry# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKExgrq'>
			(xgrq like
			concat('%',#LIKExgrq# ,'%') )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='xgrq'>
			(xgrq = #xgrq# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEbz'>
			(bz like
			concat('%',#LIKEbz# ,'%') )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='bz'>
			(bz = #bz# )
		</isNotEmpty>
		<isNotEmpty property='tableparam'>
			$tableparam$
		</isNotEmpty>
		<isNotEmpty property='order'>
			$order$
		</isNotEmpty>
	</sql>

	<select id="query_Ptcdjsqx" resultClass="java.util.HashMap"
		parameterClass="java.util.Map">
		select
		xh,jsbh,cdbh,ssxm,cjry,cjrq,xgry,xgrq,bz
		from Ptcdjsqx
		<include refid="condition_Ptcdjsqx" />
	</select>

	<select id="count_Ptcdjsqx" resultClass="java.lang.Integer"
		parameterClass="java.util.Map">
		select count(*) from Ptcdjsqx
		<include refid="condition_Ptcdjsqx" />
	</select>
	
	 <select id="query_getPtcdjsMemuListByJSBH" resultClass="java.util.HashMap"
		parameterClass="java.util.Map">
			select xh,jsbh,cdbh,ssxm from ptcdjsqx m  where jsbh = #jsbh#
	</select>
	
	<delete id="delete_ptcdjsMenuIdByJSBH" parameterClass="java.util.Map">
		delete from ptcdjsqx where jsbh = #jsbh# 
	</delete>
	
	<insert id="insert_ptcdjsMenuIdByJSBH" parameterClass="java.util.Map">
		insert into Ptcdjsqx(
		<isNotNull prepend='' property='xh'>xh</isNotNull>
		<isNotNull prepend=',' property='jsbh'>jsbh</isNotNull>
		<isNotNull prepend=',' property='cdbh'>cdbh</isNotNull>
		<isNotNull prepend=',' property='ssxm'>ssxm</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='jsbh'>#jsbh#</isNotNull>
		<isNotNull prepend=',' property='cdbh'>#cdbh#</isNotNull>
		<isNotNull prepend=',' property='ssxm'>#ssxm#</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>
	<select id="query_Ptcdjsqx_byYhbh" resultClass="java.util.HashMap"
		parameterClass="java.util.Map">
		select
		 distinct a.cdbh,a.ssxm,b.yhbh
		from ptcdjsqx a left join ptyhcdjs b on a.jsbh = b.jsbh
		where 1=1 and yhbh = #yhbh# and a.ssxm = upper(#projName#) 
		order by cdbh asc 
		<!-- 
		 select  qx.cdbh , qx.xh,jsbh,cdbh,ssxm  
			FROM ptcdjsqx qx
			WHERE 1=1 and qx.jsbh IN (
					SELECT jsbh FROM ptyhcdjs WHERE yhbh = #yhbh#    and ssxm = upper(#projName#)
				)
			group by qx.cdbh order by cdbh  asc 
		 -->
	</select>	
</sqlMap>
