<?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.goafanti.common.dao.TOrderDetailMapper">
  <resultMap id="BaseResultMap" type="com.goafanti.common.model.TOrderDetail">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Jan 20 15:19:07 CST 2018.
    -->
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
    <result column="commodity_id" jdbcType="VARCHAR" property="commodityId" />
    <result column="commodity_name" jdbcType="VARCHAR" property="commodityName" />
    <result column="commodity_quantity" jdbcType="INTEGER" property="commodityQuantity" />
    <result column="commodity_price" jdbcType="DECIMAL" property="commodityPrice" />
    <result column="commodity_first_payment" jdbcType="DECIMAL" property="commodityFirstPayment" />
    <result column="commodity_type" jdbcType="INTEGER" property="commodityType" />
    <result column="commodity_mode" jdbcType="VARCHAR" property="commodityMode" />
    <result column="discount_price" jdbcType="DECIMAL" property="discountPrice" />
    <result column="discount_first_payment" jdbcType="DECIMAL" property="discountFirstPayment" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
  </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 Sat Jan 20 15:19:07 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 Sat Jan 20 15:19:07 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 Sat Jan 20 15:19:07 CST 2018.
    -->
    id, order_no, commodity_id, commodity_name, commodity_quantity, commodity_price, 
    commodity_first_payment, commodity_type, commodity_mode, discount_price, discount_first_payment, 
    create_time, remarks
  </sql>
  <select id="selectByExample" parameterType="com.goafanti.common.model.TOrderDetailExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Jan 20 15:19:07 CST 2018.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from t_order_detail
    <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.String" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Jan 20 15:19:07 CST 2018.
    -->
    select 
    <include refid="Base_Column_List" />
    from t_order_detail
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Jan 20 15:19:07 CST 2018.
    -->
    delete from t_order_detail
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.goafanti.common.model.TOrderDetailExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Jan 20 15:19:07 CST 2018.
    -->
    delete from t_order_detail
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.goafanti.common.model.TOrderDetail">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Jan 20 15:19:07 CST 2018.
    -->
    insert into t_order_detail (id, order_no, commodity_id, 
      commodity_name, commodity_quantity, commodity_price, 
      commodity_first_payment, commodity_type, commodity_mode, 
      discount_price, discount_first_payment, create_time, 
      remarks)
    values (#{id,jdbcType=VARCHAR}, #{orderNo,jdbcType=VARCHAR}, #{commodityId,jdbcType=VARCHAR}, 
      #{commodityName,jdbcType=VARCHAR}, #{commodityQuantity,jdbcType=INTEGER}, #{commodityPrice,jdbcType=DECIMAL}, 
      #{commodityFirstPayment,jdbcType=DECIMAL}, #{commodityType,jdbcType=INTEGER}, #{commodityMode,jdbcType=VARCHAR}, 
      #{discountPrice,jdbcType=DECIMAL}, #{discountFirstPayment,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, 
      #{remarks,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderDetail">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Jan 20 15:19:07 CST 2018.
    -->
    insert into t_order_detail
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="orderNo != null">
        order_no,
      </if>
      <if test="commodityId != null">
        commodity_id,
      </if>
      <if test="commodityName != null">
        commodity_name,
      </if>
      <if test="commodityQuantity != null">
        commodity_quantity,
      </if>
      <if test="commodityPrice != null">
        commodity_price,
      </if>
      <if test="commodityFirstPayment != null">
        commodity_first_payment,
      </if>
      <if test="commodityType != null">
        commodity_type,
      </if>
      <if test="commodityMode != null">
        commodity_mode,
      </if>
      <if test="discountPrice != null">
        discount_price,
      </if>
      <if test="discountFirstPayment != null">
        discount_first_payment,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="remarks != null">
        remarks,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="orderNo != null">
        #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="commodityId != null">
        #{commodityId,jdbcType=VARCHAR},
      </if>
      <if test="commodityName != null">
        #{commodityName,jdbcType=VARCHAR},
      </if>
      <if test="commodityQuantity != null">
        #{commodityQuantity,jdbcType=INTEGER},
      </if>
      <if test="commodityPrice != null">
        #{commodityPrice,jdbcType=DECIMAL},
      </if>
      <if test="commodityFirstPayment != null">
        #{commodityFirstPayment,jdbcType=DECIMAL},
      </if>
      <if test="commodityType != null">
        #{commodityType,jdbcType=INTEGER},
      </if>
      <if test="commodityMode != null">
        #{commodityMode,jdbcType=VARCHAR},
      </if>
      <if test="discountPrice != null">
        #{discountPrice,jdbcType=DECIMAL},
      </if>
      <if test="discountFirstPayment != null">
        #{discountFirstPayment,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.goafanti.common.model.TOrderDetailExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Jan 20 15:19:07 CST 2018.
    -->
    select count(*) from t_order_detail
    <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 Sat Jan 20 15:19:07 CST 2018.
    -->
    update t_order_detail
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.orderNo != null">
        order_no = #{record.orderNo,jdbcType=VARCHAR},
      </if>
      <if test="record.commodityId != null">
        commodity_id = #{record.commodityId,jdbcType=VARCHAR},
      </if>
      <if test="record.commodityName != null">
        commodity_name = #{record.commodityName,jdbcType=VARCHAR},
      </if>
      <if test="record.commodityQuantity != null">
        commodity_quantity = #{record.commodityQuantity,jdbcType=INTEGER},
      </if>
      <if test="record.commodityPrice != null">
        commodity_price = #{record.commodityPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.commodityFirstPayment != null">
        commodity_first_payment = #{record.commodityFirstPayment,jdbcType=DECIMAL},
      </if>
      <if test="record.commodityType != null">
        commodity_type = #{record.commodityType,jdbcType=INTEGER},
      </if>
      <if test="record.commodityMode != null">
        commodity_mode = #{record.commodityMode,jdbcType=VARCHAR},
      </if>
      <if test="record.discountPrice != null">
        discount_price = #{record.discountPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.discountFirstPayment != null">
        discount_first_payment = #{record.discountFirstPayment,jdbcType=DECIMAL},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.remarks != null">
        remarks = #{record.remarks,jdbcType=VARCHAR},
      </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 Sat Jan 20 15:19:07 CST 2018.
    -->
    update t_order_detail
    set id = #{record.id,jdbcType=VARCHAR},
      order_no = #{record.orderNo,jdbcType=VARCHAR},
      commodity_id = #{record.commodityId,jdbcType=VARCHAR},
      commodity_name = #{record.commodityName,jdbcType=VARCHAR},
      commodity_quantity = #{record.commodityQuantity,jdbcType=INTEGER},
      commodity_price = #{record.commodityPrice,jdbcType=DECIMAL},
      commodity_first_payment = #{record.commodityFirstPayment,jdbcType=DECIMAL},
      commodity_type = #{record.commodityType,jdbcType=INTEGER},
      commodity_mode = #{record.commodityMode,jdbcType=VARCHAR},
      discount_price = #{record.discountPrice,jdbcType=DECIMAL},
      discount_first_payment = #{record.discountFirstPayment,jdbcType=DECIMAL},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      remarks = #{record.remarks,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderDetail">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Jan 20 15:19:07 CST 2018.
    -->
    update t_order_detail
    <set>
      <if test="orderNo != null">
        order_no = #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="commodityId != null">
        commodity_id = #{commodityId,jdbcType=VARCHAR},
      </if>
      <if test="commodityName != null">
        commodity_name = #{commodityName,jdbcType=VARCHAR},
      </if>
      <if test="commodityQuantity != null">
        commodity_quantity = #{commodityQuantity,jdbcType=INTEGER},
      </if>
      <if test="commodityPrice != null">
        commodity_price = #{commodityPrice,jdbcType=DECIMAL},
      </if>
      <if test="commodityFirstPayment != null">
        commodity_first_payment = #{commodityFirstPayment,jdbcType=DECIMAL},
      </if>
      <if test="commodityType != null">
        commodity_type = #{commodityType,jdbcType=INTEGER},
      </if>
      <if test="commodityMode != null">
        commodity_mode = #{commodityMode,jdbcType=VARCHAR},
      </if>
      <if test="discountPrice != null">
        discount_price = #{discountPrice,jdbcType=DECIMAL},
      </if>
      <if test="discountFirstPayment != null">
        discount_first_payment = #{discountFirstPayment,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="remarks != null">
        remarks = #{remarks,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TOrderDetail">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Sat Jan 20 15:19:07 CST 2018.
    -->
    update t_order_detail
    set order_no = #{orderNo,jdbcType=VARCHAR},
      commodity_id = #{commodityId,jdbcType=VARCHAR},
      commodity_name = #{commodityName,jdbcType=VARCHAR},
      commodity_quantity = #{commodityQuantity,jdbcType=INTEGER},
      commodity_price = #{commodityPrice,jdbcType=DECIMAL},
      commodity_first_payment = #{commodityFirstPayment,jdbcType=DECIMAL},
      commodity_type = #{commodityType,jdbcType=INTEGER},
      commodity_mode = #{commodityMode,jdbcType=VARCHAR},
      discount_price = #{discountPrice,jdbcType=DECIMAL},
      discount_first_payment = #{discountFirstPayment,jdbcType=DECIMAL},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      remarks = #{remarks,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>