<?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.cab.dao.CabBannerMapper" >
  <resultMap id="BaseResultMap" type="com.cab.model.CabBanner" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="image_url" property="imageUrl" jdbcType="VARCHAR" />
    <result column="banner_name" property="bannerName" jdbcType="VARCHAR" />
    <result column="type" property="type" jdbcType="INTEGER" />
    <result column="detail_url" property="detailUrl" jdbcType="VARCHAR" />
    <result column="is_show" property="isShow" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, image_url, banner_name, type, detail_url, is_show
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from cab_banner
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from cab_banner
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.cab.model.CabBanner" >
    insert into cab_banner (id, image_url, banner_name, 
      type, detail_url, is_show
      )
    values (#{id,jdbcType=INTEGER}, #{imageUrl,jdbcType=VARCHAR}, #{bannerName,jdbcType=VARCHAR}, 
      #{type,jdbcType=INTEGER}, #{detailUrl,jdbcType=VARCHAR}, #{isShow,jdbcType=INTEGER}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.cab.model.CabBanner" >
    insert into cab_banner
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="imageUrl != null" >
        image_url,
      </if>
      <if test="bannerName != null" >
        banner_name,
      </if>
      <if test="type != null" >
        type,
      </if>
      <if test="detailUrl != null" >
        detail_url,
      </if>
      <if test="isShow != null" >
        is_show,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="imageUrl != null" >
        #{imageUrl,jdbcType=VARCHAR},
      </if>
      <if test="bannerName != null" >
        #{bannerName,jdbcType=VARCHAR},
      </if>
      <if test="type != null" >
        #{type,jdbcType=INTEGER},
      </if>
      <if test="detailUrl != null" >
        #{detailUrl,jdbcType=VARCHAR},
      </if>
      <if test="isShow != null" >
        #{isShow,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.cab.model.CabBanner" >
    update cab_banner
    <set >
      <if test="imageUrl != null" >
        image_url = #{imageUrl,jdbcType=VARCHAR},
      </if>
      <if test="bannerName != null" >
        banner_name = #{bannerName,jdbcType=VARCHAR},
      </if>
      <if test="type != null" >
        type = #{type,jdbcType=INTEGER},
      </if>
      <if test="detailUrl != null" >
        detail_url = #{detailUrl,jdbcType=VARCHAR},
      </if>
      <if test="isShow != null" >
        is_show = #{isShow,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.cab.model.CabBanner" >
    update cab_banner
    set image_url = #{imageUrl,jdbcType=VARCHAR},
      banner_name = #{bannerName,jdbcType=VARCHAR},
      type = #{type,jdbcType=INTEGER},
      detail_url = #{detailUrl,jdbcType=VARCHAR},
      is_show = #{isShow,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <!--********************************************************* 自定义********************************************* -->
  <select id="getAll" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from cab_banner where is_show=0
  </select>
</mapper>