<?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.VideoInfoDao">
  <resultMap id="BaseResultMap" type="com.yutou.nas.mybatis.model.VideoInfo">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="title_cn" jdbcType="VARCHAR" property="titleCn" />
    <result column="title_jp" jdbcType="VARCHAR" property="titleJp" />
    <result column="air_data" jdbcType="VARCHAR" property="airData" />
    <result column="air_weekday" jdbcType="VARCHAR" property="airWeekday" />
    <result column="bangumi_url" jdbcType="VARCHAR" property="bangumiUrl" />
    <result column="bangumi_rating" jdbcType="FLOAT" property="bangumiRating" />
    <result column="eps_count" jdbcType="VARCHAR" property="epsCount" />
    <result column="eps_now" jdbcType="VARCHAR" property="epsNow" />
    <result column="crts" jdbcType="VARCHAR" property="crts" />
    <result column="staffs" jdbcType="VARCHAR" property="staffs" />
    <result column="image" jdbcType="VARCHAR" property="image" />
    <result column="info" jdbcType="VARCHAR" property="info" />
    <result column="path" jdbcType="VARCHAR" property="path" />
  </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, title_cn, title_jp, air_data, air_weekday, bangumi_url, bangumi_rating, eps_count, 
    eps_now, crts, staffs, image, info, `path`
  </sql>
  <select id="selectByExample" parameterType="com.yutou.nas.mybatis.model.VideoInfoExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from video_info
    <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_info
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from video_info
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.yutou.nas.mybatis.model.VideoInfoExample">
    delete from video_info
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yutou.nas.mybatis.model.VideoInfo" useGeneratedKeys="true">
    insert into video_info (title_cn, title_jp, air_data, 
      air_weekday, bangumi_url, bangumi_rating, 
      eps_count, eps_now, crts, 
      staffs, image, info, 
      `path`)
    values (#{titleCn,jdbcType=VARCHAR}, #{titleJp,jdbcType=VARCHAR}, #{airData,jdbcType=VARCHAR}, 
      #{airWeekday,jdbcType=VARCHAR}, #{bangumiUrl,jdbcType=VARCHAR}, #{bangumiRating,jdbcType=FLOAT}, 
      #{epsCount,jdbcType=VARCHAR}, #{epsNow,jdbcType=VARCHAR}, #{crts,jdbcType=VARCHAR}, 
      #{staffs,jdbcType=VARCHAR}, #{image,jdbcType=VARCHAR}, #{info,jdbcType=VARCHAR}, 
      #{path,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yutou.nas.mybatis.model.VideoInfo" useGeneratedKeys="true">
    insert into video_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="titleCn != null">
        title_cn,
      </if>
      <if test="titleJp != null">
        title_jp,
      </if>
      <if test="airData != null">
        air_data,
      </if>
      <if test="airWeekday != null">
        air_weekday,
      </if>
      <if test="bangumiUrl != null">
        bangumi_url,
      </if>
      <if test="bangumiRating != null">
        bangumi_rating,
      </if>
      <if test="epsCount != null">
        eps_count,
      </if>
      <if test="epsNow != null">
        eps_now,
      </if>
      <if test="crts != null">
        crts,
      </if>
      <if test="staffs != null">
        staffs,
      </if>
      <if test="image != null">
        image,
      </if>
      <if test="info != null">
        info,
      </if>
      <if test="path != null">
        `path`,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="titleCn != null">
        #{titleCn,jdbcType=VARCHAR},
      </if>
      <if test="titleJp != null">
        #{titleJp,jdbcType=VARCHAR},
      </if>
      <if test="airData != null">
        #{airData,jdbcType=VARCHAR},
      </if>
      <if test="airWeekday != null">
        #{airWeekday,jdbcType=VARCHAR},
      </if>
      <if test="bangumiUrl != null">
        #{bangumiUrl,jdbcType=VARCHAR},
      </if>
      <if test="bangumiRating != null">
        #{bangumiRating,jdbcType=FLOAT},
      </if>
      <if test="epsCount != null">
        #{epsCount,jdbcType=VARCHAR},
      </if>
      <if test="epsNow != null">
        #{epsNow,jdbcType=VARCHAR},
      </if>
      <if test="crts != null">
        #{crts,jdbcType=VARCHAR},
      </if>
      <if test="staffs != null">
        #{staffs,jdbcType=VARCHAR},
      </if>
      <if test="image != null">
        #{image,jdbcType=VARCHAR},
      </if>
      <if test="info != null">
        #{info,jdbcType=VARCHAR},
      </if>
      <if test="path != null">
        #{path,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.yutou.nas.mybatis.model.VideoInfoExample" resultType="java.lang.Long">
    select count(*) from video_info
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update video_info
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.titleCn != null">
        title_cn = #{record.titleCn,jdbcType=VARCHAR},
      </if>
      <if test="record.titleJp != null">
        title_jp = #{record.titleJp,jdbcType=VARCHAR},
      </if>
      <if test="record.airData != null">
        air_data = #{record.airData,jdbcType=VARCHAR},
      </if>
      <if test="record.airWeekday != null">
        air_weekday = #{record.airWeekday,jdbcType=VARCHAR},
      </if>
      <if test="record.bangumiUrl != null">
        bangumi_url = #{record.bangumiUrl,jdbcType=VARCHAR},
      </if>
      <if test="record.bangumiRating != null">
        bangumi_rating = #{record.bangumiRating,jdbcType=FLOAT},
      </if>
      <if test="record.epsCount != null">
        eps_count = #{record.epsCount,jdbcType=VARCHAR},
      </if>
      <if test="record.epsNow != null">
        eps_now = #{record.epsNow,jdbcType=VARCHAR},
      </if>
      <if test="record.crts != null">
        crts = #{record.crts,jdbcType=VARCHAR},
      </if>
      <if test="record.staffs != null">
        staffs = #{record.staffs,jdbcType=VARCHAR},
      </if>
      <if test="record.image != null">
        image = #{record.image,jdbcType=VARCHAR},
      </if>
      <if test="record.info != null">
        info = #{record.info,jdbcType=VARCHAR},
      </if>
      <if test="record.path != null">
        `path` = #{record.path,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update video_info
    set id = #{record.id,jdbcType=INTEGER},
      title_cn = #{record.titleCn,jdbcType=VARCHAR},
      title_jp = #{record.titleJp,jdbcType=VARCHAR},
      air_data = #{record.airData,jdbcType=VARCHAR},
      air_weekday = #{record.airWeekday,jdbcType=VARCHAR},
      bangumi_url = #{record.bangumiUrl,jdbcType=VARCHAR},
      bangumi_rating = #{record.bangumiRating,jdbcType=FLOAT},
      eps_count = #{record.epsCount,jdbcType=VARCHAR},
      eps_now = #{record.epsNow,jdbcType=VARCHAR},
      crts = #{record.crts,jdbcType=VARCHAR},
      staffs = #{record.staffs,jdbcType=VARCHAR},
      image = #{record.image,jdbcType=VARCHAR},
      info = #{record.info,jdbcType=VARCHAR},
      `path` = #{record.path,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yutou.nas.mybatis.model.VideoInfo">
    update video_info
    <set>
      <if test="titleCn != null">
        title_cn = #{titleCn,jdbcType=VARCHAR},
      </if>
      <if test="titleJp != null">
        title_jp = #{titleJp,jdbcType=VARCHAR},
      </if>
      <if test="airData != null">
        air_data = #{airData,jdbcType=VARCHAR},
      </if>
      <if test="airWeekday != null">
        air_weekday = #{airWeekday,jdbcType=VARCHAR},
      </if>
      <if test="bangumiUrl != null">
        bangumi_url = #{bangumiUrl,jdbcType=VARCHAR},
      </if>
      <if test="bangumiRating != null">
        bangumi_rating = #{bangumiRating,jdbcType=FLOAT},
      </if>
      <if test="epsCount != null">
        eps_count = #{epsCount,jdbcType=VARCHAR},
      </if>
      <if test="epsNow != null">
        eps_now = #{epsNow,jdbcType=VARCHAR},
      </if>
      <if test="crts != null">
        crts = #{crts,jdbcType=VARCHAR},
      </if>
      <if test="staffs != null">
        staffs = #{staffs,jdbcType=VARCHAR},
      </if>
      <if test="image != null">
        image = #{image,jdbcType=VARCHAR},
      </if>
      <if test="info != null">
        info = #{info,jdbcType=VARCHAR},
      </if>
      <if test="path != null">
        `path` = #{path,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yutou.nas.mybatis.model.VideoInfo">
    update video_info
    set title_cn = #{titleCn,jdbcType=VARCHAR},
      title_jp = #{titleJp,jdbcType=VARCHAR},
      air_data = #{airData,jdbcType=VARCHAR},
      air_weekday = #{airWeekday,jdbcType=VARCHAR},
      bangumi_url = #{bangumiUrl,jdbcType=VARCHAR},
      bangumi_rating = #{bangumiRating,jdbcType=FLOAT},
      eps_count = #{epsCount,jdbcType=VARCHAR},
      eps_now = #{epsNow,jdbcType=VARCHAR},
      crts = #{crts,jdbcType=VARCHAR},
      staffs = #{staffs,jdbcType=VARCHAR},
      image = #{image,jdbcType=VARCHAR},
      info = #{info,jdbcType=VARCHAR},
      `path` = #{path,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>