package com.ylx.massage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ylx.massage.domain.ProductOrderItem;
import com.ylx.massage.domain.vo.OrderItemVo;
import com.ylx.massage.domain.vo.ProductSalesStats;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品订单明细Mapper接口
 */
@Mapper
public interface ProductOrderItemMapper extends BaseMapper<ProductOrderItem> {
    OrderItemVo getOrderItemVoByOrderId(@Param("orderId") Long orderId);

    /**
     * 查询近30天各商品销量统计
     * 仅统计已支付订单（payStatus=1）的商品销售数量
     *
     * @return List<ProductSalesStats> 商品ID与销量映射列表
     */
    List<ProductSalesStats> selectLast30DaysSalesStats();
}