cut-to-pack-service/src/main/java/com/utopiaindustries/controller/InventoryTransactionControl...

33 lines
1.3 KiB
Java

package com.utopiaindustries.controller;
import com.utopiaindustries.service.InventoryService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
@RequestMapping
public class InventoryTransactionController {
private final InventoryService inventoryService;
public InventoryTransactionController(InventoryService inventoryService) {
this.inventoryService = inventoryService;
}
@GetMapping( "/inventory-transactions" )
public String getInventoryTransactionsByAccount( @RequestParam( value = "account-id", required = true) long accountId,
Model model ){
model.addAttribute("transactions", inventoryService.findTransactionByAccountId( accountId ));
return "/cutting/inventory-transactions";
}
@GetMapping( "/inventory-summary" )
public String getInventorySummaryByAccount( @RequestParam( value = "account-id", required = true) long accountId, Model model ){
model.addAttribute("summaries", inventoryService.findItemSummaryByAccountId( accountId ));
return "/cutting/inventory-summary";
}
}