<?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.WLuckyMapper">
  <resultMap id="BaseResultMap" type="com.fuxi.ws.data.entity.WLucky">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Nov 14 11:09:43 CST 2016.
    -->
    <id column="PromotionsID" jdbcType="INTEGER" property="promotionsid" />
    <id column="LuckyID" jdbcType="TINYINT" property="luckyid" />
    <result column="LuckyType" jdbcType="TINYINT" property="luckytype" />
    <result column="TicketID" jdbcType="BIGINT" property="ticketid" />
    <result column="LuckyNum" jdbcType="DECIMAL" property="luckynum" />
    <result column="GoodsID" jdbcType="VARCHAR" property="goodsid" />
    <result column="Background" jdbcType="VARCHAR" property="background" />
    <result column="Foreground" jdbcType="VARCHAR" property="foreground" />
    <result column="LuckyName" jdbcType="VARCHAR" property="luckyname" />
    <result column="LuckTotal" jdbcType="INTEGER" property="lucktotal" />
    <result column="LuckGiveOut" jdbcType="INTEGER" property="luckgiveout" />
    <result column="WinRate" jdbcType="DECIMAL" property="winrate" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Nov 14 11:09:43 CST 2016.
    -->
    <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 Mon Nov 14 11:09:43 CST 2016.
    -->
    PromotionsID, LuckyID, LuckyType, TicketID, LuckyNum, GoodsID, Background, Foreground, 
    LuckyName, LuckTotal, LuckGiveOut, WinRate
  </sql>
  <select id="selectByExample" parameterType="com.fuxi.ws.data.entity.WLuckyExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Nov 14 11:09:43 CST 2016.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    'false' as QUERYID,
    <include refid="Base_Column_List" />
    from W_Lucky
    <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.WLuckyKey" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Nov 14 11:09:43 CST 2016.
    -->
    select 
    <include refid="Base_Column_List" />
    from W_Lucky
    where PromotionsID = #{promotionsid,jdbcType=INTEGER}
      and LuckyID = #{luckyid,jdbcType=TINYINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WLuckyKey">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Nov 14 11:09:43 CST 2016.
    -->
    delete from W_Lucky
    where PromotionsID = #{promotionsid,jdbcType=INTEGER}
      and LuckyID = #{luckyid,jdbcType=TINYINT}
  </delete>
  <insert id="insert" parameterType="com.fuxi.ws.data.entity.WLucky">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Nov 14 11:09:43 CST 2016.
    -->
    insert into W_Lucky (PromotionsID, LuckyID, LuckyType, 
      TicketID, LuckyNum, GoodsID, 
      Background, Foreground, LuckyName, 
      LuckTotal, LuckGiveOut, WinRate
      )
    values (#{promotionsid,jdbcType=INTEGER}, #{luckyid,jdbcType=TINYINT}, #{luckytype,jdbcType=TINYINT}, 
      #{ticketid,jdbcType=BIGINT}, #{luckynum,jdbcType=DECIMAL}, #{goodsid,jdbcType=VARCHAR}, 
      #{background,jdbcType=VARCHAR}, #{foreground,jdbcType=VARCHAR}, #{luckyname,jdbcType=VARCHAR}, 
      #{lucktotal,jdbcType=INTEGER}, #{luckgiveout,jdbcType=INTEGER}, #{winrate,jdbcType=DECIMAL}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.fuxi.ws.data.entity.WLucky">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Nov 14 11:09:43 CST 2016.
    -->
    insert into W_Lucky
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="promotionsid != null">
        PromotionsID,
      </if>
      <if test="luckyid != null">
        LuckyID,
      </if>
      <if test="luckytype != null">
        LuckyType,
      </if>
      <if test="ticketid != null">
        TicketID,
      </if>
      <if test="luckynum != null">
        LuckyNum,
      </if>
      <if test="goodsid != null">
        GoodsID,
      </if>
      <if test="background != null">
        Background,
      </if>
      <if test="foreground != null">
        Foreground,
      </if>
      <if test="luckyname != null">
        LuckyName,
      </if>
      <if test="lucktotal != null">
        LuckTotal,
      </if>
      <if test="luckgiveout != null">
        LuckGiveOut,
      </if>
      <if test="winrate != null">
        WinRate,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="promotionsid != null">
        #{promotionsid,jdbcType=INTEGER},
      </if>
      <if test="luckyid != null">
        #{luckyid,jdbcType=TINYINT},
      </if>
      <if test="luckytype != null">
        #{luckytype,jdbcType=TINYINT},
      </if>
      <if test="ticketid != null">
        #{ticketid,jdbcType=BIGINT},
      </if>
      <if test="luckynum != null">
        #{luckynum,jdbcType=DECIMAL},
      </if>
      <if test="goodsid != null">
        #{goodsid,jdbcType=VARCHAR},
      </if>
      <if test="background != null">
        #{background,jdbcType=VARCHAR},
      </if>
      <if test="foreground != null">
        #{foreground,jdbcType=VARCHAR},
      </if>
      <if test="luckyname != null">
        #{luckyname,jdbcType=VARCHAR},
      </if>
      <if test="lucktotal != null">
        #{lucktotal,jdbcType=INTEGER},
      </if>
      <if test="luckgiveout != null">
        #{luckgiveout,jdbcType=INTEGER},
      </if>
      <if test="winrate != null">
        #{winrate,jdbcType=DECIMAL},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.fuxi.ws.data.entity.WLuckyExample" resultType="java.lang.Integer">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Nov 14 11:09:43 CST 2016.
    -->
    select count(*) from W_Lucky
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByPrimaryKeySelective" parameterType="com.fuxi.ws.data.entity.WLucky">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Nov 14 11:09:43 CST 2016.
    -->
    update W_Lucky
    <set>
      <if test="luckytype != null">
        LuckyType = #{luckytype,jdbcType=TINYINT},
      </if>
      <if test="ticketid != null">
        TicketID = #{ticketid,jdbcType=BIGINT},
      </if>
      <if test="luckynum != null">
        LuckyNum = #{luckynum,jdbcType=DECIMAL},
      </if>
      <if test="goodsid != null">
        GoodsID = #{goodsid,jdbcType=VARCHAR},
      </if>
      <if test="background != null">
        Background = #{background,jdbcType=VARCHAR},
      </if>
      <if test="foreground != null">
        Foreground = #{foreground,jdbcType=VARCHAR},
      </if>
      <if test="luckyname != null">
        LuckyName = #{luckyname,jdbcType=VARCHAR},
      </if>
      <if test="lucktotal != null">
        LuckTotal = #{lucktotal,jdbcType=INTEGER},
      </if>
      <if test="luckgiveout != null">
        LuckGiveOut = #{luckgiveout,jdbcType=INTEGER},
      </if>
      <if test="winrate != null">
        WinRate = #{winrate,jdbcType=DECIMAL},
      </if>
    </set>
    where PromotionsID = #{promotionsid,jdbcType=INTEGER}
      and LuckyID = #{luckyid,jdbcType=TINYINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WLucky">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Nov 14 11:09:43 CST 2016.
    -->
    update W_Lucky
    set LuckyType = #{luckytype,jdbcType=TINYINT},
      TicketID = #{ticketid,jdbcType=BIGINT},
      LuckyNum = #{luckynum,jdbcType=DECIMAL},
      GoodsID = #{goodsid,jdbcType=VARCHAR},
      Background = #{background,jdbcType=VARCHAR},
      Foreground = #{foreground,jdbcType=VARCHAR},
      LuckyName = #{luckyname,jdbcType=VARCHAR},
      LuckTotal = #{lucktotal,jdbcType=INTEGER},
      LuckGiveOut = #{luckgiveout,jdbcType=INTEGER},
      WinRate = #{winrate,jdbcType=DECIMAL}
    where PromotionsID = #{promotionsid,jdbcType=INTEGER}
      and LuckyID = #{luckyid,jdbcType=TINYINT}
  </update>
  
  <!-- 删除抽奖信息  -->
  <delete id="delrotary" parameterType="java.lang.Integer">
    delete from W_Lucky
    where PromotionsID = #{promotionsid,jdbcType=INTEGER}
  </delete>
</mapper>