<?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.yami.shop.dao.OrderRefundSkuMapper">

    <resultMap id="BaseResultMap" type="com.yami.shop.bean.vo.OrderRefundSkuVo">
        <id column="id" property="id"/>
        <result column="sku_id" property="skuId"/>
        <result column="product_count" property="productCount"/>
        <result column="order_refund_id" property="orderRefundId"/>
        <result column="sku_price" property="skuPrice"/>
        <result column="order_item_id" property="orderItemId"/>
        <result column="sku_id" property="skuId"/>
        <result column="sku_name" property="skuName"/>
        <result column="spec" property="spec"/>
        <result column="pic" property="pic"/>
        <result column="prod_name" property="prodName"/>
    </resultMap>
    <select id="selectByRefundId" resultMap="BaseResultMap">
        select ork.*, sku.sku_name, sku.spec, sku.pic, prod.prod_name
        from tz_order_refund_sku ork
                 left join tz_order_item oi on ork.order_item_id = oi.order_item_id
                 join tz_sku sku on sku.sku_id = ork.sku_id
                 left join tz_prod prod on sku.prod_id = prod.prod_id
        where ork.order_refund_id = #{refundId}
    </select>

    <select id="selectByOrderItemList" resultType="com.yami.shop.bean.model.OrderRefundSku">
        SELECT rs.*
        FROM tz_order_refund refund
                 LEFT JOIN tz_order_refund_sku rs ON rs.order_refund_id = refund.refund_id
        where refund.return_money_sts not in(30,40)  and rs.order_item_id = #{orderItemId}
    </select>

</mapper>
