Merge remote-tracking branch 'origin/try-vue' into try-vue
# Conflicts: # src/main/java/ru/ulstu/paper/controller/PaperController.java # src/main/java/ru/ulstu/paper/service/PaperService.java
This commit is contained in:
commit
6e584975e4
@ -3,13 +3,11 @@ package ru.ulstu.paper.controller;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import ru.ulstu.conference.service.ConferenceService;
|
||||
import ru.ulstu.deadline.model.Deadline;
|
||||
@ -20,7 +18,6 @@ import ru.ulstu.paper.model.PaperListDto;
|
||||
import ru.ulstu.paper.model.ReferenceDto;
|
||||
import ru.ulstu.paper.service.LatexService;
|
||||
import ru.ulstu.paper.service.PaperService;
|
||||
import ru.ulstu.user.model.User;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@ -114,21 +111,6 @@ public class PaperController {
|
||||
return "/papers/paper";
|
||||
}
|
||||
|
||||
@ModelAttribute("allStatuses")
|
||||
public List<Paper.PaperStatus> getPaperStatuses() {
|
||||
return paperService.getPaperStatuses();
|
||||
}
|
||||
|
||||
@ModelAttribute("allTypes")
|
||||
public List<Paper.PaperType> getPaperTypes() {
|
||||
return paperService.getPaperTypes();
|
||||
}
|
||||
|
||||
@ModelAttribute("allAuthors")
|
||||
public List<User> getAllAuthors() {
|
||||
return paperService.getPaperAuthors();
|
||||
}
|
||||
|
||||
@ModelAttribute("allYears")
|
||||
public List<Integer> getAllYears() {
|
||||
List<Integer> years = new ArrayList<>();
|
||||
|
@ -10,9 +10,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import ru.ulstu.configuration.Constants;
|
||||
import ru.ulstu.core.model.response.Response;
|
||||
import ru.ulstu.paper.model.Paper;
|
||||
import ru.ulstu.paper.model.PaperDto;
|
||||
import ru.ulstu.paper.model.PaperListDto;
|
||||
import ru.ulstu.paper.model.PaperStatusDto;
|
||||
import ru.ulstu.paper.model.PaperTypeDto;
|
||||
import ru.ulstu.paper.model.ReferenceDto;
|
||||
import ru.ulstu.paper.service.PaperService;
|
||||
import ru.ulstu.user.model.User;
|
||||
@ -86,12 +87,12 @@ public class PaperRestController {
|
||||
}
|
||||
|
||||
@GetMapping("/allTypes")
|
||||
public Response<List<Paper.PaperType>> getPaperTypes() {
|
||||
public Response<List<PaperTypeDto>> getPaperTypes() {
|
||||
return new Response<>(paperService.getPaperTypes());
|
||||
}
|
||||
|
||||
@GetMapping("/allStatuses")
|
||||
public Response<List<Paper.PaperStatus>> getPaperStatuses() {
|
||||
public Response<List<PaperStatusDto>> getPaperStatuses() {
|
||||
return new Response<>(paperService.getPaperStatuses());
|
||||
}
|
||||
}
|
||||
|
19
src/main/java/ru/ulstu/paper/model/PaperStatusDto.java
Normal file
19
src/main/java/ru/ulstu/paper/model/PaperStatusDto.java
Normal file
@ -0,0 +1,19 @@
|
||||
package ru.ulstu.paper.model;
|
||||
|
||||
public class PaperStatusDto {
|
||||
private final String id;
|
||||
private final String name;
|
||||
|
||||
public PaperStatusDto(Paper.PaperStatus status) {
|
||||
this.id = status.name();
|
||||
this.name = status.getStatusName();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
19
src/main/java/ru/ulstu/paper/model/PaperTypeDto.java
Normal file
19
src/main/java/ru/ulstu/paper/model/PaperTypeDto.java
Normal file
@ -0,0 +1,19 @@
|
||||
package ru.ulstu.paper.model;
|
||||
|
||||
public class PaperTypeDto {
|
||||
private final String id;
|
||||
private final String name;
|
||||
|
||||
public PaperTypeDto(Paper.PaperType type) {
|
||||
this.id = type.name();
|
||||
this.name = type.getTypeName();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
@ -12,6 +12,8 @@ import ru.ulstu.paper.model.Paper;
|
||||
import ru.ulstu.paper.model.PaperDto;
|
||||
import ru.ulstu.paper.model.PaperListDto;
|
||||
import ru.ulstu.paper.model.Reference;
|
||||
import ru.ulstu.paper.model.PaperStatusDto;
|
||||
import ru.ulstu.paper.model.PaperTypeDto;
|
||||
import ru.ulstu.paper.model.ReferenceDto;
|
||||
import ru.ulstu.paper.repository.PaperRepository;
|
||||
import ru.ulstu.paper.repository.ReferenceRepository;
|
||||
@ -208,12 +210,12 @@ public class PaperService {
|
||||
paperRepository.delete(paper);
|
||||
}
|
||||
|
||||
public List<Paper.PaperStatus> getPaperStatuses() {
|
||||
return Arrays.asList(Paper.PaperStatus.values());
|
||||
public List<PaperStatusDto> getPaperStatuses() {
|
||||
return convert(Arrays.asList(Paper.PaperStatus.values()), PaperStatusDto::new);
|
||||
}
|
||||
|
||||
public List<Paper.PaperType> getPaperTypes() {
|
||||
return Arrays.asList(Paper.PaperType.values());
|
||||
public List<PaperTypeDto> getPaperTypes() {
|
||||
return convert(Arrays.asList(Paper.PaperType.values()), PaperTypeDto::new);
|
||||
}
|
||||
|
||||
public List<ReferenceDto.FormatStandard> getFormatStandards() {
|
||||
|
@ -35,7 +35,7 @@
|
||||
<div class="form-group">
|
||||
<label for="type">Тип статьи:</label>
|
||||
<select class="form-control" id="type">
|
||||
<option v-for="type in allTypes" value="type">{{ type }}
|
||||
<option v-for="type in allTypes" value="type.id">{{ type.name }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -43,7 +43,7 @@
|
||||
<div class="form-group">
|
||||
<label for="status">Статус:</label>
|
||||
<select class="form-control" id="status">
|
||||
<option v-for="status in allStatuses" value="status">{{status}}
|
||||
<option v-for="status in allStatuses" value="status.id">{{status.name}}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user