package com.latian.latianSpringBoot.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import com.latian.latianSpringBoot.model.ModelOrderDetail;
import com.latian.latianSpringBoot.service.ServiceOrderDetail;

@RestController
public class ControllerOrderDetail {
	@Autowired
	ServiceOrderDetail sOrderDetail;
	
	@GetMapping(value="/order/detail")
	public List<ModelOrderDetail> getAllDetailOrder(){
		return sOrderDetail.getAllData();
	}
	@GetMapping(value="/order/detail/{id}")
	public List<ModelOrderDetail> getDataByOrderId(@PathVariable("id") Integer orderId){
		return sOrderDetail.getDataByOrder(orderId);
	}
}