de
This commit is contained in:
parent
4f93068cce
commit
c6889698bf
@ -0,0 +1,26 @@
|
||||
package com.example.demo.supply.Supplier;
|
||||
|
||||
import com.example.demo.supply.Product.ProductDto;
|
||||
import com.example.demo.supply.Product.ProductService;
|
||||
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 java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/product")
|
||||
public class ProductMvcController {
|
||||
private final ProductService productService;
|
||||
|
||||
public ProductMvcController(ProductService productService){ this.productService = productService;}
|
||||
|
||||
@GetMapping("/")
|
||||
public String getProducts(Model model) {
|
||||
model.addAttribute("students",
|
||||
productService.findAllProducts().stream().map(ProductDto::new).toList());
|
||||
return "students";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user