<?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.TestInterfaceMapper" >
  <resultMap id="BaseResultMap" type="com.cab.model.TestInterface" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="inter_name" property="interName" jdbcType="VARCHAR" />
    <result column="inter_url" property="interUrl" jdbcType="VARCHAR" />
    <result column="inter_own" property="interOwn" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, inter_name, inter_url, inter_own, create_time
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from test_interface
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from test_interface
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.cab.model.TestInterface" >
    insert into test_interface (id, inter_name, inter_url, 
      inter_own, create_time)
    values (#{id,jdbcType=INTEGER}, #{interName,jdbcType=VARCHAR}, #{interUrl,jdbcType=VARCHAR}, 
      #{interOwn,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.cab.model.TestInterface" >
    insert into test_interface
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="interName != null" >
        inter_name,
      </if>
      <if test="interUrl != null" >
        inter_url,
      </if>
      <if test="interOwn != null" >
        inter_own,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="interName != null" >
        #{interName,jdbcType=VARCHAR},
      </if>
      <if test="interUrl != null" >
        #{interUrl,jdbcType=VARCHAR},
      </if>
      <if test="interOwn != null" >
        #{interOwn,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
    <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
		SELECT LAST_INSERT_ID() AS id
	</selectKey>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.cab.model.TestInterface" >
    update test_interface
    <set >
      <if test="interName != null" >
        inter_name = #{interName,jdbcType=VARCHAR},
      </if>
      <if test="interUrl != null" >
        inter_url = #{interUrl,jdbcType=VARCHAR},
      </if>
      <if test="interOwn != null" >
        inter_own = #{interOwn,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.cab.model.TestInterface" >
    update test_interface
    set inter_name = #{interName,jdbcType=VARCHAR},
      inter_url = #{interUrl,jdbcType=VARCHAR},
      inter_own = #{interOwn,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
    <!--********************************************************* 自定义********************************************* -->
    <select id="getAll" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from test_interface order by inter_name desc
  </select>
</mapper>