package com.ruoyi.mall.mapper;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import com.ruoyi.mall.domain.MallOrderGoods;
import com.ruoyi.mall.domain.MallOrderOrder;
import com.ruoyi.mall.domain.vo.MallOrderGoodsExportVO;
import com.ruoyi.mall.domain.vo.MallOrderGoodsVO;
import org.apache.ibatis.annotations.Param;

/**
 * 订单商品Mapper接口
 *
 * @author chang
 * @date 2021-11-25
 */
public interface MallOrderGoodsMapper
{
    /**
     * 查询订单商品
     *
     * @param id 订单商品主键
     * @return 订单商品
     */
    public MallOrderGoods selectMallOrderGoodsById(Long id);

    /**
     * 查询订单商品列表
     *
     * @param mallOrderGoods 订单商品
     * @return 订单商品集合
     */
    public List<MallOrderGoods> selectMallOrderGoodsList(MallOrderGoods mallOrderGoods);

    /**
     * 订单商品客户购买数量统计
     *
     * @param mallOrderGoods 订单商品
     * @return 订单商品集合
     */
    public List<MallOrderGoods> selectMallOrderGoodsTotal(MallOrderGoods mallOrderGoods);

    /**
     * 新增订单商品
     *
     * @param mallOrderGoods 订单商品
     * @return 结果
     */
    public int insertMallOrderGoods(MallOrderGoods mallOrderGoods);

    /**
     * 修改订单商品
     *
     * @param mallOrderGoods 订单商品
     * @return 结果
     */
    public int updateMallOrderGoods(MallOrderGoods mallOrderGoods);

    /**
     * 删除订单商品
     *
     * @param id 订单商品主键
     * @return 结果
     */
    public int deleteMallOrderGoodsById(Long id);

    /**
     * 批量删除订单商品
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteMallOrderGoodsByIds(Long[] ids);

    public List<MallOrderGoodsVO> selectMallOrderGoodsByOrderId(Long id);

    /**
     * 根据订单ID查询订单商品
     *
     * @param orderId 订单ID
     * @return 订单商品
     */
    public MallOrderGoods selectOrderGoodsByOrderId(Long orderId);

    /**
     * 根据订单ID查询订单商品提成
     *
     * @param orderId 订单ID
     * @return 订单商品
     */
    public BigDecimal selectOrderGoodsCommissionByOrderId(Long orderId);

    /**
     * 查询退货订单商品列表
     *
     * @param orderId 订单ID
     * @return 订单商品集合
     */
    public List<MallOrderGoods> selectMallBackOrderGoodsList(Long orderId);

    /**
     * 查询订单商品列表
     *
     * @param mallOrderGoods 订单商品
     * @return 订单商品集合
     */
    public List<MallOrderGoods> getOrderBackList(MallOrderGoods mallOrderGoods);

    public List<MallOrderGoodsExportVO> selectMallOrderGoodsListByOrderIds(Long[] ids);


    /**
     * 导出订单
     * @param mallOrderOrder
     * @return
     */
    public List<MallOrderGoodsExportVO> exportOrder(MallOrderOrder mallOrderOrder);


    /**
     * 订单商品列表
     *
     * @param orderId 订单ID
     * @return 结果
     */
    public List<Map<String, Object>> selectMallOrderGoodsListByOrderId(Long orderId);

    /**
     * 订单商品总件数
     *
     * @param orderId 订单ID
     * @return 结果
     */
    public String orderGoodsTotal(Long orderId);

    /**
     * 更改订单商品退货状态
     *
     * @param orderId 订单ID
     * @param returnStatus 退货状态：0-未退货，1-退货中，2-已退货，3-已拒绝，4-取消退货
     * @return 结果
     */
    public int updateMallOrderGoodsReturnStatus(@Param("orderId") Long orderId, @Param("returnStatus") String returnStatus);

    public int updateMallOrderGoodsByOrderIdAndGoodsId(@Param("orderId") Long orderId,@Param("goodsId") Long goodsId, @Param("returnStatus") String returnStatus,@Param("returnTotal") String returnTotal,@Param("returnableQuantity") String returnableQuantity);

    public int updateMallOrderGoodsReturns(@Param("orderId") Long orderId, @Param("returnStatus") String returnStatus);

    MallOrderGoodsVO selectMallOrderGoodsByOrderIdAndGoodsId(@Param("orderId") Long orderId,@Param("goodsId") Long goodsId);
}
