package com.sqx.modules.orders.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sqx.modules.orders.entity.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface OrdersDao extends BaseMapper<Orders> {

    String selectMaxCode(String newData);

    int insertOrders(Orders orders);

    List<Orders> selectOrdersByOrdersNo(@Param("ordersNo") String ordersNo, @Param("status") Integer status,
                                        @Param("userId") Long userId, @Param("courseId") Long courseId, @Param("flag") Integer flag,
                                        @Param("time") String time, @Param("userName") String userName, @Param("ordersType") Integer ordersType,
                                        @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("sysUserId") Long sysUserId,
                                        @Param("qdCode") String qdCode, @Param("sysUserName") String sysUserName);

    int deleteOrders(String[] ids);

    Double statisticsIncomeMoney(@Param("time") String time, @Param("flag") Integer flag, @Param("ordersType") Integer ordersType);

    Orders selectOrdersByCourseIdAndUserId(Long userId, Long courseId);

    List<Orders> selectOrdersMoneyList(Integer flag, String time);

    Integer selectOrdersCount(Integer status, Integer ordersType, Integer flag, String time, Long sysUserId);

    Double selectOrdersMoney(Integer status, Integer ordersType, Integer flag, String time, Long courseId, Long sysUserId);

    Double selectFenXiaoMoney(Integer type, Long sysUserId, Integer flag, String time);

    Integer selectOrdersCountStatisticsByYear(Integer flag, String time, Integer status);

    Integer selectOrdersCountStatisticsByDay(Long userId);

    Orders selectOrdersByDay(Long userId);
    Integer countPayOrderByDay(Long userId);


    Integer countOrderNum(Long userId, String time);

}
