<?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.bailuntec.mapper.DcAveragePurchaseMapper">
  <resultMap id="BaseResultMap" type="com.bailuntec.domain.entity.DcAveragePurchase">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="ID" jdbcType="INTEGER" property="id" />
    <result column="bailun_sku" jdbcType="VARCHAR" property="bailunSku" />
    <result column="warehouse_code" jdbcType="VARCHAR" property="warehouseCode" />
    <result column="supplier_id" jdbcType="INTEGER" property="supplierId" />
    <result column="supplier_name" jdbcType="VARCHAR" property="supplierName" />
    <result column="price" jdbcType="DECIMAL" property="price" />
    <result column="delivery_days" jdbcType="INTEGER" property="deliveryDays" />
    <result column="inbound_days" jdbcType="INTEGER" property="inboundDays" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="payment_type" jdbcType="TINYINT" property="paymentType" />
  </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.
    -->
    ID, bailun_sku, warehouse_code, supplier_id, supplier_name, price, delivery_days, 
    inbound_days, update_time, payment_type
  </sql>
  <select id="selectByExample" parameterType="com.bailuntec.domain.example.DcAveragePurchaseExample" 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 dc_average_purchase
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    <if test="rows != null">
      <if test="offset != null">
        limit ${offset}, ${rows}
      </if>
      <if test="offset == null">
        limit ${rows}
      </if>
    </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 dc_average_purchase
    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.
    -->
    delete from dc_average_purchase
    where ID = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.bailuntec.domain.example.DcAveragePurchaseExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from dc_average_purchase
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.bailuntec.domain.entity.DcAveragePurchase">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into dc_average_purchase (ID, bailun_sku, warehouse_code, 
      supplier_id, supplier_name, price, 
      delivery_days, inbound_days, update_time, 
      payment_type)
    values (#{id,jdbcType=INTEGER}, #{bailunSku,jdbcType=VARCHAR}, #{warehouseCode,jdbcType=VARCHAR}, 
      #{supplierId,jdbcType=INTEGER}, #{supplierName,jdbcType=VARCHAR}, #{price,jdbcType=DECIMAL}, 
      #{deliveryDays,jdbcType=INTEGER}, #{inboundDays,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, 
      #{paymentType,jdbcType=TINYINT})
  </insert>
  <insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcAveragePurchase">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into dc_average_purchase
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        ID,
      </if>
      <if test="bailunSku != null">
        bailun_sku,
      </if>
      <if test="warehouseCode != null">
        warehouse_code,
      </if>
      <if test="supplierId != null">
        supplier_id,
      </if>
      <if test="supplierName != null">
        supplier_name,
      </if>
      <if test="price != null">
        price,
      </if>
      <if test="deliveryDays != null">
        delivery_days,
      </if>
      <if test="inboundDays != null">
        inbound_days,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="paymentType != null">
        payment_type,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="bailunSku != null">
        #{bailunSku,jdbcType=VARCHAR},
      </if>
      <if test="warehouseCode != null">
        #{warehouseCode,jdbcType=VARCHAR},
      </if>
      <if test="supplierId != null">
        #{supplierId,jdbcType=INTEGER},
      </if>
      <if test="supplierName != null">
        #{supplierName,jdbcType=VARCHAR},
      </if>
      <if test="price != null">
        #{price,jdbcType=DECIMAL},
      </if>
      <if test="deliveryDays != null">
        #{deliveryDays,jdbcType=INTEGER},
      </if>
      <if test="inboundDays != null">
        #{inboundDays,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="paymentType != null">
        #{paymentType,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.bailuntec.domain.example.DcAveragePurchaseExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select count(*) from dc_average_purchase
    <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 dc_average_purchase
    <set>
      <if test="record.id != null">
        ID = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.bailunSku != null">
        bailun_sku = #{record.bailunSku,jdbcType=VARCHAR},
      </if>
      <if test="record.warehouseCode != null">
        warehouse_code = #{record.warehouseCode,jdbcType=VARCHAR},
      </if>
      <if test="record.supplierId != null">
        supplier_id = #{record.supplierId,jdbcType=INTEGER},
      </if>
      <if test="record.supplierName != null">
        supplier_name = #{record.supplierName,jdbcType=VARCHAR},
      </if>
      <if test="record.price != null">
        price = #{record.price,jdbcType=DECIMAL},
      </if>
      <if test="record.deliveryDays != null">
        delivery_days = #{record.deliveryDays,jdbcType=INTEGER},
      </if>
      <if test="record.inboundDays != null">
        inbound_days = #{record.inboundDays,jdbcType=INTEGER},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.paymentType != null">
        payment_type = #{record.paymentType,jdbcType=TINYINT},
      </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 dc_average_purchase
    set ID = #{record.id,jdbcType=INTEGER},
      bailun_sku = #{record.bailunSku,jdbcType=VARCHAR},
      warehouse_code = #{record.warehouseCode,jdbcType=VARCHAR},
      supplier_id = #{record.supplierId,jdbcType=INTEGER},
      supplier_name = #{record.supplierName,jdbcType=VARCHAR},
      price = #{record.price,jdbcType=DECIMAL},
      delivery_days = #{record.deliveryDays,jdbcType=INTEGER},
      inbound_days = #{record.inboundDays,jdbcType=INTEGER},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      payment_type = #{record.paymentType,jdbcType=TINYINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.bailuntec.domain.entity.DcAveragePurchase">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update dc_average_purchase
    <set>
      <if test="bailunSku != null">
        bailun_sku = #{bailunSku,jdbcType=VARCHAR},
      </if>
      <if test="warehouseCode != null">
        warehouse_code = #{warehouseCode,jdbcType=VARCHAR},
      </if>
      <if test="supplierId != null">
        supplier_id = #{supplierId,jdbcType=INTEGER},
      </if>
      <if test="supplierName != null">
        supplier_name = #{supplierName,jdbcType=VARCHAR},
      </if>
      <if test="price != null">
        price = #{price,jdbcType=DECIMAL},
      </if>
      <if test="deliveryDays != null">
        delivery_days = #{deliveryDays,jdbcType=INTEGER},
      </if>
      <if test="inboundDays != null">
        inbound_days = #{inboundDays,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="paymentType != null">
        payment_type = #{paymentType,jdbcType=TINYINT},
      </if>
    </set>
    where ID = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bailuntec.domain.entity.DcAveragePurchase">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update dc_average_purchase
    set bailun_sku = #{bailunSku,jdbcType=VARCHAR},
      warehouse_code = #{warehouseCode,jdbcType=VARCHAR},
      supplier_id = #{supplierId,jdbcType=INTEGER},
      supplier_name = #{supplierName,jdbcType=VARCHAR},
      price = #{price,jdbcType=DECIMAL},
      delivery_days = #{deliveryDays,jdbcType=INTEGER},
      inbound_days = #{inboundDays,jdbcType=INTEGER},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      payment_type = #{paymentType,jdbcType=TINYINT}
    where ID = #{id,jdbcType=INTEGER}
  </update>
  <insert id="upsertSelective" parameterType="com.bailuntec.domain.entity.DcAveragePurchase">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      @project https://github.com/itfsw/mybatis-generator-plugin
    -->
    insert into dc_average_purchase
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        ID,
      </if>
      <if test="bailunSku != null">
        bailun_sku,
      </if>
      <if test="warehouseCode != null">
        warehouse_code,
      </if>
      <if test="supplierId != null">
        supplier_id,
      </if>
      <if test="supplierName != null">
        supplier_name,
      </if>
      <if test="price != null">
        price,
      </if>
      <if test="deliveryDays != null">
        delivery_days,
      </if>
      <if test="inboundDays != null">
        inbound_days,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="paymentType != null">
        payment_type,
      </if>
    </trim>
    values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="bailunSku != null">
        #{bailunSku,jdbcType=VARCHAR},
      </if>
      <if test="warehouseCode != null">
        #{warehouseCode,jdbcType=VARCHAR},
      </if>
      <if test="supplierId != null">
        #{supplierId,jdbcType=INTEGER},
      </if>
      <if test="supplierName != null">
        #{supplierName,jdbcType=VARCHAR},
      </if>
      <if test="price != null">
        #{price,jdbcType=DECIMAL},
      </if>
      <if test="deliveryDays != null">
        #{deliveryDays,jdbcType=INTEGER},
      </if>
      <if test="inboundDays != null">
        #{inboundDays,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="paymentType != null">
        #{paymentType,jdbcType=TINYINT},
      </if>
    </trim>
    on duplicate key update 
    <trim suffixOverrides=",">
      <if test="id != null">
        ID = #{id,jdbcType=INTEGER},
      </if>
      <if test="bailunSku != null">
        bailun_sku = #{bailunSku,jdbcType=VARCHAR},
      </if>
      <if test="warehouseCode != null">
        warehouse_code = #{warehouseCode,jdbcType=VARCHAR},
      </if>
      <if test="supplierId != null">
        supplier_id = #{supplierId,jdbcType=INTEGER},
      </if>
      <if test="supplierName != null">
        supplier_name = #{supplierName,jdbcType=VARCHAR},
      </if>
      <if test="price != null">
        price = #{price,jdbcType=DECIMAL},
      </if>
      <if test="deliveryDays != null">
        delivery_days = #{deliveryDays,jdbcType=INTEGER},
      </if>
      <if test="inboundDays != null">
        inbound_days = #{inboundDays,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="paymentType != null">
        payment_type = #{paymentType,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <insert id="upsert" parameterType="com.bailuntec.domain.entity.DcAveragePurchase">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      @project https://github.com/itfsw/mybatis-generator-plugin
    -->
    insert into dc_average_purchase
    (ID, bailun_sku, warehouse_code, supplier_id, supplier_name, price, delivery_days, 
      inbound_days, update_time, payment_type)
    values
    (#{id,jdbcType=INTEGER}, #{bailunSku,jdbcType=VARCHAR}, #{warehouseCode,jdbcType=VARCHAR}, 
      #{supplierId,jdbcType=INTEGER}, #{supplierName,jdbcType=VARCHAR}, #{price,jdbcType=DECIMAL}, 
      #{deliveryDays,jdbcType=INTEGER}, #{inboundDays,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, 
      #{paymentType,jdbcType=TINYINT})
    on duplicate key update 
    ID = #{id,jdbcType=INTEGER}, 
    bailun_sku = #{bailunSku,jdbcType=VARCHAR}, 
    warehouse_code = #{warehouseCode,jdbcType=VARCHAR}, 
    supplier_id = #{supplierId,jdbcType=INTEGER}, 
    supplier_name = #{supplierName,jdbcType=VARCHAR}, 
    price = #{price,jdbcType=DECIMAL}, 
    delivery_days = #{deliveryDays,jdbcType=INTEGER}, 
    inbound_days = #{inboundDays,jdbcType=INTEGER}, 
    update_time = #{updateTime,jdbcType=TIMESTAMP}, 
    payment_type = #{paymentType,jdbcType=TINYINT}
  </insert>
  <select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcAveragePurchaseExample" 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 dc_average_purchase
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    limit 1
  </select>
</mapper>