<?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.hzs.sale.refund.mapper.SaRefundItemsMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.sale.order.SaRefundItems">
        <id column="PK_ID" property="pkId"/>
        <result column="DEL_FLAG" property="delFlag"/>
        <result column="CREATION_TIME" property="creationTime"/>
        <result column="PK_CREATOR" property="pkCreator"/>
        <result column="MODIFIED_TIME" property="modifiedTime"/>
        <result column="PK_MODIFIED" property="pkModified"/>
        <result column="PK_COUNTRY" property="pkCountry"/>
        <result column="PK_REFUND" property="pkRefund"/>
        <result column="PK_ORDER_ITEMS" property="pkOrderItems"/>
        <result column="PK_PRODUCT" property="pkProduct"/>
        <result column="PRICE" property="price"/>
        <result column="ACHIEVEMENT" property="achievement"/>
        <result column="ASS_ACHIEVEMENT" property="assAchievement"/>
        <result column="QUANTITY" property="quantity"/>
        <result column="SPECS_NAME" property="specsName"/>
        <result column="SPECS_NAME_ID" property="specsNameId"/>
    </resultMap>

    <!-- 批量插入退款明细数据 -->
    <insert id="insertBatch">
        insert into SA_REFUND_ITEMS (
        pk_id,
        pk_refund,
        pk_order_items,
        pk_product,
        price,
        achievement,
        ass_achievement,
        quantity,
        specs_name,
        specs_name_id,
        pk_creator,
        pk_country
        )
        <foreach collection="itemsList" item="item" separator=" union ">
            select
            SA_REFUND_ITEMS_SEQ.Nextval,
            #{pkRefund},
            #{item.pkOrderItems},
            #{item.pkProduct},
            #{item.price},
            #{item.achievement},
            #{item.assAchievement},
            #{item.quantity},
            #{item.specsName},
            #{item.specsNameId},
            #{item.pkCreator},
            #{item.pkCountry}
            )
        </foreach>
    </insert>

</mapper>
