package org.hso.ecommerce.controller.intern.suppliers; import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping("/intern/") public class SupplierOfferController { @GetMapping("supplierOffers") public String internListedArticles(Model model) { List totals = new ArrayList(); /* * for (Article article : articleRepository.findAll()) { UImodelArticles tmp = * new UImodelArticles(); tmp.addListedArticle(article, * warehouseEntryRepository.getArticleStock(article.id).orElse(0)); * totals.add(tmp); } */ UImodelOfferedArticle tmp01 = new UImodelOfferedArticle(); UImodelOfferedArticle tmp02 = new UImodelOfferedArticle(); UImodelOfferedArticle tmp03 = new UImodelOfferedArticle(); tmp01.addData("Title01", "manufacturer01", "articlenumber01", "supplierName01", 4884, "42,42 €", "ads01", 5); tmp02.addData("Title02", "manufacturer02", "articlenumber02", "supplierName02", 4884, "42,42 €", "ads02", 6); tmp03.addData("Title03", "manufacturer03", "articlenumber03", "supplierName03", 4884, "42,42 €", "ads03", 7); totals.add(tmp01); totals.add(tmp02); totals.add(tmp03); model.addAttribute("OfferedArticles", totals); return "intern/offeredArticles/index"; } public class UImodelOfferedArticle { String title; String manufacturer; String articlenumber; String supplierName; int supplierId; String price; String ads; int listedArticleId; public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getManufacturer() { return manufacturer; } public void setManufacturer(String manufacturer) { this.manufacturer = manufacturer; } public String getArticlenumber() { return articlenumber; } public void setArticlenumber(String articlenumber) { this.articlenumber = articlenumber; } public String getSupplierName() { return supplierName; } public void setSupplierName(String supplierName) { this.supplierName = supplierName; } public int getSupplierId() { return supplierId; } public void setSupplierId(int supplierId) { this.supplierId = supplierId; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getAds() { return ads; } public void setAds(String ads) { this.ads = ads; } public int getListedArticleId() { return listedArticleId; } public void setListedArticleId(int listedArticleId) { this.listedArticleId = listedArticleId; } public void addData(String title, String manufacturer, String articlenumber, String supplierName, int supplierId, String price, String ads, int listedArticleId) { this.title = title; this.manufacturer = manufacturer; this.articlenumber = articlenumber; this.supplierName = supplierName; this.supplierId = supplierId; this.price = price; this.ads = ads; this.listedArticleId = listedArticleId; } } }