package org.springblade.modules.api.service.impl;


import org.springblade.modules.api.mapper.VendingOrderMapper;
import org.springblade.modules.api.request.VendingOrderReq;
import org.springblade.modules.api.service.VendingOrderService;
import org.springblade.modules.finance.vo.OrderGoodsVO;
import org.springblade.modules.finance.vo.OrderVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 售货机调用服务（无实体）
 */
@Service
public class VendingOrderServiceImpl implements VendingOrderService {

    @Autowired
    private VendingOrderMapper vendingOrderMapper;

    @Override
    public List<OrderGoodsVO> getVendingOrder(VendingOrderReq vendingOrderReq) {
        return vendingOrderMapper.getVendingOrder(vendingOrderReq);
    }

    /**
     * 获取最远的未出货订单
     *
     * @param vendingOrderReq
     * @return
     */
    @Override
    public OrderVO getBackOrder(VendingOrderReq vendingOrderReq) {
        List<OrderVO> backOrder = vendingOrderMapper.getBackOrder(vendingOrderReq);
        return backOrder.get(0);
    }
}
