package com.fuzamei.service.serviceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fuzamei.entity.Orders;
import com.fuzamei.mapperInterface.OrderMapper;
import com.fuzamei.service.OrderService;
@Service
public class OrderServiceImpl implements OrderService {
	
	@Autowired
	private OrderMapper orderMapper;

	@Override
	public void checkIfHasTheSameId(int orderId) {
		int count = orderMapper.queryOrderById(orderId);
		if(count!=0) throw new RuntimeException("订单号已存在");
	}

	@Override
	public Orders queryFullOrderByOrderId(int orderId) {
		Orders order = orderMapper.queryFullOrderByOrderId(orderId);
		if(null==order){
			throw new RuntimeException("该订单不存在");
		}
		return order;
	}
	
}
