839a4b84f8abd287175709773bc671cc4442eb87.svn-base 4.47 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.RegBusYydjDao">
    
	<sql id="regBusYydjColumns">
		a.id AS "id",
		a.ysdm AS "ysdm",
		a.bdcdyh AS "bdcdyh",
		a.ywh AS "ywh",
		a.yysx AS "yysx",
		a.bdcqzh AS "bdcqzh",
		a.qxdm AS "qxdm",
		a.djjg AS "djjg",
		a.dbr AS "dbr",
		a.djsj AS "djsj",
		a.zxyyywh AS "zxyyywh",
		a.zxyyyy AS "zxyyyy",
		a.zxyydbr AS "zxyydbr",
		a.zxyydjsj AS "zxyydjsj",
		a.fj AS "fj",
		a.qszt AS "qszt",
		a.bdcdjzmh AS "bdcdjzmh",
		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="regBusYydjJoins">
	</sql>
    
	<select id="get" resultType="RegBusYydj">
		SELECT 
			<include refid="regBusYydjColumns"/>
		FROM reg_bus_yydj a
		<include refid="regBusYydjJoins"/>
		WHERE a.id = #{id}
	</select>
	
	<select id="getByZxywh" resultType="RegBusYydj">
		SELECT 
			<include refid="regBusYydjColumns"/>
		FROM reg_bus_yydj a
		<include refid="regBusYydjJoins"/>
		WHERE a.zxyyywh = #{zxyyywh}
	</select>
	
	<select id="findList" resultType="RegBusYydj">
		SELECT 
			<include refid="regBusYydjColumns"/>
		FROM reg_bus_yydj a
		<include refid="regBusYydjJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
			<if test="bdcdyh != null and bdcdyh != ''">
				AND a.bdcdyh = #{bdcdyh}
			</if>
			<if test="ywh != null and ywh != ''">
				AND a.ywh = #{ywh}
			</if>
			<if test="bdcqzh != null and bdcqzh != ''">
				AND a.bdcqzh LIKE 
					<if test="dbName == 'oracle'">'%'||#{bdcqzh}||'%'</if>
					<if test="dbName == 'mssql'">'%'+#{bdcqzh}+'%'</if>
					<if test="dbName == 'mysql'">concat('%',#{bdcqzh},'%')</if>
			</if>
			<if test="zxyyywh != null and zxyyywh != ''">
			    <if test="zxyyywh == 'NOTNULL'">
			        AND a.zxyyywh is not null
			    </if>
			    <if test="zxyyywh != 'NOTNULL' and zxyyywh != 'ISNULL'">
			        AND a.zxyyywh = #{zxyyywh}
			    </if>
			    <if test="zxyyywh == 'ISNULL'">
			        AND a.zxyyywh is null
			        AND a.djsj is not null
			    </if>
			</if>
		</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>
	
	<select id="findAllList" resultType="RegBusYydj">
		SELECT 
			<include refid="regBusYydjColumns"/>
		FROM reg_bus_yydj a
		<include refid="regBusYydjJoins"/>
		<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_yydj(
			id,
			ysdm,
			bdcdyh,
			ywh,
			yysx,
			bdcqzh,
			qxdm,
			djjg,
			dbr,
			djsj,
			zxyyywh,
			zxyyyy,
			zxyydbr,
			zxyydjsj,
			fj,
			qszt,
			bdcdjzmh,
			create_by,
			create_date,
			update_by,
			update_date,
			del_flag
		) VALUES (
			#{id},
			#{ysdm},
			#{bdcdyh},
			#{ywh},
			#{yysx},
			#{bdcqzh},
			#{qxdm},
			#{djjg},
			#{dbr},
			#{djsj},
			#{zxyyywh},
			#{zxyyyy},
			#{zxyydbr},
			#{zxyydjsj},
			#{fj},
			#{qszt},
			#{bdcdjzmh},
			#{createBy.id},
			#{createDate},
			#{updateBy.id},
			#{updateDate},
			#{delFlag}
		)
	</insert>
	
	<update id="update">
		UPDATE reg_bus_yydj SET 	
			ysdm = #{ysdm},
			bdcdyh = #{bdcdyh},
			ywh = #{ywh},
			yysx = #{yysx},
			bdcqzh = #{bdcqzh},
			qxdm = #{qxdm},
			djjg = #{djjg},
			dbr = #{dbr},
			djsj = #{djsj},
			zxyyywh = #{zxyyywh},
			zxyyyy = #{zxyyyy},
			zxyydbr = #{zxyydbr},
			zxyydjsj = #{zxyydjsj},
			fj = #{fj},
			qszt = #{qszt},
			bdcdjzmh = #{bdcdjzmh},
			update_by = #{updateBy.id},
			update_date = #{updateDate}
		WHERE id = #{id}
	</update>
	
	<update id="delete">
		UPDATE reg_bus_yydj SET 
		del_flag = #{DEL_FLAG_DELETE}
		WHERE id = #{id}
	</update>
	
	<update id="deleteyyywh">
		DELETE FROM reg_bus_yydj 
		<where>
			<if test="ywh != null and ywh != ''">
				AND reg_bus_yydj.ywh = #{ywh}
			</if>
			<if test="zxyyywh != null and zxyyywh != ''">
				AND reg_bus_yydj.zxyyywh = #{zxyyywh}
			</if>
			<if test="id != null and id != ''">
				AND reg_bus_yydj.id = #{id}
			</if>
		</where>	
	</update>
	
	<update id="deleteywh">
		DELETE from reg_bus_yydj
		WHERE ywh = #{ywh}
	</update>
</mapper>