<?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="cn.superdesk.uniorder.dao.mapper.accounting.unified.supplier.AccountingUnifiedSupplierOrderMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.accounting.unified.supplier.AccountingUnifiedSupplierOrder">
    <!--


      This element was generated on Mon Nov 02 15:41:15 CST 2020.
    -->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="dim_create_by" jdbcType="TINYINT" property="dimCreateBy" />
    <result column="accounting_order_id" jdbcType="BIGINT" property="accountingOrderId" />
    <result column="accounting_order_sn" jdbcType="VARCHAR" property="accountingOrderSn" />
    <result column="unified_order_id" jdbcType="BIGINT" property="unifiedOrderId" />
    <result column="order_sn" jdbcType="VARCHAR" property="orderSn" />
    <result column="amount" jdbcType="DECIMAL" property="amount" />
    <result column="cost_amount" jdbcType="DECIMAL" property="costAmount" />
    <result column="amount_with_freight" jdbcType="DECIMAL" property="amountWithFreight" />
    <result column="cost_amount_with_freight" jdbcType="DECIMAL" property="costAmountWithFreight" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--


      This element was generated on Mon Nov 02 15:41:15 CST 2020.
    -->
    <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">
    <!--


      This element was generated on Mon Nov 02 15:41:15 CST 2020.
    -->
    <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">
    <!--


      This element was generated on Mon Nov 02 15:41:15 CST 2020.
    -->
    id, dim_create_by, accounting_order_id, accounting_order_sn, unified_order_id, order_sn, 
    amount, cost_amount, amount_with_freight, cost_amount_with_freight
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.accounting.unified.supplier.AccountingUnifiedSupplierOrderExample" resultMap="BaseResultMap">
    <!--


      This element was generated on Mon Nov 02 15:41:15 CST 2020.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from accounting_unified_supplier_order
    <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.Long" resultMap="BaseResultMap">
    <!--


      This element was generated on Mon Nov 02 15:41:15 CST 2020.
    -->
    select 
    <include refid="Base_Column_List" />
    from accounting_unified_supplier_order
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--


      This element was generated on Mon Nov 02 15:41:15 CST 2020.
    -->
    delete from accounting_unified_supplier_order
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.accounting.unified.supplier.AccountingUnifiedSupplierOrderExample">
    <!--


      This element was generated on Mon Nov 02 15:41:15 CST 2020.
    -->
    delete from accounting_unified_supplier_order
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.accounting.unified.supplier.AccountingUnifiedSupplierOrder">
    <!--


      This element was generated on Mon Nov 02 15:41:15 CST 2020.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into accounting_unified_supplier_order (dim_create_by, accounting_order_id, accounting_order_sn, 
      unified_order_id, order_sn, amount, 
      cost_amount, amount_with_freight, cost_amount_with_freight
      )
    values (#{dimCreateBy,jdbcType=TINYINT}, #{accountingOrderId,jdbcType=BIGINT}, #{accountingOrderSn,jdbcType=VARCHAR}, 
      #{unifiedOrderId,jdbcType=BIGINT}, #{orderSn,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL}, 
      #{costAmount,jdbcType=DECIMAL}, #{amountWithFreight,jdbcType=DECIMAL}, #{costAmountWithFreight,jdbcType=DECIMAL}
      )
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.accounting.unified.supplier.AccountingUnifiedSupplierOrder">
    <!--


      This element was generated on Mon Nov 02 15:41:15 CST 2020.
    -->
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into accounting_unified_supplier_order
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="dimCreateBy != null">
        dim_create_by,
      </if>
      <if test="accountingOrderId != null">
        accounting_order_id,
      </if>
      <if test="accountingOrderSn != null">
        accounting_order_sn,
      </if>
      <if test="unifiedOrderId != null">
        unified_order_id,
      </if>
      <if test="orderSn != null">
        order_sn,
      </if>
      <if test="amount != null">
        amount,
      </if>
      <if test="costAmount != null">
        cost_amount,
      </if>
      <if test="amountWithFreight != null">
        amount_with_freight,
      </if>
      <if test="costAmountWithFreight != null">
        cost_amount_with_freight,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="dimCreateBy != null">
        #{dimCreateBy,jdbcType=TINYINT},
      </if>
      <if test="accountingOrderId != null">
        #{accountingOrderId,jdbcType=BIGINT},
      </if>
      <if test="accountingOrderSn != null">
        #{accountingOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="unifiedOrderId != null">
        #{unifiedOrderId,jdbcType=BIGINT},
      </if>
      <if test="orderSn != null">
        #{orderSn,jdbcType=VARCHAR},
      </if>
      <if test="amount != null">
        #{amount,jdbcType=DECIMAL},
      </if>
      <if test="costAmount != null">
        #{costAmount,jdbcType=DECIMAL},
      </if>
      <if test="amountWithFreight != null">
        #{amountWithFreight,jdbcType=DECIMAL},
      </if>
      <if test="costAmountWithFreight != null">
        #{costAmountWithFreight,jdbcType=DECIMAL},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.accounting.unified.supplier.AccountingUnifiedSupplierOrderExample" resultType="java.lang.Long">
    <!--


      This element was generated on Mon Nov 02 15:41:15 CST 2020.
    -->
    select count(*) from accounting_unified_supplier_order
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--


      This element was generated on Mon Nov 02 15:41:15 CST 2020.
    -->
    update accounting_unified_supplier_order
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.dimCreateBy != null">
        dim_create_by = #{record.dimCreateBy,jdbcType=TINYINT},
      </if>
      <if test="record.accountingOrderId != null">
        accounting_order_id = #{record.accountingOrderId,jdbcType=BIGINT},
      </if>
      <if test="record.accountingOrderSn != null">
        accounting_order_sn = #{record.accountingOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="record.unifiedOrderId != null">
        unified_order_id = #{record.unifiedOrderId,jdbcType=BIGINT},
      </if>
      <if test="record.orderSn != null">
        order_sn = #{record.orderSn,jdbcType=VARCHAR},
      </if>
      <if test="record.amount != null">
        amount = #{record.amount,jdbcType=DECIMAL},
      </if>
      <if test="record.costAmount != null">
        cost_amount = #{record.costAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.amountWithFreight != null">
        amount_with_freight = #{record.amountWithFreight,jdbcType=DECIMAL},
      </if>
      <if test="record.costAmountWithFreight != null">
        cost_amount_with_freight = #{record.costAmountWithFreight,jdbcType=DECIMAL},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--


      This element was generated on Mon Nov 02 15:41:15 CST 2020.
    -->
    update accounting_unified_supplier_order
    set id = #{record.id,jdbcType=BIGINT},
      dim_create_by = #{record.dimCreateBy,jdbcType=TINYINT},
      accounting_order_id = #{record.accountingOrderId,jdbcType=BIGINT},
      accounting_order_sn = #{record.accountingOrderSn,jdbcType=VARCHAR},
      unified_order_id = #{record.unifiedOrderId,jdbcType=BIGINT},
      order_sn = #{record.orderSn,jdbcType=VARCHAR},
      amount = #{record.amount,jdbcType=DECIMAL},
      cost_amount = #{record.costAmount,jdbcType=DECIMAL},
      amount_with_freight = #{record.amountWithFreight,jdbcType=DECIMAL},
      cost_amount_with_freight = #{record.costAmountWithFreight,jdbcType=DECIMAL}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.accounting.unified.supplier.AccountingUnifiedSupplierOrder">
    <!--


      This element was generated on Mon Nov 02 15:41:15 CST 2020.
    -->
    update accounting_unified_supplier_order
    <set>
      <if test="dimCreateBy != null">
        dim_create_by = #{dimCreateBy,jdbcType=TINYINT},
      </if>
      <if test="accountingOrderId != null">
        accounting_order_id = #{accountingOrderId,jdbcType=BIGINT},
      </if>
      <if test="accountingOrderSn != null">
        accounting_order_sn = #{accountingOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="unifiedOrderId != null">
        unified_order_id = #{unifiedOrderId,jdbcType=BIGINT},
      </if>
      <if test="orderSn != null">
        order_sn = #{orderSn,jdbcType=VARCHAR},
      </if>
      <if test="amount != null">
        amount = #{amount,jdbcType=DECIMAL},
      </if>
      <if test="costAmount != null">
        cost_amount = #{costAmount,jdbcType=DECIMAL},
      </if>
      <if test="amountWithFreight != null">
        amount_with_freight = #{amountWithFreight,jdbcType=DECIMAL},
      </if>
      <if test="costAmountWithFreight != null">
        cost_amount_with_freight = #{costAmountWithFreight,jdbcType=DECIMAL},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.accounting.unified.supplier.AccountingUnifiedSupplierOrder">
    <!--


      This element was generated on Mon Nov 02 15:41:15 CST 2020.
    -->
    update accounting_unified_supplier_order
    set dim_create_by = #{dimCreateBy,jdbcType=TINYINT},
      accounting_order_id = #{accountingOrderId,jdbcType=BIGINT},
      accounting_order_sn = #{accountingOrderSn,jdbcType=VARCHAR},
      unified_order_id = #{unifiedOrderId,jdbcType=BIGINT},
      order_sn = #{orderSn,jdbcType=VARCHAR},
      amount = #{amount,jdbcType=DECIMAL},
      cost_amount = #{costAmount,jdbcType=DECIMAL},
      amount_with_freight = #{amountWithFreight,jdbcType=DECIMAL},
      cost_amount_with_freight = #{costAmountWithFreight,jdbcType=DECIMAL}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>