package com.ruoyi.mall.mapper;

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

import com.ruoyi.mall.domain.MallOrderOrder;
import org.apache.ibatis.annotations.Param;

/**
 * 订单Mapper接口
 *
 * @author chang
 * @date 2021-11-25
 */
public interface MallOrderOrderMapper
{
    /**
     * 订单超时一天自动收货
     *
     * @return 订单
     */
    public List<MallOrderOrder> orderTimeout();

    /**
     * 订单超时未支付取消
     * 每分钟执行一次
     */
    public List<MallOrderOrder> orderCancelList();

    /**
     * 查询订单
     *
     * @param id 订单主键
     * @return 订单
     */
    public MallOrderOrder selectMallOrderOrderById(Long id);

    /**
     * 查询订单列表
     *
     * @param mallOrderOrder 订单
     * @return 订单集合
     */
    public List<MallOrderOrder> selectMallOrderOrderList(MallOrderOrder mallOrderOrder);

    /**
     * 新增订单
     *
     * @param mallOrderOrder 订单
     * @return 结果
     */
    public int insertMallOrderOrder(MallOrderOrder mallOrderOrder);

    /**
     * 批量配送
     *
     * @return 结果
     */
    public List<MallOrderOrder>  selectByOrderIds(@Param("orderIds") Integer[] orderIds);

    /**
     * 批量配送
     *
     * @return 结果
     */
    public int deliveryByOrderIds(@Param("orderIds") List<Long> orderIds);

    /**
     * 修改订单
     *
     * @param mallOrderOrder 订单
     * @return 结果
     */
    public int updateMallOrderOrder(MallOrderOrder mallOrderOrder);

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

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

    public MallOrderOrder queryByOrderSn(String orderNo);

    /**
     * 合单号查询订单集合
     * @param totalOrderSn
     * @return
     */
    public List<MallOrderOrder> selectOrderListByTotalOrderSn(@Param("totalOrderSn") String totalOrderSn);


    public List<MallOrderOrder> selectOrderListByShopId();



    /*
    * 查状态订单
    * */
    public List<MallOrderOrder> selectOrdersByStatus(@Param("type") String type, @Param("userId") String userId);

    public void taskCancleOrder(String compareTime);

    public List<MallOrderOrder> selectMallOrderByTime(String compareTime);

    public int checkTotleCount();

    public BigDecimal checkTotlePrice();

    public BigDecimal checkYearDate(String year);

    public BigDecimal checkYearAndMonth(@Param("year") String year, @Param("month") String month, @Param("day") String day);
    public int checkCountYearAndMonth(@Param("year") String year, @Param("month") String month, @Param("day") String day);

    /**
     * 业务员订单列表
     * @param param
     * @return
     */
    public List<MallOrderOrder> salesmanOrderList(Map<String,Object> param);

    /**
     * 修改订单信息
     *
     * @param mallOrderOrder 订单
     * @return 结果
     */
    public int updateMallOrderOrderInfo(MallOrderOrder mallOrderOrder);
    /*
     * 查状态订单包括部分退款
     * */
    List<MallOrderOrder> selectOrdersByreturnStatus(@Param("type") String type, @Param("userId") String userId);

    List<MallOrderOrder> selectOrdersByUserid(String userId);
}
