Revize 2868bb9a
Přidáno uživatelem Vojtěch Danišík před asi 4 roky(ů)
src/main/java/vldc/aswi/web/controller/IndexController.java | ||
---|---|---|
4 | 4 |
import org.springframework.stereotype.Controller; |
5 | 5 |
import org.springframework.ui.ModelMap; |
6 | 6 |
import org.springframework.web.bind.annotation.GetMapping; |
7 |
import org.springframework.web.bind.annotation.ModelAttribute; |
|
8 |
import org.springframework.web.bind.annotation.PostMapping; |
|
7 | 9 |
import org.springframework.web.servlet.ModelAndView; |
8 | 10 |
import vldc.aswi.database.DatabaseInterface; |
11 |
import vldc.aswi.domain.Assembly; |
|
9 | 12 |
import vldc.aswi.model.table.TableColumn; |
10 | 13 |
import vldc.aswi.model.table.contingencyTable.ContingencyTableRow; |
11 | 14 |
import vldc.aswi.model.table.contingencyTable.ContingencyTableRowCell; |
15 |
import vldc.aswi.service.AssemblyManager; |
|
12 | 16 |
import vldc.aswi.service.SqlQueryManager; |
13 | 17 |
import vldc.aswi.utils.Converter; |
14 | 18 |
|
15 | 19 |
import javax.sql.DataSource; |
20 |
import javax.validation.Valid; |
|
16 | 21 |
import java.util.ArrayList; |
17 | 22 |
import java.util.List; |
18 | 23 |
import java.util.Map; |
... | ... | |
23 | 28 |
@Autowired |
24 | 29 |
private SqlQueryManager sqlQueryManager; |
25 | 30 |
|
31 |
@Autowired |
|
32 |
private AssemblyManager assemblyManager; |
|
33 |
|
|
26 | 34 |
@GetMapping("/") |
27 |
public ModelAndView index() throws Exception {
|
|
35 |
public ModelAndView index() { |
|
28 | 36 |
ModelAndView modelAndView = new ModelAndView("index"); |
29 | 37 |
|
30 | 38 |
ModelMap modelMap = modelAndView.getModelMap(); |
31 | 39 |
|
32 |
String sqlQuery = "SELECT SP.fakulta_SP as fakulta_studia, " + |
|
33 |
"SP.kodSP_i as program_studia, " + |
|
34 |
"fn_meaning2(SP.typ,'TYP_OBORU') as typ_studia, " + |
|
35 |
"fn_meaning2(SP.forma,'FORMA_OBORU_NEW') as forma_studia, " + |
|
36 |
"decode(SP.vykazovan,'A',ST.vykazovan,'N') as vykazovan_na_SIMS, " + |
|
37 |
"ST.os_cislo as studium, fn_meaning2(ST.stav,'STAV_STUDENTA') as stav_studia, " + |
|
38 |
"OS.prijmeni || ' ' || OS.jmeno as osoba, " + |
|
39 |
"trunc((sysdate - OS.datum_naroz) / 365) as vek, " + |
|
40 |
"1 as pocet " + |
|
41 |
"FROM studijni_programy SP, studenti ST, osoby OS " + |
|
42 |
"WHERE SP.stpridno = ST.stpridno AND ST.osobidno = OS.osobidno AND ROWNUM <= 500"; |
|
43 |
|
|
44 |
modelMap.addAttribute("message", "Hello World!"); |
|
45 |
modelMap.addAttribute("contingencyTableRows", sqlQueryManager.getContingencyTableRow(sqlQuery)); |
|
40 |
modelMap.addAttribute("assemblies", assemblyManager.getAssemblies()); |
|
41 |
|
|
42 |
return modelAndView; |
|
43 |
} |
|
44 |
|
|
45 |
@PostMapping("/") |
|
46 |
public ModelAndView indexPost(@Valid @ModelAttribute("assemblyID") String id) { |
|
47 |
ModelAndView modelAndView = new ModelAndView(); |
|
48 |
modelAndView.setViewName("redirect:/assembly"); |
|
46 | 49 |
|
47 | 50 |
return modelAndView; |
48 | 51 |
} |
Také k dispozici: Unified diff
re #7871 Displaying list of assemblies + displaying result table of selected assembly.