<?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.fuxi.ws.data.dao.WQuestionoptionMapper">
  <resultMap id="BaseResultMap" type="com.fuxi.ws.data.entity.WQuestionoption">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Sep 29 12:14:47 CST 2015.
    -->
    <id column="QtID" jdbcType="INTEGER" property="qtid" />
    <id column="QtDtlID" jdbcType="TINYINT" property="qtdtlid" />
    <id column="OptionID" jdbcType="TINYINT" property="optionid" />
    <result column="OptionContext" jdbcType="NVARCHAR" property="optioncontext" />
    <result column="OptionImg" jdbcType="VARCHAR" property="optionimg" />
    <result column="LabelID" jdbcType="INTEGER" property="labelid" />
    <result column="Fraction" jdbcType="SMALLINT" property="fraction" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Sep 29 12:14:47 CST 2015.
    -->
    <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="Base_Column_List">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Sep 29 12:14:47 CST 2015.
    -->
    QtID, QtDtlID, OptionID, OptionContext, OptionImg, LabelID, Fraction
  </sql>
  <select id="selectByExample" parameterType="com.fuxi.ws.data.entity.WQuestionoptionExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Sep 29 12:14:47 CST 2015.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    'false' as QUERYID,
    <include refid="Base_Column_List" />
    from W_QuestionOption
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WQuestionoptionKey" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Sep 29 12:14:47 CST 2015.
    -->
    select 
    <include refid="Base_Column_List" />
    from W_QuestionOption
    where QtID = #{qtid,jdbcType=INTEGER}
      and QtDtlID = #{qtdtlid,jdbcType=TINYINT}
      and OptionID = #{optionid,jdbcType=TINYINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WQuestionoptionKey">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Sep 29 12:14:47 CST 2015.
    -->
    delete from W_QuestionOption
    where QtID = #{qtid,jdbcType=INTEGER}
      and QtDtlID = #{qtdtlid,jdbcType=TINYINT}
      and OptionID = #{optionid,jdbcType=TINYINT}
  </delete>
  <insert id="insert" parameterType="com.fuxi.ws.data.entity.WQuestionoption">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Sep 29 12:14:47 CST 2015.
    -->
    insert into W_QuestionOption (QtID, QtDtlID, OptionID, 
      OptionContext, OptionImg, LabelID, 
      Fraction)
    values (#{qtid,jdbcType=INTEGER}, #{qtdtlid,jdbcType=TINYINT}, #{optionid,jdbcType=TINYINT}, 
      #{optioncontext,jdbcType=NVARCHAR}, #{optionimg,jdbcType=VARCHAR}, #{labelid,jdbcType=INTEGER}, 
      #{fraction,jdbcType=SMALLINT})
  </insert>
  <insert id="insertSelective" parameterType="com.fuxi.ws.data.entity.WQuestionoption">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Sep 29 12:14:47 CST 2015.
    -->
    insert into W_QuestionOption
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="qtid != null">
        QtID,
      </if>
      <if test="qtdtlid != null">
        QtDtlID,
      </if>
      <if test="optionid != null">
        OptionID,
      </if>
      <if test="optioncontext != null">
        OptionContext,
      </if>
      <if test="optionimg != null">
        OptionImg,
      </if>
      <if test="labelid != null">
        LabelID,
      </if>
      <if test="fraction != null">
        Fraction,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="qtid != null">
        #{qtid,jdbcType=INTEGER},
      </if>
      <if test="qtdtlid != null">
        #{qtdtlid,jdbcType=TINYINT},
      </if>
      <if test="optionid != null">
        #{optionid,jdbcType=TINYINT},
      </if>
      <if test="optioncontext != null">
        #{optioncontext,jdbcType=NVARCHAR},
      </if>
      <if test="optionimg != null">
        #{optionimg,jdbcType=VARCHAR},
      </if>
      <if test="labelid != null">
        #{labelid,jdbcType=INTEGER},
      </if>
      <if test="fraction != null">
        #{fraction,jdbcType=SMALLINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.fuxi.ws.data.entity.WQuestionoptionExample" resultType="java.lang.Integer">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Sep 29 12:14:47 CST 2015.
    -->
    select count(*) from W_QuestionOption
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByPrimaryKeySelective" parameterType="com.fuxi.ws.data.entity.WQuestionoption">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Sep 29 12:14:47 CST 2015.
    -->
    update W_QuestionOption
    <set>
      <if test="optioncontext != null">
        OptionContext = #{optioncontext,jdbcType=NVARCHAR},
      </if>
      <if test="optionimg != null">
        OptionImg = #{optionimg,jdbcType=VARCHAR},
      </if>
      <if test="labelid != null">
        LabelID = #{labelid,jdbcType=INTEGER},
      </if>
      <if test="fraction != null">
        Fraction = #{fraction,jdbcType=SMALLINT},
      </if>
    </set>
    where QtID = #{qtid,jdbcType=INTEGER}
      and QtDtlID = #{qtdtlid,jdbcType=TINYINT}
      and OptionID = #{optionid,jdbcType=TINYINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WQuestionoption">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Sep 29 12:14:47 CST 2015.
    -->
    update W_QuestionOption
    set OptionContext = #{optioncontext,jdbcType=NVARCHAR},
      OptionImg = #{optionimg,jdbcType=VARCHAR},
      LabelID = #{labelid,jdbcType=INTEGER},
      Fraction = #{fraction,jdbcType=SMALLINT}
    where QtID = #{qtid,jdbcType=INTEGER}
      and QtDtlID = #{qtdtlid,jdbcType=TINYINT}
      and OptionID = #{optionid,jdbcType=TINYINT}
  </update>
</mapper>