<?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.neusoft.smart.pos.trade.persistent.mapper.BillDetailMapper">
  <resultMap id="BaseResultMap" type="com.neusoft.smart.pos.trade.persistent.domain.BillDetail">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="bill_number" jdbcType="VARCHAR" property="billNumber" />
    <result column="order_number" jdbcType="VARCHAR" property="orderNumber" />
    <result column="org_id" jdbcType="INTEGER" property="orgId" />
    <result column="shop_id" jdbcType="INTEGER" property="shopId" />
    <result column="serial_no" jdbcType="VARCHAR" property="serialNo" />
    <result column="device_name" jdbcType="VARCHAR" property="deviceName" />
    <result column="customer_number" jdbcType="VARCHAR" property="customerNumber" />
    <result column="seq_no" jdbcType="INTEGER" property="seqNo" />
    <result column="member_card_no" jdbcType="VARCHAR" property="memberCardNo" />
    <result column="member_name" jdbcType="VARCHAR" property="memberName" />
    <result column="card_num" jdbcType="VARCHAR" property="cardNum" />
    <result column="card_hid_code" jdbcType="VARCHAR" property="cardHidCode" />
    <result column="order_amount" jdbcType="DECIMAL" property="orderAmount" />
    <result column="real_pay_amount" jdbcType="DECIMAL" property="realPayAmount" />
    <result column="discount_amount" jdbcType="DECIMAL" property="discountAmount" />
    <result column="pay_type" jdbcType="VARCHAR" property="payType" />
    <result column="paid_time" jdbcType="TIMESTAMP" property="paidTime" />
    <result column="order_type" jdbcType="VARCHAR" property="orderType" />
    <result column="location_no" jdbcType="VARCHAR" property="locationNo" />
    <result column="retrvl_ref_no" jdbcType="VARCHAR" property="retrvlRefNo" />
    <result column="ori_trace_no" jdbcType="VARCHAR" property="oriTraceNo" />
    <result column="trans_date" jdbcType="VARCHAR" property="transDate" />
    <result column="ori_batch_no" jdbcType="VARCHAR" property="oriBatchNo" />
    <result column="score" jdbcType="INTEGER" property="score" />
    <result column="version" jdbcType="INTEGER" property="version" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
    <result column="created_by" jdbcType="VARCHAR" property="createdBy" />
    <result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
    <result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
  </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, bill_number, order_number, org_id, shop_id, serial_no, device_name, customer_number, 
    seq_no, member_card_no, member_name, card_num, card_hid_code, order_amount, real_pay_amount, 
    discount_amount, pay_type, paid_time, order_type, location_no, retrvl_ref_no, ori_trace_no, 
    trans_date, ori_batch_no, score, version, remark, created_at, created_by, updated_by, 
    updated_at
  </sql>
  <select id="selectByExample" parameterType="com.neusoft.smart.pos.trade.persistent.domain.BillDetailExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from bill_detail
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    <if test="offset != null and limit != null">
      limit ${offset}, ${limit}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from bill_detail
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from bill_detail
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.neusoft.smart.pos.trade.persistent.domain.BillDetailExample">
    delete from bill_detail
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.trade.persistent.domain.BillDetail" useGeneratedKeys="true">
    insert into bill_detail (bill_number, order_number, org_id, 
      shop_id, serial_no, device_name, 
      customer_number, seq_no, member_card_no, 
      member_name, card_num, card_hid_code, 
      order_amount, real_pay_amount, discount_amount, 
      pay_type, paid_time, order_type, 
      location_no, retrvl_ref_no, ori_trace_no, 
      trans_date, ori_batch_no, score, 
      version, remark, created_at, 
      created_by, updated_by, updated_at
      )
    values (#{billNumber,jdbcType=VARCHAR}, #{orderNumber,jdbcType=VARCHAR}, #{orgId,jdbcType=INTEGER}, 
      #{shopId,jdbcType=INTEGER}, #{serialNo,jdbcType=VARCHAR}, #{deviceName,jdbcType=VARCHAR}, 
      #{customerNumber,jdbcType=VARCHAR}, #{seqNo,jdbcType=INTEGER}, #{memberCardNo,jdbcType=VARCHAR}, 
      #{memberName,jdbcType=VARCHAR}, #{cardNum,jdbcType=VARCHAR}, #{cardHidCode,jdbcType=VARCHAR}, 
      #{orderAmount,jdbcType=DECIMAL}, #{realPayAmount,jdbcType=DECIMAL}, #{discountAmount,jdbcType=DECIMAL}, 
      #{payType,jdbcType=VARCHAR}, #{paidTime,jdbcType=TIMESTAMP}, #{orderType,jdbcType=VARCHAR}, 
      #{locationNo,jdbcType=VARCHAR}, #{retrvlRefNo,jdbcType=VARCHAR}, #{oriTraceNo,jdbcType=VARCHAR}, 
      #{transDate,jdbcType=VARCHAR}, #{oriBatchNo,jdbcType=VARCHAR}, #{score,jdbcType=INTEGER}, 
      #{version,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, 
      #{createdBy,jdbcType=VARCHAR}, #{updatedBy,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.trade.persistent.domain.BillDetail" useGeneratedKeys="true">
    insert into bill_detail
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="billNumber != null">
        bill_number,
      </if>
      <if test="orderNumber != null">
        order_number,
      </if>
      <if test="orgId != null">
        org_id,
      </if>
      <if test="shopId != null">
        shop_id,
      </if>
      <if test="serialNo != null">
        serial_no,
      </if>
      <if test="deviceName != null">
        device_name,
      </if>
      <if test="customerNumber != null">
        customer_number,
      </if>
      <if test="seqNo != null">
        seq_no,
      </if>
      <if test="memberCardNo != null">
        member_card_no,
      </if>
      <if test="memberName != null">
        member_name,
      </if>
      <if test="cardNum != null">
        card_num,
      </if>
      <if test="cardHidCode != null">
        card_hid_code,
      </if>
      <if test="orderAmount != null">
        order_amount,
      </if>
      <if test="realPayAmount != null">
        real_pay_amount,
      </if>
      <if test="discountAmount != null">
        discount_amount,
      </if>
      <if test="payType != null">
        pay_type,
      </if>
      <if test="paidTime != null">
        paid_time,
      </if>
      <if test="orderType != null">
        order_type,
      </if>
      <if test="locationNo != null">
        location_no,
      </if>
      <if test="retrvlRefNo != null">
        retrvl_ref_no,
      </if>
      <if test="oriTraceNo != null">
        ori_trace_no,
      </if>
      <if test="transDate != null">
        trans_date,
      </if>
      <if test="oriBatchNo != null">
        ori_batch_no,
      </if>
      <if test="score != null">
        score,
      </if>
      <if test="version != null">
        version,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="createdAt != null">
        created_at,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
      <if test="updatedBy != null">
        updated_by,
      </if>
      <if test="updatedAt != null">
        updated_at,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="billNumber != null">
        #{billNumber,jdbcType=VARCHAR},
      </if>
      <if test="orderNumber != null">
        #{orderNumber,jdbcType=VARCHAR},
      </if>
      <if test="orgId != null">
        #{orgId,jdbcType=INTEGER},
      </if>
      <if test="shopId != null">
        #{shopId,jdbcType=INTEGER},
      </if>
      <if test="serialNo != null">
        #{serialNo,jdbcType=VARCHAR},
      </if>
      <if test="deviceName != null">
        #{deviceName,jdbcType=VARCHAR},
      </if>
      <if test="customerNumber != null">
        #{customerNumber,jdbcType=VARCHAR},
      </if>
      <if test="seqNo != null">
        #{seqNo,jdbcType=INTEGER},
      </if>
      <if test="memberCardNo != null">
        #{memberCardNo,jdbcType=VARCHAR},
      </if>
      <if test="memberName != null">
        #{memberName,jdbcType=VARCHAR},
      </if>
      <if test="cardNum != null">
        #{cardNum,jdbcType=VARCHAR},
      </if>
      <if test="cardHidCode != null">
        #{cardHidCode,jdbcType=VARCHAR},
      </if>
      <if test="orderAmount != null">
        #{orderAmount,jdbcType=DECIMAL},
      </if>
      <if test="realPayAmount != null">
        #{realPayAmount,jdbcType=DECIMAL},
      </if>
      <if test="discountAmount != null">
        #{discountAmount,jdbcType=DECIMAL},
      </if>
      <if test="payType != null">
        #{payType,jdbcType=VARCHAR},
      </if>
      <if test="paidTime != null">
        #{paidTime,jdbcType=TIMESTAMP},
      </if>
      <if test="orderType != null">
        #{orderType,jdbcType=VARCHAR},
      </if>
      <if test="locationNo != null">
        #{locationNo,jdbcType=VARCHAR},
      </if>
      <if test="retrvlRefNo != null">
        #{retrvlRefNo,jdbcType=VARCHAR},
      </if>
      <if test="oriTraceNo != null">
        #{oriTraceNo,jdbcType=VARCHAR},
      </if>
      <if test="transDate != null">
        #{transDate,jdbcType=VARCHAR},
      </if>
      <if test="oriBatchNo != null">
        #{oriBatchNo,jdbcType=VARCHAR},
      </if>
      <if test="score != null">
        #{score,jdbcType=INTEGER},
      </if>
      <if test="version != null">
        #{version,jdbcType=INTEGER},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedBy != null">
        #{updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedAt != null">
        #{updatedAt,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.neusoft.smart.pos.trade.persistent.domain.BillDetailExample" resultType="java.lang.Integer">
    select count(*) from bill_detail
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update bill_detail
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.billNumber != null">
        bill_number = #{record.billNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.orderNumber != null">
        order_number = #{record.orderNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.orgId != null">
        org_id = #{record.orgId,jdbcType=INTEGER},
      </if>
      <if test="record.shopId != null">
        shop_id = #{record.shopId,jdbcType=INTEGER},
      </if>
      <if test="record.serialNo != null">
        serial_no = #{record.serialNo,jdbcType=VARCHAR},
      </if>
      <if test="record.deviceName != null">
        device_name = #{record.deviceName,jdbcType=VARCHAR},
      </if>
      <if test="record.customerNumber != null">
        customer_number = #{record.customerNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.seqNo != null">
        seq_no = #{record.seqNo,jdbcType=INTEGER},
      </if>
      <if test="record.memberCardNo != null">
        member_card_no = #{record.memberCardNo,jdbcType=VARCHAR},
      </if>
      <if test="record.memberName != null">
        member_name = #{record.memberName,jdbcType=VARCHAR},
      </if>
      <if test="record.cardNum != null">
        card_num = #{record.cardNum,jdbcType=VARCHAR},
      </if>
      <if test="record.cardHidCode != null">
        card_hid_code = #{record.cardHidCode,jdbcType=VARCHAR},
      </if>
      <if test="record.orderAmount != null">
        order_amount = #{record.orderAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.realPayAmount != null">
        real_pay_amount = #{record.realPayAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.discountAmount != null">
        discount_amount = #{record.discountAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.payType != null">
        pay_type = #{record.payType,jdbcType=VARCHAR},
      </if>
      <if test="record.paidTime != null">
        paid_time = #{record.paidTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.orderType != null">
        order_type = #{record.orderType,jdbcType=VARCHAR},
      </if>
      <if test="record.locationNo != null">
        location_no = #{record.locationNo,jdbcType=VARCHAR},
      </if>
      <if test="record.retrvlRefNo != null">
        retrvl_ref_no = #{record.retrvlRefNo,jdbcType=VARCHAR},
      </if>
      <if test="record.oriTraceNo != null">
        ori_trace_no = #{record.oriTraceNo,jdbcType=VARCHAR},
      </if>
      <if test="record.transDate != null">
        trans_date = #{record.transDate,jdbcType=VARCHAR},
      </if>
      <if test="record.oriBatchNo != null">
        ori_batch_no = #{record.oriBatchNo,jdbcType=VARCHAR},
      </if>
      <if test="record.score != null">
        score = #{record.score,jdbcType=INTEGER},
      </if>
      <if test="record.version != null">
        version = #{record.version,jdbcType=INTEGER},
      </if>
      <if test="record.remark != null">
        remark = #{record.remark,jdbcType=VARCHAR},
      </if>
      <if test="record.createdAt != null">
        created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createdBy != null">
        created_by = #{record.createdBy,jdbcType=VARCHAR},
      </if>
      <if test="record.updatedBy != null">
        updated_by = #{record.updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="record.updatedAt != null">
        updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update bill_detail
    set id = #{record.id,jdbcType=INTEGER},
      bill_number = #{record.billNumber,jdbcType=VARCHAR},
      order_number = #{record.orderNumber,jdbcType=VARCHAR},
      org_id = #{record.orgId,jdbcType=INTEGER},
      shop_id = #{record.shopId,jdbcType=INTEGER},
      serial_no = #{record.serialNo,jdbcType=VARCHAR},
      device_name = #{record.deviceName,jdbcType=VARCHAR},
      customer_number = #{record.customerNumber,jdbcType=VARCHAR},
      seq_no = #{record.seqNo,jdbcType=INTEGER},
      member_card_no = #{record.memberCardNo,jdbcType=VARCHAR},
      member_name = #{record.memberName,jdbcType=VARCHAR},
      card_num = #{record.cardNum,jdbcType=VARCHAR},
      card_hid_code = #{record.cardHidCode,jdbcType=VARCHAR},
      order_amount = #{record.orderAmount,jdbcType=DECIMAL},
      real_pay_amount = #{record.realPayAmount,jdbcType=DECIMAL},
      discount_amount = #{record.discountAmount,jdbcType=DECIMAL},
      pay_type = #{record.payType,jdbcType=VARCHAR},
      paid_time = #{record.paidTime,jdbcType=TIMESTAMP},
      order_type = #{record.orderType,jdbcType=VARCHAR},
      location_no = #{record.locationNo,jdbcType=VARCHAR},
      retrvl_ref_no = #{record.retrvlRefNo,jdbcType=VARCHAR},
      ori_trace_no = #{record.oriTraceNo,jdbcType=VARCHAR},
      trans_date = #{record.transDate,jdbcType=VARCHAR},
      ori_batch_no = #{record.oriBatchNo,jdbcType=VARCHAR},
      score = #{record.score,jdbcType=INTEGER},
      version = #{record.version,jdbcType=INTEGER},
      remark = #{record.remark,jdbcType=VARCHAR},
      created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      created_by = #{record.createdBy,jdbcType=VARCHAR},
      updated_by = #{record.updatedBy,jdbcType=VARCHAR},
      updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.neusoft.smart.pos.trade.persistent.domain.BillDetail">
    update bill_detail
    <set>
      <if test="billNumber != null">
        bill_number = #{billNumber,jdbcType=VARCHAR},
      </if>
      <if test="orderNumber != null">
        order_number = #{orderNumber,jdbcType=VARCHAR},
      </if>
      <if test="orgId != null">
        org_id = #{orgId,jdbcType=INTEGER},
      </if>
      <if test="shopId != null">
        shop_id = #{shopId,jdbcType=INTEGER},
      </if>
      <if test="serialNo != null">
        serial_no = #{serialNo,jdbcType=VARCHAR},
      </if>
      <if test="deviceName != null">
        device_name = #{deviceName,jdbcType=VARCHAR},
      </if>
      <if test="customerNumber != null">
        customer_number = #{customerNumber,jdbcType=VARCHAR},
      </if>
      <if test="seqNo != null">
        seq_no = #{seqNo,jdbcType=INTEGER},
      </if>
      <if test="memberCardNo != null">
        member_card_no = #{memberCardNo,jdbcType=VARCHAR},
      </if>
      <if test="memberName != null">
        member_name = #{memberName,jdbcType=VARCHAR},
      </if>
      <if test="cardNum != null">
        card_num = #{cardNum,jdbcType=VARCHAR},
      </if>
      <if test="cardHidCode != null">
        card_hid_code = #{cardHidCode,jdbcType=VARCHAR},
      </if>
      <if test="orderAmount != null">
        order_amount = #{orderAmount,jdbcType=DECIMAL},
      </if>
      <if test="realPayAmount != null">
        real_pay_amount = #{realPayAmount,jdbcType=DECIMAL},
      </if>
      <if test="discountAmount != null">
        discount_amount = #{discountAmount,jdbcType=DECIMAL},
      </if>
      <if test="payType != null">
        pay_type = #{payType,jdbcType=VARCHAR},
      </if>
      <if test="paidTime != null">
        paid_time = #{paidTime,jdbcType=TIMESTAMP},
      </if>
      <if test="orderType != null">
        order_type = #{orderType,jdbcType=VARCHAR},
      </if>
      <if test="locationNo != null">
        location_no = #{locationNo,jdbcType=VARCHAR},
      </if>
      <if test="retrvlRefNo != null">
        retrvl_ref_no = #{retrvlRefNo,jdbcType=VARCHAR},
      </if>
      <if test="oriTraceNo != null">
        ori_trace_no = #{oriTraceNo,jdbcType=VARCHAR},
      </if>
      <if test="transDate != null">
        trans_date = #{transDate,jdbcType=VARCHAR},
      </if>
      <if test="oriBatchNo != null">
        ori_batch_no = #{oriBatchNo,jdbcType=VARCHAR},
      </if>
      <if test="score != null">
        score = #{score,jdbcType=INTEGER},
      </if>
      <if test="version != null">
        version = #{version,jdbcType=INTEGER},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        created_at = #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedBy != null">
        updated_by = #{updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedAt != null">
        updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.neusoft.smart.pos.trade.persistent.domain.BillDetail">
    update bill_detail
    set bill_number = #{billNumber,jdbcType=VARCHAR},
      order_number = #{orderNumber,jdbcType=VARCHAR},
      org_id = #{orgId,jdbcType=INTEGER},
      shop_id = #{shopId,jdbcType=INTEGER},
      serial_no = #{serialNo,jdbcType=VARCHAR},
      device_name = #{deviceName,jdbcType=VARCHAR},
      customer_number = #{customerNumber,jdbcType=VARCHAR},
      seq_no = #{seqNo,jdbcType=INTEGER},
      member_card_no = #{memberCardNo,jdbcType=VARCHAR},
      member_name = #{memberName,jdbcType=VARCHAR},
      card_num = #{cardNum,jdbcType=VARCHAR},
      card_hid_code = #{cardHidCode,jdbcType=VARCHAR},
      order_amount = #{orderAmount,jdbcType=DECIMAL},
      real_pay_amount = #{realPayAmount,jdbcType=DECIMAL},
      discount_amount = #{discountAmount,jdbcType=DECIMAL},
      pay_type = #{payType,jdbcType=VARCHAR},
      paid_time = #{paidTime,jdbcType=TIMESTAMP},
      order_type = #{orderType,jdbcType=VARCHAR},
      location_no = #{locationNo,jdbcType=VARCHAR},
      retrvl_ref_no = #{retrvlRefNo,jdbcType=VARCHAR},
      ori_trace_no = #{oriTraceNo,jdbcType=VARCHAR},
      trans_date = #{transDate,jdbcType=VARCHAR},
      ori_batch_no = #{oriBatchNo,jdbcType=VARCHAR},
      score = #{score,jdbcType=INTEGER},
      version = #{version,jdbcType=INTEGER},
      remark = #{remark,jdbcType=VARCHAR},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=VARCHAR},
      updated_by = #{updatedBy,jdbcType=VARCHAR},
      updated_at = #{updatedAt,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <insert id="batchInsert">
    <if test="items.get(0) != null">
            insert into bill_detail  (bill_number, order_number, org_id, 
        shop_id, serial_no, device_name, 
        customer_number, seq_no, member_card_no, 
        member_name, card_num, card_hid_code, 
        order_amount, real_pay_amount, discount_amount, 
        pay_type, paid_time, order_type, 
        location_no, retrvl_ref_no, ori_trace_no, 
        trans_date, ori_batch_no, score, 
        version, remark, created_at, 
        created_by, updated_by, updated_at
        )
      values
      <foreach collection="items" item="item" index="index" separator=",">
      (#{item.billNumber,jdbcType=VARCHAR}, #{item.orderNumber,jdbcType=VARCHAR}, #{item.orgId,jdbcType=INTEGER}, 
        #{item.shopId,jdbcType=INTEGER}, #{item.serialNo,jdbcType=VARCHAR}, #{item.deviceName,jdbcType=VARCHAR}, 
        #{item.customerNumber,jdbcType=VARCHAR}, #{item.seqNo,jdbcType=INTEGER}, #{item.memberCardNo,jdbcType=VARCHAR}, 
        #{item.memberName,jdbcType=VARCHAR}, #{item.cardNum,jdbcType=VARCHAR}, #{item.cardHidCode,jdbcType=VARCHAR}, 
        #{item.orderAmount,jdbcType=DECIMAL}, #{item.realPayAmount,jdbcType=DECIMAL}, #{item.discountAmount,jdbcType=DECIMAL}, 
        #{item.payType,jdbcType=VARCHAR}, #{item.paidTime,jdbcType=TIMESTAMP}, #{item.orderType,jdbcType=VARCHAR}, 
        #{item.locationNo,jdbcType=VARCHAR}, #{item.retrvlRefNo,jdbcType=VARCHAR}, #{item.oriTraceNo,jdbcType=VARCHAR}, 
        #{item.transDate,jdbcType=VARCHAR}, #{item.oriBatchNo,jdbcType=VARCHAR}, #{item.score,jdbcType=INTEGER}, 
        #{item.version,jdbcType=INTEGER}, #{item.remark,jdbcType=VARCHAR}, #{item.createdAt,jdbcType=TIMESTAMP}, 
        #{item.createdBy,jdbcType=VARCHAR}, #{item.updatedBy,jdbcType=VARCHAR}, #{item.updatedAt,jdbcType=TIMESTAMP}
        )
      </foreach>
    </if>
  </insert>
</mapper>