<?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="org.linlinjava.litemall.db.dao.LitemallCouponMapper">
  <resultMap id="BaseResultMap" type="org.linlinjava.litemall.db.domain.LitemallCoupon">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="type_money" jdbcType="DECIMAL" property="typeMoney" />
    <result column="send_type" jdbcType="TINYINT" property="sendType" />
    <result column="min_amount" jdbcType="DECIMAL" property="minAmount" />
    <result column="max_amount" jdbcType="DECIMAL" property="maxAmount" />
    <result column="min_goods_amount" jdbcType="DECIMAL" property="minGoodsAmount" />
    <result column="send_start" jdbcType="TIMESTAMP" property="sendStart" />
    <result column="send_end" jdbcType="TIMESTAMP" property="sendEnd" />
    <result column="use_start" jdbcType="TIMESTAMP" property="useStart" />
    <result column="use_end" jdbcType="TIMESTAMP" property="useEnd" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    <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">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    <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">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    id, `name`, type_money, send_type, min_amount, max_amount, min_goods_amount, send_start, 
    send_end, use_start, use_end
  </sql>
  <select id="selectByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallCouponExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from litemall_coupon
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      @project https://github.com/itfsw/mybatis-generator-plugin
    -->
    select
    <if test="example.distinct">
      distinct
    </if>
    <foreach collection="selective" item="column" separator=",">
      ${column.value}
    </foreach>
    from litemall_coupon
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
    <if test="example.orderByClause != null">
      order by ${example.orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    select 
    <include refid="Base_Column_List" />
    from litemall_coupon
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      @project https://github.com/itfsw/mybatis-generator-plugin
    -->
    select
    <foreach collection="selective" item="column" separator=",">
      ${column.value}
    </foreach>
    from litemall_coupon
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    delete from litemall_coupon
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallCouponExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    delete from litemall_coupon
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="org.linlinjava.litemall.db.domain.LitemallCoupon">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into litemall_coupon (`name`, type_money, send_type, 
      min_amount, max_amount, min_goods_amount, 
      send_start, send_end, use_start, 
      use_end)
    values (#{name,jdbcType=VARCHAR}, #{typeMoney,jdbcType=DECIMAL}, #{sendType,jdbcType=TINYINT}, 
      #{minAmount,jdbcType=DECIMAL}, #{maxAmount,jdbcType=DECIMAL}, #{minGoodsAmount,jdbcType=DECIMAL}, 
      #{sendStart,jdbcType=TIMESTAMP}, #{sendEnd,jdbcType=TIMESTAMP}, #{useStart,jdbcType=TIMESTAMP}, 
      #{useEnd,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="org.linlinjava.litemall.db.domain.LitemallCoupon">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into litemall_coupon
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="name != null">
        `name`,
      </if>
      <if test="typeMoney != null">
        type_money,
      </if>
      <if test="sendType != null">
        send_type,
      </if>
      <if test="minAmount != null">
        min_amount,
      </if>
      <if test="maxAmount != null">
        max_amount,
      </if>
      <if test="minGoodsAmount != null">
        min_goods_amount,
      </if>
      <if test="sendStart != null">
        send_start,
      </if>
      <if test="sendEnd != null">
        send_end,
      </if>
      <if test="useStart != null">
        use_start,
      </if>
      <if test="useEnd != null">
        use_end,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="typeMoney != null">
        #{typeMoney,jdbcType=DECIMAL},
      </if>
      <if test="sendType != null">
        #{sendType,jdbcType=TINYINT},
      </if>
      <if test="minAmount != null">
        #{minAmount,jdbcType=DECIMAL},
      </if>
      <if test="maxAmount != null">
        #{maxAmount,jdbcType=DECIMAL},
      </if>
      <if test="minGoodsAmount != null">
        #{minGoodsAmount,jdbcType=DECIMAL},
      </if>
      <if test="sendStart != null">
        #{sendStart,jdbcType=TIMESTAMP},
      </if>
      <if test="sendEnd != null">
        #{sendEnd,jdbcType=TIMESTAMP},
      </if>
      <if test="useStart != null">
        #{useStart,jdbcType=TIMESTAMP},
      </if>
      <if test="useEnd != null">
        #{useEnd,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallCouponExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    select count(*) from litemall_coupon
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    update litemall_coupon
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.name != null">
        `name` = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.typeMoney != null">
        type_money = #{record.typeMoney,jdbcType=DECIMAL},
      </if>
      <if test="record.sendType != null">
        send_type = #{record.sendType,jdbcType=TINYINT},
      </if>
      <if test="record.minAmount != null">
        min_amount = #{record.minAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.maxAmount != null">
        max_amount = #{record.maxAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.minGoodsAmount != null">
        min_goods_amount = #{record.minGoodsAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.sendStart != null">
        send_start = #{record.sendStart,jdbcType=TIMESTAMP},
      </if>
      <if test="record.sendEnd != null">
        send_end = #{record.sendEnd,jdbcType=TIMESTAMP},
      </if>
      <if test="record.useStart != null">
        use_start = #{record.useStart,jdbcType=TIMESTAMP},
      </if>
      <if test="record.useEnd != null">
        use_end = #{record.useEnd,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    update litemall_coupon
    set id = #{record.id,jdbcType=INTEGER},
      `name` = #{record.name,jdbcType=VARCHAR},
      type_money = #{record.typeMoney,jdbcType=DECIMAL},
      send_type = #{record.sendType,jdbcType=TINYINT},
      min_amount = #{record.minAmount,jdbcType=DECIMAL},
      max_amount = #{record.maxAmount,jdbcType=DECIMAL},
      min_goods_amount = #{record.minGoodsAmount,jdbcType=DECIMAL},
      send_start = #{record.sendStart,jdbcType=TIMESTAMP},
      send_end = #{record.sendEnd,jdbcType=TIMESTAMP},
      use_start = #{record.useStart,jdbcType=TIMESTAMP},
      use_end = #{record.useEnd,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="org.linlinjava.litemall.db.domain.LitemallCoupon">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    update litemall_coupon
    <set>
      <if test="name != null">
        `name` = #{name,jdbcType=VARCHAR},
      </if>
      <if test="typeMoney != null">
        type_money = #{typeMoney,jdbcType=DECIMAL},
      </if>
      <if test="sendType != null">
        send_type = #{sendType,jdbcType=TINYINT},
      </if>
      <if test="minAmount != null">
        min_amount = #{minAmount,jdbcType=DECIMAL},
      </if>
      <if test="maxAmount != null">
        max_amount = #{maxAmount,jdbcType=DECIMAL},
      </if>
      <if test="minGoodsAmount != null">
        min_goods_amount = #{minGoodsAmount,jdbcType=DECIMAL},
      </if>
      <if test="sendStart != null">
        send_start = #{sendStart,jdbcType=TIMESTAMP},
      </if>
      <if test="sendEnd != null">
        send_end = #{sendEnd,jdbcType=TIMESTAMP},
      </if>
      <if test="useStart != null">
        use_start = #{useStart,jdbcType=TIMESTAMP},
      </if>
      <if test="useEnd != null">
        use_end = #{useEnd,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="org.linlinjava.litemall.db.domain.LitemallCoupon">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Mar 20 00:11:33 CST 2018.
    -->
    update litemall_coupon
    set `name` = #{name,jdbcType=VARCHAR},
      type_money = #{typeMoney,jdbcType=DECIMAL},
      send_type = #{sendType,jdbcType=TINYINT},
      min_amount = #{minAmount,jdbcType=DECIMAL},
      max_amount = #{maxAmount,jdbcType=DECIMAL},
      min_goods_amount = #{minGoodsAmount,jdbcType=DECIMAL},
      send_start = #{sendStart,jdbcType=TIMESTAMP},
      send_end = #{sendEnd,jdbcType=TIMESTAMP},
      use_start = #{useStart,jdbcType=TIMESTAMP},
      use_end = #{useEnd,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="selectOneByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallCouponExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      @project https://github.com/itfsw/mybatis-generator-plugin
    -->
    select
    <include refid="Base_Column_List" />
    from litemall_coupon
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    limit 1
  </select>
  <select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      @project https://github.com/itfsw/mybatis-generator-plugin
    -->
    select
    <foreach collection="selective" item="column" separator=",">
      ${column.value}
    </foreach>
    from litemall_coupon
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
    <if test="example.orderByClause != null">
      order by ${example.orderByClause}
    </if>
    limit 1
  </select>
</mapper>