982e18be0868164a2814098c2821e6bace0ccc15.svn-base 4.21 KB
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.thinkgem.jeesite.modules.reg.dao.bus.RegBusTdsyqDao">
    
	<sql id="regBusTdsyqColumns">
		a.id AS "id",
		a.ysdm AS "ysdm",
		a.zddm AS "zddm",
		a.bdcdyh AS "bdcdyh",
		a.ywh AS "ywh",
		a.qllx AS "qllx",
		a.djlx AS "djlx",
		a.djyy AS "djyy",
		a.mjdw AS "mjdw",
		a.nydmj AS "nydmj",
		a.gdmj AS "gdmj",
		a.ldmj AS "ldmj",
		a.cdmj AS "cdmj",
		a.qtnydmj AS "qtnydmj",
		a.jsydmj AS "jsydmj",
		a.wlydmj AS "wlydmj",
		a.bdcqzh AS "bdcqzh",
		a.qxdm AS "qxdm",
		a.djjg AS "djjg",
		a.dbr AS "dbr",
		a.djsj AS "djsj",
		a.fj AS "fj",
		a.qszt AS "qszt",
		a.create_by AS "createBy.id",
		a.create_date AS "createDate",
		a.update_by AS "updateBy.id",
		a.update_date AS "updateDate",
		a.remarks AS "remarks",
		a.del_flag AS "delFlag"
	</sql>
	
	<sql id="regBusTdsyqJoins">
	</sql>
    
	<select id="get" resultType="RegBusTdsyq">
		SELECT 
			<include refid="regBusTdsyqColumns"/>
		FROM reg_bus_tdsyq a
		<include refid="regBusTdsyqJoins"/>
		WHERE a.id = #{id}
	</select>
	
	<select id="findList" resultType="RegBusTdsyq">
		SELECT 
			<include refid="regBusTdsyqColumns"/>
		FROM reg_bus_tdsyq a
		<include refid="regBusTdsyqJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
			<if test="zddm != null and zddm != ''">
				AND a.zddm = #{zddm}
			</if>
			<if test="bdcdyh != null and bdcdyh != ''">
				AND a.bdcdyh LIKE 
					<if test="dbName == 'oracle'">'%'||#{bdcdyh}||'%'</if>
					<if test="dbName == 'mssql'">'%'+#{bdcdyh}+'%'</if>
					<if test="dbName == 'mysql'">concat('%',#{bdcdyh},'%')</if>
			</if>
			<if test="ywh != null and ywh != ''">
				AND a.ywh = #{ywh}
			</if>
		</where>
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
				ORDER BY a.create_date DESC
			</otherwise>
		</choose>
	</select>
	
	<select id="findAllList" resultType="RegBusTdsyq">
		SELECT 
			<include refid="regBusTdsyqColumns"/>
		FROM reg_bus_tdsyq a
		<include refid="regBusTdsyqJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
		</where>		
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
				ORDER BY a.update_date DESC
			</otherwise>
		</choose>
	</select>
	
	<insert id="insert">
		INSERT INTO reg_bus_tdsyq(
			id,
			ysdm,
			zddm,
			bdcdyh,
			ywh,
			qllx,
			djlx,
			djyy,
			mjdw,
			nydmj,
			gdmj,
			ldmj,
			cdmj,
			qtnydmj,
			jsydmj,
			wlydmj,
			bdcqzh,
			qxdm,
			djjg,
			dbr,
			djsj,
			fj,
			qszt,
			create_by,
			create_date,
			update_by,
			update_date,
			remarks,
			del_flag
		) VALUES (
			#{id},
			#{ysdm},
			#{zddm},
			#{bdcdyh},
			#{ywh},
			#{qllx},
			#{djlx},
			#{djyy},
			#{mjdw},
			#{nydmj},
			#{gdmj},
			#{ldmj},
			#{cdmj},
			#{qtnydmj},
			#{jsydmj},
			#{wlydmj},
			#{bdcqzh},
			#{qxdm},
			#{djjg},
			#{dbr},
			#{djsj},
			#{fj},
			#{qszt},
			#{createBy.id},
			#{createDate},
			#{updateBy.id},
			#{updateDate},
			#{remarks},
			#{delFlag}
		)
	</insert>
	
	<update id="update">
		UPDATE reg_bus_tdsyq SET 	
			ysdm = #{ysdm},
			zddm = #{zddm},
			bdcdyh = #{bdcdyh},
			ywh = #{ywh},
			qllx = #{qllx},
			djlx = #{djlx},
			djyy = #{djyy},
			mjdw = #{mjdw},
			nydmj = #{nydmj},
			gdmj = #{gdmj},
			ldmj = #{ldmj},
			cdmj = #{cdmj},
			qtnydmj = #{qtnydmj},
			jsydmj = #{jsydmj},
			wlydmj = #{wlydmj},
			bdcqzh = #{bdcqzh},
			qxdm = #{qxdm},
			djjg = #{djjg},
			dbr = #{dbr},
			djsj = #{djsj},
			fj = #{fj},
			qszt = #{qszt},
			update_by = #{updateBy.id}
		WHERE id = #{id}
	</update>
	
	<update id="delete">
		UPDATE reg_bus_tdsyq SET 
			del_flag = #{DEL_FLAG_DELETE}
		WHERE id = #{id}
	</update>
	
	<update id="deleteRegBusTdsyq">
		DELETE FROM reg_bus_tdsyq 
		<where>
			<if test= "ywh != null and ywh != ''">
				AND  ywh = #{ywh}
			</if >
			<if test= "bdcdyh != null and bdcdyh != ''">
				AND  bdcdyh = #{bdcdyh}
			</if >
		</where>
	</update>
	
	<update id="deleteRegTdsyq">
		DELETE FROM reg_bus_tdsyq WHERE ywh = #{ywh} 
	</update>
	
	<update id="deleteywh">
		DELETE FROM reg_bus_tdsyq WHERE ywh = #{ywh} 
	</update>
	
</mapper>