package com.cyl.manager.oms.mapper;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cyl.h5.pojo.vo.CountOrderVO;
import com.cyl.h5.pojo.vo.H5OrderVO;
import com.cyl.manager.aws.domain.SystemStatistics;
import com.cyl.manager.oms.domain.Order;
import com.cyl.manager.oms.pojo.request.ManagerOrderQueryRequest;
import com.cyl.manager.oms.pojo.vo.ManagerOrderVO;
import com.cyl.manager.statistics.pojo.vo.OrderAndAftersaleStatisticsVO;
import com.cyl.manager.ums.pojo.vo.MemberDataStatisticsVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 订单表Mapper接口
 * 
 * @author zcc
 */
public interface OrderMapper extends BaseMapper<Order> {
    /**
     * 查询订单表列表
     *
     * @param order 订单表
     * @return 订单表集合
     */
    List<Order> selectByEntity(Order order);

    List<ManagerOrderVO> selectManagerOrderPage(ManagerOrderQueryRequest request);

    List<H5OrderVO> orderPage(@Param("status") Integer status, @Param("memberId")Long memberId);



    List<H5OrderVO> orderPage3(@Param("status") List<Integer> status, @Param("memberId") Long memberId);

    List<H5OrderVO> orderPage2(@Param("status") List<Integer> status, @Param("memberId")Long memberId);

    H5OrderVO selectOrderDetail(Long orderId);

    CountOrderVO countByStatusAndMemberId(Long memberId);

    Integer cancelBatch(@Param("list") List<Order> orderList);


    //修改订单状态为已取消
    @Update("update oms_order set status = 4 where id = #{orderId}")
    Integer cancelBatchOne(@Param("orderId") Long orderId);

    MemberDataStatisticsVO statOrderCountAndAmount(Long memberId);


    Integer statWaitDelivered();

    OrderAndAftersaleStatisticsVO statTodayData(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);

    SystemStatistics statNewAndDeal(@Param("startTime") LocalDateTime startTime,@Param("endTime") LocalDateTime endTime);

    int statDealMember(@Param("startTime") LocalDateTime startTime,@Param("endTime") LocalDateTime endTime);

    List<Order> getAllValidOrder();

    List<Order> getOrdersByMemberId(@Param("memberId") Long memberId, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
}
