<?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.yutou.nas.mybatis.dao.VideoDataDao">
  <resultMap id="BaseResultMap" type="com.yutou.nas.mybatis.model.VideoData">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="vid" jdbcType="INTEGER" property="vid" />
    <result column="fileTitle" jdbcType="VARCHAR" property="filetitle" />
    <result column="path" jdbcType="VARCHAR" property="path" />
    <result column="videoTimer" jdbcType="VARCHAR" property="videotimer" />
    <result column="videoData" jdbcType="VARCHAR" property="videodata" />
    <result column="soundData" jdbcType="VARCHAR" property="sounddata" />
    <result column="isPlay" jdbcType="INTEGER" property="isplay" />
    <result column="lastPlayTime" jdbcType="VARCHAR" property="lastplaytime" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, vid, fileTitle, `path`, videoTimer, videoData, soundData, isPlay, lastPlayTime
  </sql>
  <select id="selectByExample" parameterType="com.yutou.nas.mybatis.model.VideoDataExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from video_data
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from video_data
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from video_data
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.yutou.nas.mybatis.model.VideoDataExample">
    delete from video_data
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yutou.nas.mybatis.model.VideoData" useGeneratedKeys="true">

    insert into video_data (vid, fileTitle, `path`, 
      videoTimer, videoData, soundData, 
      isPlay, lastPlayTime)
    values (#{vid,jdbcType=INTEGER}, #{filetitle,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR}, 
      #{videotimer,jdbcType=VARCHAR}, #{videodata,jdbcType=VARCHAR}, #{sounddata,jdbcType=VARCHAR}, 
      #{isplay,jdbcType=INTEGER}, #{lastplaytime,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yutou.nas.mybatis.model.VideoData" useGeneratedKeys="true">
    insert into video_data
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="vid != null">
        vid,
      </if>
      <if test="filetitle != null">
        fileTitle,
      </if>
      <if test="path != null">
        `path`,
      </if>
      <if test="videotimer != null">
        videoTimer,
      </if>
      <if test="videodata != null">
        videoData,
      </if>
      <if test="sounddata != null">
        soundData,
      </if>
      <if test="isplay != null">
        isPlay,
      </if>
      <if test="lastplaytime != null">
        lastPlayTime,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="vid != null">
        #{vid,jdbcType=INTEGER},
      </if>
      <if test="filetitle != null">
        #{filetitle,jdbcType=VARCHAR},
      </if>
      <if test="path != null">
        #{path,jdbcType=VARCHAR},
      </if>
      <if test="videotimer != null">
        #{videotimer,jdbcType=VARCHAR},
      </if>
      <if test="videodata != null">
        #{videodata,jdbcType=VARCHAR},
      </if>
      <if test="sounddata != null">
        #{sounddata,jdbcType=VARCHAR},
      </if>
      <if test="isplay != null">
        #{isplay,jdbcType=INTEGER},
      </if>
      <if test="lastplaytime != null">
        #{lastplaytime,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.yutou.nas.mybatis.model.VideoDataExample" resultType="java.lang.Long">
    select count(*) from video_data
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update video_data
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.vid != null">
        vid = #{record.vid,jdbcType=INTEGER},
      </if>
      <if test="record.filetitle != null">
        fileTitle = #{record.filetitle,jdbcType=VARCHAR},
      </if>
      <if test="record.path != null">
        `path` = #{record.path,jdbcType=VARCHAR},
      </if>
      <if test="record.videotimer != null">
        videoTimer = #{record.videotimer,jdbcType=VARCHAR},
      </if>
      <if test="record.videodata != null">
        videoData = #{record.videodata,jdbcType=VARCHAR},
      </if>
      <if test="record.sounddata != null">
        soundData = #{record.sounddata,jdbcType=VARCHAR},
      </if>
      <if test="record.isplay != null">
        isPlay = #{record.isplay,jdbcType=INTEGER},
      </if>
      <if test="record.lastplaytime != null">
        lastPlayTime = #{record.lastplaytime,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update video_data
    set id = #{record.id,jdbcType=INTEGER},
      vid = #{record.vid,jdbcType=INTEGER},
      fileTitle = #{record.filetitle,jdbcType=VARCHAR},
      `path` = #{record.path,jdbcType=VARCHAR},
      videoTimer = #{record.videotimer,jdbcType=VARCHAR},
      videoData = #{record.videodata,jdbcType=VARCHAR},
      soundData = #{record.sounddata,jdbcType=VARCHAR},
      isPlay = #{record.isplay,jdbcType=INTEGER},
      lastPlayTime = #{record.lastplaytime,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yutou.nas.mybatis.model.VideoData">
    update video_data
    <set>
      <if test="vid != null">
        vid = #{vid,jdbcType=INTEGER},
      </if>
      <if test="filetitle != null">
        fileTitle = #{filetitle,jdbcType=VARCHAR},
      </if>
      <if test="path != null">
        `path` = #{path,jdbcType=VARCHAR},
      </if>
      <if test="videotimer != null">
        videoTimer = #{videotimer,jdbcType=VARCHAR},
      </if>
      <if test="videodata != null">
        videoData = #{videodata,jdbcType=VARCHAR},
      </if>
      <if test="sounddata != null">
        soundData = #{sounddata,jdbcType=VARCHAR},
      </if>
      <if test="isplay != null">
        isPlay = #{isplay,jdbcType=INTEGER},
      </if>
      <if test="lastplaytime != null">
        lastPlayTime = #{lastplaytime,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yutou.nas.mybatis.model.VideoData">
    update video_data
    set vid = #{vid,jdbcType=INTEGER},
      fileTitle = #{filetitle,jdbcType=VARCHAR},
      `path` = #{path,jdbcType=VARCHAR},
      videoTimer = #{videotimer,jdbcType=VARCHAR},
      videoData = #{videodata,jdbcType=VARCHAR},
      soundData = #{sounddata,jdbcType=VARCHAR},
      isPlay = #{isplay,jdbcType=INTEGER},
      lastPlayTime = #{lastplaytime,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>