2246b1d527c82160cc3067ed75c4d8724ef160d4.svn-base 2.44 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.RegBusSjmainDao">
    
	<sql id="regBusSjmainColumns">
		a.id AS "id",
		a.ywh AS "ywh",
		a.ysdm AS "ysdm",
		a.sjsj AS "sjsj",
		a.create_by AS "createBy.id",
		a.bz AS "bz",
		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="regBusSjmainJoins">
	</sql>
    
	<select id="get" resultType="RegBusSjmain">
		SELECT 
			<include refid="regBusSjmainColumns"/>
		FROM reg_bus_sjmain a
		<include refid="regBusSjmainJoins"/>
		WHERE a.id = #{id}
	</select>
	
	<select id="findList" resultType="RegBusSjmain">
		SELECT 
			<include refid="regBusSjmainColumns"/>
		FROM reg_bus_sjmain a
		<include refid="regBusSjmainJoins"/>
		<where>
			a.del_flag = #{DEL_FLAG_NORMAL}
			<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.update_date DESC
			</otherwise>
		</choose>
	</select>
	
	<select id="findAllList" resultType="RegBusSjmain">
		SELECT 
			<include refid="regBusSjmainColumns"/>
		FROM reg_bus_sjmain a
		<include refid="regBusSjmainJoins"/>
		<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_sjmain(
			id,
			ywh,
			ysdm,
			sjsj,
			create_by,
			bz,
			create_date,
			update_by,
			update_date,
			del_flag
		) VALUES (
			#{id},
			#{ywh},
			#{ysdm},
			#{sjsj},
			#{createBy.id},
			#{bz},
			#{createDate},
			#{updateBy.id},
			#{updateDate},
			#{delFlag}
		)
	</insert>
	
	<update id="update">
		UPDATE reg_bus_sjmain SET 	
			ywh = #{ywh},
			ysdm = #{ysdm},
			sjsj = #{sjsj},
			bz = #{bz},
			update_by = #{updateBy.id},
			update_date = #{updateDate}
		WHERE id = #{id}
	</update>
	
	<update id="delete">
		UPDATE reg_bus_sjmain SET 
			del_flag = #{DEL_FLAG_DELETE}
		WHERE id = #{id}
	</update>
	
	<update id="deleteywh">
		DELETE from reg_bus_sjmain
		WHERE ywh = #{ywh}
	</update>
</mapper>