7f684f26db2731c26b83d3afaa5ad3b10531e29e.svn-base 4.99 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.RegBusJsydsyqDao">
    
	<sql id="regBusJsydsyqColumns">
		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.syqmj AS "syqmj",
		a.syqqssj AS "syqqssj",
		a.syqjssj AS "syqjssj",
		a.qdjg AS "qdjg",
		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="regBusJsydsyqJoins">
	</sql>
    
	<select id="get" resultType="RegBusJsydsyq">
		SELECT 
			<include refid="regBusJsydsyqColumns"/>
		FROM reg_bus_jsydsyq a
		<include refid="regBusJsydsyqJoins"/>
		WHERE a.id = #{id}
	</select>
	
	<select id="getOneWithYwh" resultType="RegBusJsydsyq">
		SELECT 
			<include refid="regBusJsydsyqColumns"/>
		FROM reg_bus_jsydsyq a
		<include refid="regBusJsydsyqJoins"/>
		WHERE a.ywh = #{ywh}
	</select>
	
	<select id="findList" resultType="RegBusJsydsyq">
		SELECT 
			<include refid="regBusJsydsyqColumns"/>
		FROM reg_bus_jsydsyq a
		<include refid="regBusJsydsyqJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
			<if test="ywh != null and ywh != ''">
				AND a.ywh = #{ywh}
			</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="zddm != null and zddm != ''">
				AND a.zddm = #{zddm}
			</if>
			<if test="qszt != null and qszt != ''">
				AND a.qszt = #{qszt}
			</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="RegBusJsydsyq">
		SELECT 
			<include refid="regBusJsydsyqColumns"/>
		FROM reg_bus_jsydsyq a
		<include refid="regBusJsydsyqJoins"/>
		<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_jsydsyq(
			id,
			ysdm,
			zddm,
			bdcdyh,
			ywh,
			qllx,
			djlx,
			djyy,
			syqmj,
			syqqssj,
			syqjssj,
			qdjg,
			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},
			#{syqmj},
			#{syqqssj},
			#{syqjssj},
			#{qdjg},
			#{bdcqzh},
			#{qxdm},
			#{djjg},
			#{dbr},
			#{djsj},
			#{fj},
			#{qszt},
			#{createBy.id},
			#{createDate},
			#{updateBy.id},
			#{updateDate},
			#{remarks},
			#{delFlag}
		)
	</insert>
	
	<update id="update">
		UPDATE reg_bus_jsydsyq SET 	
			ysdm = #{ysdm},
			zddm = #{zddm},
			bdcdyh = #{bdcdyh},
			ywh = #{ywh},
			qllx = #{qllx},
			djlx = #{djlx},
			djyy = #{djyy},
			syqmj = #{syqmj},
			syqqssj = #{syqqssj},
			syqjssj = #{syqjssj},
			qdjg = #{qdjg},
			bdcqzh = #{bdcqzh},
			qxdm = #{qxdm},
			djjg = #{djjg},
			dbr = #{dbr},
			djsj = #{djsj},
			fj = #{fj},
			qszt = #{qszt},
			update_by = #{updateBy.id},
			update_date = #{updateDate},
			remarks = #{remarks},
			del_flag = #{delFlag}
		WHERE id = #{id}
	</update>
	
	<update id="updateJsydsyq">
		UPDATE reg_bus_jsydsyq SET 	
			ysdm = #{ysdm},
			zddm = #{zddm},
			bdcdyh = #{bdcdyh},
			ywh = #{ywh},
			qllx = #{qllx},
			djlx = #{djlx},
			djyy = #{djyy},
			syqmj = #{syqmj},
			syqqssj = #{syqqssj},
			syqjssj = #{syqjssj},
			qdjg = #{qdjg},
			bdcqzh = #{bdcqzh},
			qxdm = #{qxdm},
			djjg = #{djjg},
			dbr = #{dbr},
			djsj = #{djsj},
			fj = #{fj},
			qszt = #{qszt},
			update_by = #{updateBy.id},
			update_date = #{updateDate},
			remarks = #{remarks}
		WHERE ywh = #{ywh}
	</update>
	
	<update id="delete">
		UPDATE reg_bus_jsydsyq SET 
			del_flag = #{DEL_FLAG_DELETE}
		WHERE id = #{id}
	</update>
	
	<update id="deleteRegBusJsydsyq">
		DELETE FROM reg_bus_jsydsyq WHERE ywh = #{ywh} 
	</update>
	<update id="deleteRegBusJsydsyqInfo">
		DELETE FROM reg_bus_jsydsyq WHERE 
		ywh = #{ywh} AND bdcdyh = #{bdcdyh}
	</update>
	
	<select id="findByYwh" resultType="RegBusJsydsyq">
		SELECT
		<include refid="regBusJsydsyqColumns" />
		FROM reg_bus_jsydsyq a
		<include refid="regBusJsydsyqJoins" />
		WHERE a.ywh = #{0}
		and a.del_flag='0'
	</select>
	
	<update id="deleteywh">
		DELETE from reg_bus_jsydsyq
		WHERE ywh = #{ywh}
	</update>
</mapper>