package com.ruoyi.frequency.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.controller.req.OrderPageReq;
import com.ruoyi.controller.resp.MallOrderDetailResp;
import com.ruoyi.controller.resp.OrderDetailResp;
import com.ruoyi.controller.resp.OrderPageResp;
import com.ruoyi.frequency.order.entity.Order;
import com.ruoyi.frequency.order.model.result.OrderCount;
import com.ruoyi.vo.UserVo;
import org.apache.ibatis.annotations.Param;

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

/**
 * 订单主Mapper接口
 *
 * @author zj
 * @date 2023-10-13
 */
public interface OrderMapper  extends BaseMapper<Order>
{
    /**
     * 查询订单主
     *
     * @param id 订单主主键
     * @return 订单主
     */
    public Order selectOrderById(Long id);

    /**
     * 查询订单主列表
     *
     * @param order 订单主
     * @return 订单主集合
     */
    public List<Order> selectOrderList(Order order);

    /**
     * 新增订单主
     *
     * @param order 订单主
     * @return 结果
     */
    public int insertOrder(Order order);

    /**
     * 修改订单主
     *
     * @param order 订单主
     * @return 结果
     */
    public int updateOrder(Order order);

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

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

    Page<OrderPageResp> orderPage(@Param("page") Page<Object> objectPage, @Param("req") OrderPageReq req, @Param("userVo") UserVo userVo);

    Integer orderCount(@Param("userVo") UserVo userVo,@Param("req")OrderPageReq orderPageReq);

    OrderDetailResp orderDetail(@Param("id") Long id, @Param("userVo") UserVo userVo);

    List<OrderDetailResp> orderList(@Param("list") List<Long> orderIds, @Param("userVo") UserVo userVo);

    BigDecimal selectMonthBeforeAmount(@Param("beginOfMonth") Date beginOfMonth, @Param("userVo") UserVo userVo);

    OrderCount statistics(@Param("list") List<Long> orderIds);
}
