<?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.invoice.supplier.InvoiceApplySupplierXGoodsMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.invoice.supplier.InvoiceApplySupplierXGoods">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="accounting_order_id" jdbcType="BIGINT" property="accountingOrderId" />
    <result column="accounting_order_sn" jdbcType="VARCHAR" property="accountingOrderSn" />
    <result column="accounting_order_type" jdbcType="TINYINT" property="accountingOrderType" />
    <result column="dim_create_by" jdbcType="TINYINT" property="dimCreateBy" />
    <result column="invoice_apply_id" jdbcType="BIGINT" property="invoiceApplyId" />
    <result column="invoice_apply_sn" jdbcType="VARCHAR" property="invoiceApplySn" />
    <result column="unified_order_id" jdbcType="BIGINT" property="unifiedOrderId" />
    <result column="order_sn" jdbcType="VARCHAR" property="orderSn" />
    <result column="unified_order_goods_id" jdbcType="BIGINT" property="unifiedOrderGoodsId" />
    <result column="goods_id" jdbcType="BIGINT" property="goodsId" />
    <result column="back_status" jdbcType="TINYINT" property="backStatus" />
    <result column="bank_id" jdbcType="BIGINT" property="bankId" />
    <result column="back_time" jdbcType="TIMESTAMP" property="backTime" />
    <result column="deleted" jdbcType="TINYINT" property="deleted" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <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">
    <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">
    id, accounting_order_id, accounting_order_sn, accounting_order_type, dim_create_by, 
    invoice_apply_id, invoice_apply_sn, unified_order_id, order_sn, unified_order_goods_id, 
    goods_id, back_status, bank_id, back_time, deleted
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.invoice.supplier.InvoiceApplySupplierXGoodsExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from invoice_apply_supplier_x_goods
    <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">
    select 
    <include refid="Base_Column_List" />
    from invoice_apply_supplier_x_goods
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from invoice_apply_supplier_x_goods
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.invoice.supplier.InvoiceApplySupplierXGoodsExample">
    delete from invoice_apply_supplier_x_goods
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.invoice.supplier.InvoiceApplySupplierXGoods">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into invoice_apply_supplier_x_goods (accounting_order_id, accounting_order_sn, 
      accounting_order_type, dim_create_by, invoice_apply_id, 
      invoice_apply_sn, unified_order_id, order_sn, 
      unified_order_goods_id, goods_id, back_status, 
      bank_id, back_time, deleted
      )
    values (#{accountingOrderId,jdbcType=BIGINT}, #{accountingOrderSn,jdbcType=VARCHAR}, 
      #{accountingOrderType,jdbcType=TINYINT}, #{dimCreateBy,jdbcType=TINYINT}, #{invoiceApplyId,jdbcType=BIGINT}, 
      #{invoiceApplySn,jdbcType=VARCHAR}, #{unifiedOrderId,jdbcType=BIGINT}, #{orderSn,jdbcType=VARCHAR}, 
      #{unifiedOrderGoodsId,jdbcType=BIGINT}, #{goodsId,jdbcType=BIGINT}, #{backStatus,jdbcType=TINYINT}, 
      #{bankId,jdbcType=BIGINT}, #{backTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=TINYINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.invoice.supplier.InvoiceApplySupplierXGoods">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into invoice_apply_supplier_x_goods
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="accountingOrderId != null">
        accounting_order_id,
      </if>
      <if test="accountingOrderSn != null">
        accounting_order_sn,
      </if>
      <if test="accountingOrderType != null">
        accounting_order_type,
      </if>
      <if test="dimCreateBy != null">
        dim_create_by,
      </if>
      <if test="invoiceApplyId != null">
        invoice_apply_id,
      </if>
      <if test="invoiceApplySn != null">
        invoice_apply_sn,
      </if>
      <if test="unifiedOrderId != null">
        unified_order_id,
      </if>
      <if test="orderSn != null">
        order_sn,
      </if>
      <if test="unifiedOrderGoodsId != null">
        unified_order_goods_id,
      </if>
      <if test="goodsId != null">
        goods_id,
      </if>
      <if test="backStatus != null">
        back_status,
      </if>
      <if test="bankId != null">
        bank_id,
      </if>
      <if test="backTime != null">
        back_time,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="accountingOrderId != null">
        #{accountingOrderId,jdbcType=BIGINT},
      </if>
      <if test="accountingOrderSn != null">
        #{accountingOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="accountingOrderType != null">
        #{accountingOrderType,jdbcType=TINYINT},
      </if>
      <if test="dimCreateBy != null">
        #{dimCreateBy,jdbcType=TINYINT},
      </if>
      <if test="invoiceApplyId != null">
        #{invoiceApplyId,jdbcType=BIGINT},
      </if>
      <if test="invoiceApplySn != null">
        #{invoiceApplySn,jdbcType=VARCHAR},
      </if>
      <if test="unifiedOrderId != null">
        #{unifiedOrderId,jdbcType=BIGINT},
      </if>
      <if test="orderSn != null">
        #{orderSn,jdbcType=VARCHAR},
      </if>
      <if test="unifiedOrderGoodsId != null">
        #{unifiedOrderGoodsId,jdbcType=BIGINT},
      </if>
      <if test="goodsId != null">
        #{goodsId,jdbcType=BIGINT},
      </if>
      <if test="backStatus != null">
        #{backStatus,jdbcType=TINYINT},
      </if>
      <if test="bankId != null">
        #{bankId,jdbcType=BIGINT},
      </if>
      <if test="backTime != null">
        #{backTime,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.invoice.supplier.InvoiceApplySupplierXGoodsExample" resultType="java.lang.Long">
    select count(*) from invoice_apply_supplier_x_goods
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update invoice_apply_supplier_x_goods
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </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.accountingOrderType != null">
        accounting_order_type = #{record.accountingOrderType,jdbcType=TINYINT},
      </if>
      <if test="record.dimCreateBy != null">
        dim_create_by = #{record.dimCreateBy,jdbcType=TINYINT},
      </if>
      <if test="record.invoiceApplyId != null">
        invoice_apply_id = #{record.invoiceApplyId,jdbcType=BIGINT},
      </if>
      <if test="record.invoiceApplySn != null">
        invoice_apply_sn = #{record.invoiceApplySn,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.unifiedOrderGoodsId != null">
        unified_order_goods_id = #{record.unifiedOrderGoodsId,jdbcType=BIGINT},
      </if>
      <if test="record.goodsId != null">
        goods_id = #{record.goodsId,jdbcType=BIGINT},
      </if>
      <if test="record.backStatus != null">
        back_status = #{record.backStatus,jdbcType=TINYINT},
      </if>
      <if test="record.bankId != null">
        bank_id = #{record.bankId,jdbcType=BIGINT},
      </if>
      <if test="record.backTime != null">
        back_time = #{record.backTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.deleted != null">
        deleted = #{record.deleted,jdbcType=TINYINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update invoice_apply_supplier_x_goods
    set id = #{record.id,jdbcType=BIGINT},
      accounting_order_id = #{record.accountingOrderId,jdbcType=BIGINT},
      accounting_order_sn = #{record.accountingOrderSn,jdbcType=VARCHAR},
      accounting_order_type = #{record.accountingOrderType,jdbcType=TINYINT},
      dim_create_by = #{record.dimCreateBy,jdbcType=TINYINT},
      invoice_apply_id = #{record.invoiceApplyId,jdbcType=BIGINT},
      invoice_apply_sn = #{record.invoiceApplySn,jdbcType=VARCHAR},
      unified_order_id = #{record.unifiedOrderId,jdbcType=BIGINT},
      order_sn = #{record.orderSn,jdbcType=VARCHAR},
      unified_order_goods_id = #{record.unifiedOrderGoodsId,jdbcType=BIGINT},
      goods_id = #{record.goodsId,jdbcType=BIGINT},
      back_status = #{record.backStatus,jdbcType=TINYINT},
      bank_id = #{record.bankId,jdbcType=BIGINT},
      back_time = #{record.backTime,jdbcType=TIMESTAMP},
      deleted = #{record.deleted,jdbcType=TINYINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.invoice.supplier.InvoiceApplySupplierXGoods">
    update invoice_apply_supplier_x_goods
    <set>
      <if test="accountingOrderId != null">
        accounting_order_id = #{accountingOrderId,jdbcType=BIGINT},
      </if>
      <if test="accountingOrderSn != null">
        accounting_order_sn = #{accountingOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="accountingOrderType != null">
        accounting_order_type = #{accountingOrderType,jdbcType=TINYINT},
      </if>
      <if test="dimCreateBy != null">
        dim_create_by = #{dimCreateBy,jdbcType=TINYINT},
      </if>
      <if test="invoiceApplyId != null">
        invoice_apply_id = #{invoiceApplyId,jdbcType=BIGINT},
      </if>
      <if test="invoiceApplySn != null">
        invoice_apply_sn = #{invoiceApplySn,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="unifiedOrderGoodsId != null">
        unified_order_goods_id = #{unifiedOrderGoodsId,jdbcType=BIGINT},
      </if>
      <if test="goodsId != null">
        goods_id = #{goodsId,jdbcType=BIGINT},
      </if>
      <if test="backStatus != null">
        back_status = #{backStatus,jdbcType=TINYINT},
      </if>
      <if test="bankId != null">
        bank_id = #{bankId,jdbcType=BIGINT},
      </if>
      <if test="backTime != null">
        back_time = #{backTime,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=TINYINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.invoice.supplier.InvoiceApplySupplierXGoods">
    update invoice_apply_supplier_x_goods
    set accounting_order_id = #{accountingOrderId,jdbcType=BIGINT},
      accounting_order_sn = #{accountingOrderSn,jdbcType=VARCHAR},
      accounting_order_type = #{accountingOrderType,jdbcType=TINYINT},
      dim_create_by = #{dimCreateBy,jdbcType=TINYINT},
      invoice_apply_id = #{invoiceApplyId,jdbcType=BIGINT},
      invoice_apply_sn = #{invoiceApplySn,jdbcType=VARCHAR},
      unified_order_id = #{unifiedOrderId,jdbcType=BIGINT},
      order_sn = #{orderSn,jdbcType=VARCHAR},
      unified_order_goods_id = #{unifiedOrderGoodsId,jdbcType=BIGINT},
      goods_id = #{goodsId,jdbcType=BIGINT},
      back_status = #{backStatus,jdbcType=TINYINT},
      bank_id = #{bankId,jdbcType=BIGINT},
      back_time = #{backTime,jdbcType=TIMESTAMP},
      deleted = #{deleted,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>