<?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.ejweb.modules.report.dao.CtBbtcBusTypeDao">
    
	<sql id="ctBbtcBusTypeColumns">
		id AS "id",
		fnumber AS "number",
		name AS "name"
	</sql>
	
	<!--<sql id="ctBbtcBusTypeJoins">
		LEFT JOIN ct_bbtc_sys_dict b on b.id = a.supplement_group
	</sql>-->
    
	<select id="get" resultType="CtBbtcBusType">
		SELECT 
			<include refid="ctBbtcBusTypeColumns"/>
		FROM ct_bbtc_bus_type
		WHERE id = #{id}
	</select>
	
	<select id="findList" resultType="CtBbtcBusType">
		SELECT 
			<include refid="ctBbtcBusTypeColumns"/>
		FROM ct_bbtc_bus_type
		<where>

			<if test="name != null and name != ''">
				AND name LIKE
					<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
					<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
					<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
			</if>
		</where>
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
			</otherwise>
		</choose>
	</select>

	<select id="findAllList" resultType="CtBbtcBusType">
		SELECT 
			<include refid="ctBbtcBusTypeColumns"/>
		FROM ct_bbtc_bus_type
		<where>

		</where>
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
			</otherwise>
		</choose>
	</select>
	
	<insert id="insert">
		INSERT INTO ct_bbtc_bus_type(
			id,
			fnumber,
		     name
		) VALUES (
			#{id},
			#{number},
			#{name}
		)
	</insert>
	
	<update id="update">
		UPDATE ct_bbtc_bus_type SET 	
			fnumber = #{number},
			name = #{name}
		WHERE id = #{id}
	</update>
	
	<update id="delete">
		DELETE FROM ct_bbtc_bus_type
		WHERE id = #{id}
	</update>
	
</mapper>