<?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.thirdpart.jd.AccountingUnifiedSupplierOrderJdCheckUpReportXGoodsMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.thirdpart.jd.AccountingUnifiedSupplierOrderJdCheckUpReportXGoods">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="dim_create_by" jdbcType="TINYINT" property="dimCreateBy" />
    <result column="batch_id" jdbcType="VARCHAR" property="batchId" />
    <result column="accounting_unified_supplier_order_jd_id" jdbcType="BIGINT" property="accountingUnifiedSupplierOrderJdId" />
    <result column="accounting_order_id" jdbcType="BIGINT" property="accountingOrderId" />
    <result column="accounting_order_sn" jdbcType="VARCHAR" property="accountingOrderSn" />
    <result column="doggod_order_sn_as_whole" jdbcType="VARCHAR" property="doggodOrderSnAsWhole" />
    <result column="doggod_order_accounting_state_supplier" jdbcType="TINYINT" property="doggodOrderAccountingStateSupplier" />
    <result column="doggod_goods_accounting_state_supplier" jdbcType="TINYINT" property="doggodGoodsAccountingStateSupplier" />
    <result column="process_result" jdbcType="TINYINT" property="processResult" />
    <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="goods_quantity" jdbcType="INTEGER" property="goodsQuantity" />
    <result column="goods_cost_price" jdbcType="DECIMAL" property="goodsCostPrice" />
    <result column="goods_cost_amount" jdbcType="DECIMAL" property="goodsCostAmount" />
    <result column="out_snapshot_order_goods_id" jdbcType="BIGINT" property="outSnapshotOrderGoodsId" />
    <result column="unified_order_credit_id" jdbcType="BIGINT" property="unifiedOrderCreditId" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="create_user_id" jdbcType="BIGINT" property="createUserId" />
  </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, dim_create_by, batch_id, accounting_unified_supplier_order_jd_id, accounting_order_id, 
    accounting_order_sn, doggod_order_sn_as_whole, doggod_order_accounting_state_supplier, 
    doggod_goods_accounting_state_supplier, process_result, unified_order_id, order_sn, 
    unified_order_goods_id, goods_id, goods_quantity, goods_cost_price, goods_cost_amount, 
    out_snapshot_order_goods_id, unified_order_credit_id, create_time, create_user_id
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.jd.AccountingUnifiedSupplierOrderJdCheckUpReportXGoodsExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from accounting_unified_supplier_order_jd_check_up_report_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 accounting_unified_supplier_order_jd_check_up_report_x_goods
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from accounting_unified_supplier_order_jd_check_up_report_x_goods
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.jd.AccountingUnifiedSupplierOrderJdCheckUpReportXGoodsExample">
    delete from accounting_unified_supplier_order_jd_check_up_report_x_goods
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.jd.AccountingUnifiedSupplierOrderJdCheckUpReportXGoods">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into accounting_unified_supplier_order_jd_check_up_report_x_goods (dim_create_by, batch_id, accounting_unified_supplier_order_jd_id, 
      accounting_order_id, accounting_order_sn, doggod_order_sn_as_whole, 
      doggod_order_accounting_state_supplier, doggod_goods_accounting_state_supplier, 
      process_result, unified_order_id, order_sn, 
      unified_order_goods_id, goods_id, goods_quantity, 
      goods_cost_price, goods_cost_amount, out_snapshot_order_goods_id, 
      unified_order_credit_id, create_time, create_user_id
      )
    values (#{dimCreateBy,jdbcType=TINYINT}, #{batchId,jdbcType=VARCHAR}, #{accountingUnifiedSupplierOrderJdId,jdbcType=BIGINT}, 
      #{accountingOrderId,jdbcType=BIGINT}, #{accountingOrderSn,jdbcType=VARCHAR}, #{doggodOrderSnAsWhole,jdbcType=VARCHAR}, 
      #{doggodOrderAccountingStateSupplier,jdbcType=TINYINT}, #{doggodGoodsAccountingStateSupplier,jdbcType=TINYINT}, 
      #{processResult,jdbcType=TINYINT}, #{unifiedOrderId,jdbcType=BIGINT}, #{orderSn,jdbcType=VARCHAR}, 
      #{unifiedOrderGoodsId,jdbcType=BIGINT}, #{goodsId,jdbcType=BIGINT}, #{goodsQuantity,jdbcType=INTEGER}, 
      #{goodsCostPrice,jdbcType=DECIMAL}, #{goodsCostAmount,jdbcType=DECIMAL}, #{outSnapshotOrderGoodsId,jdbcType=BIGINT}, 
      #{unifiedOrderCreditId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{createUserId,jdbcType=BIGINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.jd.AccountingUnifiedSupplierOrderJdCheckUpReportXGoods">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into accounting_unified_supplier_order_jd_check_up_report_x_goods
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="dimCreateBy != null">
        dim_create_by,
      </if>
      <if test="batchId != null">
        batch_id,
      </if>
      <if test="accountingUnifiedSupplierOrderJdId != null">
        accounting_unified_supplier_order_jd_id,
      </if>
      <if test="accountingOrderId != null">
        accounting_order_id,
      </if>
      <if test="accountingOrderSn != null">
        accounting_order_sn,
      </if>
      <if test="doggodOrderSnAsWhole != null">
        doggod_order_sn_as_whole,
      </if>
      <if test="doggodOrderAccountingStateSupplier != null">
        doggod_order_accounting_state_supplier,
      </if>
      <if test="doggodGoodsAccountingStateSupplier != null">
        doggod_goods_accounting_state_supplier,
      </if>
      <if test="processResult != null">
        process_result,
      </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="goodsQuantity != null">
        goods_quantity,
      </if>
      <if test="goodsCostPrice != null">
        goods_cost_price,
      </if>
      <if test="goodsCostAmount != null">
        goods_cost_amount,
      </if>
      <if test="outSnapshotOrderGoodsId != null">
        out_snapshot_order_goods_id,
      </if>
      <if test="unifiedOrderCreditId != null">
        unified_order_credit_id,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="createUserId != null">
        create_user_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="dimCreateBy != null">
        #{dimCreateBy,jdbcType=TINYINT},
      </if>
      <if test="batchId != null">
        #{batchId,jdbcType=VARCHAR},
      </if>
      <if test="accountingUnifiedSupplierOrderJdId != null">
        #{accountingUnifiedSupplierOrderJdId,jdbcType=BIGINT},
      </if>
      <if test="accountingOrderId != null">
        #{accountingOrderId,jdbcType=BIGINT},
      </if>
      <if test="accountingOrderSn != null">
        #{accountingOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="doggodOrderSnAsWhole != null">
        #{doggodOrderSnAsWhole,jdbcType=VARCHAR},
      </if>
      <if test="doggodOrderAccountingStateSupplier != null">
        #{doggodOrderAccountingStateSupplier,jdbcType=TINYINT},
      </if>
      <if test="doggodGoodsAccountingStateSupplier != null">
        #{doggodGoodsAccountingStateSupplier,jdbcType=TINYINT},
      </if>
      <if test="processResult != null">
        #{processResult,jdbcType=TINYINT},
      </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="goodsQuantity != null">
        #{goodsQuantity,jdbcType=INTEGER},
      </if>
      <if test="goodsCostPrice != null">
        #{goodsCostPrice,jdbcType=DECIMAL},
      </if>
      <if test="goodsCostAmount != null">
        #{goodsCostAmount,jdbcType=DECIMAL},
      </if>
      <if test="outSnapshotOrderGoodsId != null">
        #{outSnapshotOrderGoodsId,jdbcType=BIGINT},
      </if>
      <if test="unifiedOrderCreditId != null">
        #{unifiedOrderCreditId,jdbcType=BIGINT},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUserId != null">
        #{createUserId,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.jd.AccountingUnifiedSupplierOrderJdCheckUpReportXGoodsExample" resultType="java.lang.Long">
    select count(*) from accounting_unified_supplier_order_jd_check_up_report_x_goods
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update accounting_unified_supplier_order_jd_check_up_report_x_goods
    <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.batchId != null">
        batch_id = #{record.batchId,jdbcType=VARCHAR},
      </if>
      <if test="record.accountingUnifiedSupplierOrderJdId != null">
        accounting_unified_supplier_order_jd_id = #{record.accountingUnifiedSupplierOrderJdId,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.doggodOrderSnAsWhole != null">
        doggod_order_sn_as_whole = #{record.doggodOrderSnAsWhole,jdbcType=VARCHAR},
      </if>
      <if test="record.doggodOrderAccountingStateSupplier != null">
        doggod_order_accounting_state_supplier = #{record.doggodOrderAccountingStateSupplier,jdbcType=TINYINT},
      </if>
      <if test="record.doggodGoodsAccountingStateSupplier != null">
        doggod_goods_accounting_state_supplier = #{record.doggodGoodsAccountingStateSupplier,jdbcType=TINYINT},
      </if>
      <if test="record.processResult != null">
        process_result = #{record.processResult,jdbcType=TINYINT},
      </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.goodsQuantity != null">
        goods_quantity = #{record.goodsQuantity,jdbcType=INTEGER},
      </if>
      <if test="record.goodsCostPrice != null">
        goods_cost_price = #{record.goodsCostPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.goodsCostAmount != null">
        goods_cost_amount = #{record.goodsCostAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.outSnapshotOrderGoodsId != null">
        out_snapshot_order_goods_id = #{record.outSnapshotOrderGoodsId,jdbcType=BIGINT},
      </if>
      <if test="record.unifiedOrderCreditId != null">
        unified_order_credit_id = #{record.unifiedOrderCreditId,jdbcType=BIGINT},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createUserId != null">
        create_user_id = #{record.createUserId,jdbcType=BIGINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update accounting_unified_supplier_order_jd_check_up_report_x_goods
    set id = #{record.id,jdbcType=BIGINT},
      dim_create_by = #{record.dimCreateBy,jdbcType=TINYINT},
      batch_id = #{record.batchId,jdbcType=VARCHAR},
      accounting_unified_supplier_order_jd_id = #{record.accountingUnifiedSupplierOrderJdId,jdbcType=BIGINT},
      accounting_order_id = #{record.accountingOrderId,jdbcType=BIGINT},
      accounting_order_sn = #{record.accountingOrderSn,jdbcType=VARCHAR},
      doggod_order_sn_as_whole = #{record.doggodOrderSnAsWhole,jdbcType=VARCHAR},
      doggod_order_accounting_state_supplier = #{record.doggodOrderAccountingStateSupplier,jdbcType=TINYINT},
      doggod_goods_accounting_state_supplier = #{record.doggodGoodsAccountingStateSupplier,jdbcType=TINYINT},
      process_result = #{record.processResult,jdbcType=TINYINT},
      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},
      goods_quantity = #{record.goodsQuantity,jdbcType=INTEGER},
      goods_cost_price = #{record.goodsCostPrice,jdbcType=DECIMAL},
      goods_cost_amount = #{record.goodsCostAmount,jdbcType=DECIMAL},
      out_snapshot_order_goods_id = #{record.outSnapshotOrderGoodsId,jdbcType=BIGINT},
      unified_order_credit_id = #{record.unifiedOrderCreditId,jdbcType=BIGINT},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      create_user_id = #{record.createUserId,jdbcType=BIGINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.jd.AccountingUnifiedSupplierOrderJdCheckUpReportXGoods">
    update accounting_unified_supplier_order_jd_check_up_report_x_goods
    <set>
      <if test="dimCreateBy != null">
        dim_create_by = #{dimCreateBy,jdbcType=TINYINT},
      </if>
      <if test="batchId != null">
        batch_id = #{batchId,jdbcType=VARCHAR},
      </if>
      <if test="accountingUnifiedSupplierOrderJdId != null">
        accounting_unified_supplier_order_jd_id = #{accountingUnifiedSupplierOrderJdId,jdbcType=BIGINT},
      </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="doggodOrderSnAsWhole != null">
        doggod_order_sn_as_whole = #{doggodOrderSnAsWhole,jdbcType=VARCHAR},
      </if>
      <if test="doggodOrderAccountingStateSupplier != null">
        doggod_order_accounting_state_supplier = #{doggodOrderAccountingStateSupplier,jdbcType=TINYINT},
      </if>
      <if test="doggodGoodsAccountingStateSupplier != null">
        doggod_goods_accounting_state_supplier = #{doggodGoodsAccountingStateSupplier,jdbcType=TINYINT},
      </if>
      <if test="processResult != null">
        process_result = #{processResult,jdbcType=TINYINT},
      </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="goodsQuantity != null">
        goods_quantity = #{goodsQuantity,jdbcType=INTEGER},
      </if>
      <if test="goodsCostPrice != null">
        goods_cost_price = #{goodsCostPrice,jdbcType=DECIMAL},
      </if>
      <if test="goodsCostAmount != null">
        goods_cost_amount = #{goodsCostAmount,jdbcType=DECIMAL},
      </if>
      <if test="outSnapshotOrderGoodsId != null">
        out_snapshot_order_goods_id = #{outSnapshotOrderGoodsId,jdbcType=BIGINT},
      </if>
      <if test="unifiedOrderCreditId != null">
        unified_order_credit_id = #{unifiedOrderCreditId,jdbcType=BIGINT},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUserId != null">
        create_user_id = #{createUserId,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.jd.AccountingUnifiedSupplierOrderJdCheckUpReportXGoods">
    update accounting_unified_supplier_order_jd_check_up_report_x_goods
    set dim_create_by = #{dimCreateBy,jdbcType=TINYINT},
      batch_id = #{batchId,jdbcType=VARCHAR},
      accounting_unified_supplier_order_jd_id = #{accountingUnifiedSupplierOrderJdId,jdbcType=BIGINT},
      accounting_order_id = #{accountingOrderId,jdbcType=BIGINT},
      accounting_order_sn = #{accountingOrderSn,jdbcType=VARCHAR},
      doggod_order_sn_as_whole = #{doggodOrderSnAsWhole,jdbcType=VARCHAR},
      doggod_order_accounting_state_supplier = #{doggodOrderAccountingStateSupplier,jdbcType=TINYINT},
      doggod_goods_accounting_state_supplier = #{doggodGoodsAccountingStateSupplier,jdbcType=TINYINT},
      process_result = #{processResult,jdbcType=TINYINT},
      unified_order_id = #{unifiedOrderId,jdbcType=BIGINT},
      order_sn = #{orderSn,jdbcType=VARCHAR},
      unified_order_goods_id = #{unifiedOrderGoodsId,jdbcType=BIGINT},
      goods_id = #{goodsId,jdbcType=BIGINT},
      goods_quantity = #{goodsQuantity,jdbcType=INTEGER},
      goods_cost_price = #{goodsCostPrice,jdbcType=DECIMAL},
      goods_cost_amount = #{goodsCostAmount,jdbcType=DECIMAL},
      out_snapshot_order_goods_id = #{outSnapshotOrderGoodsId,jdbcType=BIGINT},
      unified_order_credit_id = #{unifiedOrderCreditId,jdbcType=BIGINT},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_user_id = #{createUserId,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>