package com.cool.store.mapper.order;

import com.cool.store.entity.order.StoreOrderDO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import com.cool.store.request.order.PCStoreOrderQueryRequest;
import com.cool.store.vo.order.PCStoreOrderListVO;

import java.util.List;

public interface StoreOrderMapper extends Mapper<StoreOrderDO> {

    List<StoreOrderDO> queryPage(@Param("shopId") Long shopId,
                                @Param("status") Integer status);

    List<PCStoreOrderListVO> queryPCPage(PCStoreOrderQueryRequest request);

    Long count(PCStoreOrderQueryRequest request);

    List<StoreOrderDO> queryPageByLineId(@Param("lineId") Long lineId,
                                        @Param("status") Integer status);

    StoreOrderDO getById(@Param("id") Long id);

    StoreOrderDO getLatestDraftByShopId(@Param("shopId") Long shopId,
                                       @Param("status") Integer status);

    /**
     * 获取当前门店 最新的订单 除了已关闭的
     * @param shopId
     * @return
     */
    StoreOrderDO getLatestOrderByShopId(@Param("shopId") Long shopId);

    int countByShopIdAndStatusIn(@Param("shopId") Long shopId,
                                 @Param("statuses") List<Integer> statuses);

    int countByShopIdAndStatus(@Param("shopId") Long shopId,
                               @Param("status") Integer status);
}
