#18- Add controller
parent
caae6eae5a
commit
fc2f0c209a
@ -0,0 +1,35 @@
|
|||||||
|
package ru.ulstu.extractor.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import ru.ulstu.extractor.repository.BranchRepository;
|
||||||
|
import ru.ulstu.extractor.repository.RepositoryRepository;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class StatisticController {
|
||||||
|
private final RepositoryRepository repositoryRepository;
|
||||||
|
private final BranchRepository branchRepository;
|
||||||
|
|
||||||
|
public StatisticController(RepositoryRepository repositoryRepository, BranchRepository branchRepository) {
|
||||||
|
this.repositoryRepository = repositoryRepository;
|
||||||
|
this.branchRepository = branchRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/statistic")
|
||||||
|
public String indexBranch(
|
||||||
|
Model model) {
|
||||||
|
String[] continents = {
|
||||||
|
"Africa", "Antarctica", "Asia", "Australia",
|
||||||
|
"Europe", "North America", "Sourth America"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
model.addAttribute("continents", continents);
|
||||||
|
model.addAttribute("array", new int[]{1,2,3});
|
||||||
|
String[][] data = new String[][] {{"Газ", "Объём"}, {"Dsdfsdf", "10"}};
|
||||||
|
model.addAttribute("data", data);
|
||||||
|
return "statistic";
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue