<?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.platform.yijia.dao.CouponMapper">
  <resultMap id="BaseResultMap" type="com.platform.yijia.pojo.Coupon">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="coupon_id" jdbcType="INTEGER" property="couponId" />
    <result column="station_no" jdbcType="VARCHAR" property="stationNo" />
    <result column="station_name" jdbcType="VARCHAR" property="stationName" />
    <result column="coupon_name" jdbcType="VARCHAR" property="couponName" />
    <result column="coupon_rule" jdbcType="VARCHAR" property="couponRule" />
    <result column="coupon_type" jdbcType="CHAR" property="couponType" />
    <result column="coupon_amt" jdbcType="DOUBLE" property="couponAmt" />
    <result column="coupon_reul_amt" jdbcType="DOUBLE" property="couponReulAmt" />
    <result column="coupon_oil" jdbcType="VARCHAR" property="couponOil" />
    <result column="validity_date" jdbcType="DATE" property="validityDate" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <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.
    -->
    <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.
    -->
    coupon_id, station_no, station_name, coupon_name, coupon_rule, coupon_type, coupon_amt, 
    coupon_reul_amt, coupon_oil, validity_date
  </sql>
  <select id="selectByExample" parameterType="com.platform.yijia.pojo.CouponExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from coupon
    <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">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from coupon
    where coupon_id = #{couponId,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from coupon
    where coupon_id = #{couponId,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.platform.yijia.pojo.CouponExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from coupon
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.platform.yijia.pojo.Coupon">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into coupon (coupon_id, station_no, station_name, 
      coupon_name, coupon_rule, coupon_type, 
      coupon_amt, coupon_reul_amt, coupon_oil, 
      validity_date)
    values (#{couponId,jdbcType=INTEGER}, #{stationNo,jdbcType=VARCHAR}, #{stationName,jdbcType=VARCHAR}, 
      #{couponName,jdbcType=VARCHAR}, #{couponRule,jdbcType=VARCHAR}, #{couponType,jdbcType=CHAR}, 
      #{couponAmt,jdbcType=DOUBLE}, #{couponReulAmt,jdbcType=DOUBLE}, #{couponOil,jdbcType=VARCHAR}, 
      #{validityDate,jdbcType=DATE})
  </insert>
  <insert id="insertSelective" parameterType="com.platform.yijia.pojo.Coupon">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into coupon
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="couponId != null">
        coupon_id,
      </if>
      <if test="stationNo != null">
        station_no,
      </if>
      <if test="stationName != null">
        station_name,
      </if>
      <if test="couponName != null">
        coupon_name,
      </if>
      <if test="couponRule != null">
        coupon_rule,
      </if>
      <if test="couponType != null">
        coupon_type,
      </if>
      <if test="couponAmt != null">
        coupon_amt,
      </if>
      <if test="couponReulAmt != null">
        coupon_reul_amt,
      </if>
      <if test="couponOil != null">
        coupon_oil,
      </if>
      <if test="validityDate != null">
        validity_date,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="couponId != null">
        #{couponId,jdbcType=INTEGER},
      </if>
      <if test="stationNo != null">
        #{stationNo,jdbcType=VARCHAR},
      </if>
      <if test="stationName != null">
        #{stationName,jdbcType=VARCHAR},
      </if>
      <if test="couponName != null">
        #{couponName,jdbcType=VARCHAR},
      </if>
      <if test="couponRule != null">
        #{couponRule,jdbcType=VARCHAR},
      </if>
      <if test="couponType != null">
        #{couponType,jdbcType=CHAR},
      </if>
      <if test="couponAmt != null">
        #{couponAmt,jdbcType=DOUBLE},
      </if>
      <if test="couponReulAmt != null">
        #{couponReulAmt,jdbcType=DOUBLE},
      </if>
      <if test="couponOil != null">
        #{couponOil,jdbcType=VARCHAR},
      </if>
      <if test="validityDate != null">
        #{validityDate,jdbcType=DATE},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.platform.yijia.pojo.CouponExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select count(*) from 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.
    -->
    update coupon
    <set>
      <if test="record.couponId != null">
        coupon_id = #{record.couponId,jdbcType=INTEGER},
      </if>
      <if test="record.stationNo != null">
        station_no = #{record.stationNo,jdbcType=VARCHAR},
      </if>
      <if test="record.stationName != null">
        station_name = #{record.stationName,jdbcType=VARCHAR},
      </if>
      <if test="record.couponName != null">
        coupon_name = #{record.couponName,jdbcType=VARCHAR},
      </if>
      <if test="record.couponRule != null">
        coupon_rule = #{record.couponRule,jdbcType=VARCHAR},
      </if>
      <if test="record.couponType != null">
        coupon_type = #{record.couponType,jdbcType=CHAR},
      </if>
      <if test="record.couponAmt != null">
        coupon_amt = #{record.couponAmt,jdbcType=DOUBLE},
      </if>
      <if test="record.couponReulAmt != null">
        coupon_reul_amt = #{record.couponReulAmt,jdbcType=DOUBLE},
      </if>
      <if test="record.couponOil != null">
        coupon_oil = #{record.couponOil,jdbcType=VARCHAR},
      </if>
      <if test="record.validityDate != null">
        validity_date = #{record.validityDate,jdbcType=DATE},
      </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.
    -->
    update coupon
    set coupon_id = #{record.couponId,jdbcType=INTEGER},
      station_no = #{record.stationNo,jdbcType=VARCHAR},
      station_name = #{record.stationName,jdbcType=VARCHAR},
      coupon_name = #{record.couponName,jdbcType=VARCHAR},
      coupon_rule = #{record.couponRule,jdbcType=VARCHAR},
      coupon_type = #{record.couponType,jdbcType=CHAR},
      coupon_amt = #{record.couponAmt,jdbcType=DOUBLE},
      coupon_reul_amt = #{record.couponReulAmt,jdbcType=DOUBLE},
      coupon_oil = #{record.couponOil,jdbcType=VARCHAR},
      validity_date = #{record.validityDate,jdbcType=DATE}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.platform.yijia.pojo.Coupon">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update coupon
    <set>
      <if test="stationNo != null">
        station_no = #{stationNo,jdbcType=VARCHAR},
      </if>
      <if test="stationName != null">
        station_name = #{stationName,jdbcType=VARCHAR},
      </if>
      <if test="couponName != null">
        coupon_name = #{couponName,jdbcType=VARCHAR},
      </if>
      <if test="couponRule != null">
        coupon_rule = #{couponRule,jdbcType=VARCHAR},
      </if>
      <if test="couponType != null">
        coupon_type = #{couponType,jdbcType=CHAR},
      </if>
      <if test="couponAmt != null">
        coupon_amt = #{couponAmt,jdbcType=DOUBLE},
      </if>
      <if test="couponReulAmt != null">
        coupon_reul_amt = #{couponReulAmt,jdbcType=DOUBLE},
      </if>
      <if test="couponOil != null">
        coupon_oil = #{couponOil,jdbcType=VARCHAR},
      </if>
      <if test="validityDate != null">
        validity_date = #{validityDate,jdbcType=DATE},
      </if>
    </set>
    where coupon_id = #{couponId,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.platform.yijia.pojo.Coupon">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update coupon
    set station_no = #{stationNo,jdbcType=VARCHAR},
      station_name = #{stationName,jdbcType=VARCHAR},
      coupon_name = #{couponName,jdbcType=VARCHAR},
      coupon_rule = #{couponRule,jdbcType=VARCHAR},
      coupon_type = #{couponType,jdbcType=CHAR},
      coupon_amt = #{couponAmt,jdbcType=DOUBLE},
      coupon_reul_amt = #{couponReulAmt,jdbcType=DOUBLE},
      coupon_oil = #{couponOil,jdbcType=VARCHAR},
      validity_date = #{validityDate,jdbcType=DATE}
    where coupon_id = #{couponId,jdbcType=INTEGER}
  </update>
</mapper>