package com.fdkankan.platform.order.mapper;

import com.fdkankan.platform.order.entity.OrderItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fdkankan.platform.user.vo.ResponseOrderItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 订单项表 Mapper 接口
 * </p>
 *
 * @author 
 * @since 2021-12-24
 */
@Mapper
public interface IOrderItemMapper extends BaseMapper<OrderItem> {

    @Select(" SELECT i.id, i.goods_name, i.goods_count, i.goods_price, g.description, g.pic, i.sku_sn, i.express_name, i.express_num, i.shipping_status, i.order_id, i.goods_id FROM" +
            " t_order_item i LEFT JOIN t_order o ON o.id = i.order_id " +
            "LEFT JOIN t_goods g ON i.goods_id = g.id where i.rec_status = 'A' and o.id = #{orderId} ")
    List<ResponseOrderItem> getByOrderId(@Param("orderId") Long orderId);
}
