Read additionally aspirant fields
This commit is contained in:
parent
f15a658f56
commit
85936721aa
@ -8,8 +8,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import ru.ulstu.admin.model.AspirantForm;
|
||||
import ru.ulstu.admin.service.AdminAspirantService;
|
||||
import ru.ulstu.aspirant.model.Aspirant;
|
||||
import ru.ulstu.indicator.model.Course;
|
||||
import ru.ulstu.indicator.model.Indicator;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("admin")
|
||||
@ -31,8 +31,9 @@ public class AdminAspirantController {
|
||||
model.addAttribute("aspirant",
|
||||
(id != null && id != 0)
|
||||
? adminAspirantService.getAspirantById(id)
|
||||
: new Indicator());
|
||||
: new Aspirant());
|
||||
model.addAttribute("courses", Course.values());
|
||||
model.addAttribute("managers", adminAspirantService.getManagers());
|
||||
return "admin/editAspirant";
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,6 @@ public class AdminIndicatorController {
|
||||
}
|
||||
|
||||
@GetMapping("/editIndicator/{indicatorId}")
|
||||
@Secured({UserRoleConstants.ADMIN})
|
||||
public String editIndicator(@PathVariable(value = "indicatorId") Integer id, Model model) {
|
||||
model.addAttribute("indicator",
|
||||
(id != null && id != 0)
|
||||
|
@ -4,15 +4,20 @@ import org.springframework.stereotype.Service;
|
||||
import ru.ulstu.admin.model.AspirantForm;
|
||||
import ru.ulstu.aspirant.model.Aspirant;
|
||||
import ru.ulstu.aspirant.service.AspirantService;
|
||||
import ru.ulstu.manager.model.Manager;
|
||||
import ru.ulstu.manager.service.ManagerService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class AdminAspirantService {
|
||||
private final AspirantService aspirantService;
|
||||
private final ManagerService managerService;
|
||||
|
||||
public AdminAspirantService(AspirantService aspirantService) {
|
||||
public AdminAspirantService(AspirantService aspirantService,
|
||||
ManagerService managerService) {
|
||||
this.aspirantService = aspirantService;
|
||||
this.managerService = managerService;
|
||||
}
|
||||
|
||||
public List<Aspirant> getAspirants() {
|
||||
@ -42,4 +47,8 @@ public class AdminAspirantService {
|
||||
public void deleteAspirant(AspirantForm aspirantForm) {
|
||||
aspirantService.deleteAspirant(aspirantForm);
|
||||
}
|
||||
|
||||
public List<Manager> getManagers() {
|
||||
return managerService.getManagers();
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,16 @@ public class Aspirant extends BaseEntity {
|
||||
|
||||
public Aspirant(AspirantForm aspirantForm) {
|
||||
this.name = aspirantForm.getName();
|
||||
this.surname = aspirantForm.getSurname();
|
||||
this.patronymic = aspirantForm.getPatronymic();
|
||||
this.theme = aspirantForm.getTheme();
|
||||
this.manager = aspirantForm.getManager();
|
||||
this.speciality = aspirantForm.getSpeciality();
|
||||
this.base = aspirantForm.getBase();
|
||||
this.birthDate = aspirantForm.getBirthDate();
|
||||
}
|
||||
|
||||
public Aspirant() {
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user