<?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="org.springblade.modules.finance.mapper.AfterSalesGoodsMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="afterSalesGoodsResultMap" type="org.springblade.modules.finance.entity.AfterSalesGoods">
        <result column="id" property="id"/>
        <result column="is_delete" property="isDelete"/>
        <result column="create_user_id" property="createUserId"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user_id" property="updateUserId"/>
        <result column="update_time" property="updateTime"/>
        <result column="after_sales_id" property="afterSalesId"/>
        <result column="goods_num" property="goodsNum"/>
        <result column="order_groupon_goods_id" property="orderGrouponGoodsId"/>
    </resultMap>


    <select id="selectAfterSalesGoodsPage" resultMap="afterSalesGoodsResultMap">
        select * from t_after_sales_goods where is_delete = 0
    </select>
    <select id="selectGoodsByAfterSalesId"
            resultType="org.springblade.modules.finance.entity.OrderGoods">
        SELECT
            ogg.*,
			asg.goods_num refundGoodsNum
        FROM
            t_after_sales_goods asg
            JOIN t_order_groupon_goods ogg ON asg.order_groupon_goods_id = ogg.id
        WHERE
            asg.after_sales_id = #{afterSalesId}
    </select>

</mapper>
