<?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="Ptcdjs">
	<!-- <typeAlias alias="Ptcdjsbean" type="com.vp.XXX.model.PtcdjsBean"/> -->

	<sql id="condition_Ptcdjs">
		where 1=1
		<isNotEmpty prepend='AND' property='LIKEjsbh'>
			(jsbh like
			concat('%',#LIKEjsbh# ,'%') )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='jsbh'>
			(jsbh = #jsbh# )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='LIKEjsmc'>
			(jsmc like
			concat('%',#LIKEjsmc# ,'%') )
		</isNotEmpty>
		<isNotEmpty prepend='AND' property='jsmc'>
			(jsmc = #jsmc# )
		</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>

	<insert id="insert_Ptcdjs" parameterClass="java.util.Map">
		insert into Ptcdjs(
		<isNotNull prepend='' property='jsbh'>jsbh</isNotNull>
		<isNotNull prepend=',' property='jsmc'>jsmc</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>
		)values(
		<isNotNull prepend='' property='jsbh'>#jsbh#</isNotNull>
		<isNotNull prepend=',' property='jsmc'>#jsmc#</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>
		)
	</insert>

	<update id="update_Ptcdjs" parameterClass="java.util.Map">
		update Ptcdjs set jsmc=#jsmc# where jsbh= #jsbh#
	</update>

	<delete id="delete_Ptcdjs" parameterClass="java.util.Map">
		delete from Ptcdjs where jsbh= #jsbh#
	</delete>

	<delete id="batch_delete_Ptcdjs" parameterClass="java.util.Map">
		delete from Ptcdjs
		where 1=1
		<isNotNull prepend='AND' property='keyword'>
			key in (#keyword#)
		</isNotNull>
	</delete>

	<select id="query_Ptcdjs" resultClass="java.util.HashMap"
		parameterClass="java.util.Map">
		select
		jsbh,jsmc,ssxm,cjry,cjrq,xgry,xgrq,bz,
		(select count(*) from  ptyhcdjs  v where v.jsbh = m.jsbh ) as jscount
		from Ptcdjs m
		<include refid="condition_Ptcdjs" />
	</select>

	<select id="count_Ptcdjs" resultClass="java.lang.Integer"
		parameterClass="java.util.Map">
		select count(*) from Ptcdjs
		<include refid="condition_Ptcdjs" />
	</select>
	 
</sqlMap>