|
|
@ -3,19 +3,17 @@ package ru.ulstu.paper.controller;
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
|
import org.springframework.validation.Errors;
|
|
|
|
import org.springframework.validation.Errors;
|
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|
|
|
|
|
|
|
import ru.ulstu.core.model.response.Response;
|
|
|
|
import ru.ulstu.core.model.response.Response;
|
|
|
|
|
|
|
|
import ru.ulstu.paper.model.Paper;
|
|
|
|
import ru.ulstu.paper.model.PaperDto;
|
|
|
|
import ru.ulstu.paper.model.PaperDto;
|
|
|
|
import ru.ulstu.paper.model.PaperFilterDto;
|
|
|
|
import ru.ulstu.paper.model.PaperFilterDto;
|
|
|
|
import ru.ulstu.paper.model.PaperStatusDto;
|
|
|
|
|
|
|
|
import ru.ulstu.paper.service.PaperService;
|
|
|
|
import ru.ulstu.paper.service.PaperService;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
import javax.validation.Valid;
|
|
|
@ -55,15 +53,15 @@ public class PaperController {
|
|
|
|
return "redirect:/papers/papers";
|
|
|
|
return "redirect:/papers/papers";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@DeleteMapping("/{paper-id}")
|
|
|
|
@GetMapping("/delete/{paper-id}")
|
|
|
|
public Response<Boolean> delete(@PathVariable("paper-id") Integer paperId) throws IOException {
|
|
|
|
public String delete(@PathVariable("paper-id") Integer paperId) throws IOException {
|
|
|
|
paperService.delete(paperId);
|
|
|
|
paperService.delete(paperId);
|
|
|
|
return new Response<>(true);
|
|
|
|
return "redirect:/papers/papers";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/statuses")
|
|
|
|
@ModelAttribute("allStatuses")
|
|
|
|
public Response<List<PaperStatusDto>> getPaperStatuses() {
|
|
|
|
public List<Paper.PaperStatus> getPaperStatuses() {
|
|
|
|
return new Response<>(paperService.getPaperStatuses());
|
|
|
|
return paperService.getPaperStatuses();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/filter")
|
|
|
|
@PostMapping("/filter")
|
|
|
|