mirror of
https://github.com/st-tu-dresden-praktikum/swt23w23
synced 2024-07-19 21:04:36 +02:00
Remove surname from staff
Co-authored-by: Simon Bruder <simon.bruder@mailbox.tu-dresden.de>
This commit is contained in:
parent
3ecdcffbcd
commit
5aeaf01e0e
|
@ -7,16 +7,15 @@ import jakarta.persistence.Id;
|
|||
@Entity
|
||||
public class Staff {
|
||||
|
||||
private String surname, name, job;
|
||||
private String name, job;
|
||||
private @Id @GeneratedValue Long id;
|
||||
|
||||
protected Staff() {
|
||||
// No-argument constructor for JPA
|
||||
}
|
||||
|
||||
public Staff(String name, String surname, String job) {
|
||||
public Staff(String name, String job) {
|
||||
this.name = name;
|
||||
this.surname = surname;
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
|
@ -24,10 +23,6 @@ public class Staff {
|
|||
return id;
|
||||
}
|
||||
|
||||
public String getSurname() {
|
||||
return surname;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
@ -36,9 +31,6 @@ public class Staff {
|
|||
return job;
|
||||
}
|
||||
|
||||
public void setSurname(String surname) {
|
||||
this.surname = surname;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
|
|
|
@ -37,11 +37,10 @@ public class StaffController {
|
|||
@PreAuthorize("hasRole('ADMIN')")
|
||||
public String addStaff(
|
||||
@RequestParam String name,
|
||||
@RequestParam String surname,
|
||||
@RequestParam String job,
|
||||
Model model
|
||||
) {
|
||||
Staff newStaff = new Staff(name, surname, job);
|
||||
Staff newStaff = new Staff(name, job);
|
||||
staffManagement.save(newStaff);
|
||||
return "redirect:/staff";
|
||||
}
|
||||
|
@ -58,12 +57,10 @@ public class StaffController {
|
|||
public String updateStaff(
|
||||
@PathVariable("id") Staff staff,
|
||||
@RequestParam String name,
|
||||
@RequestParam String surname,
|
||||
@RequestParam String job
|
||||
) {
|
||||
staff.setJob(job);
|
||||
staff.setName(name);
|
||||
staff.setSurname(surname);
|
||||
staffManagement.save(staff);
|
||||
return "redirect:/staff";
|
||||
}
|
||||
|
|
|
@ -13,10 +13,6 @@
|
|||
<label class="form-label" for="name">Name:</label>
|
||||
<input class="form-control" type="text" th:field="*{name}" required />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="surname">Nachname:</label>
|
||||
<input class="form-control" type="text" th:field="*{surname}" required />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="job">Beruf:</label>
|
||||
<input class="form-control" type="text" th:field="*{job}" required />
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
<table class="table">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Nachname</th>
|
||||
<th>Beruf</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
|
@ -21,7 +20,6 @@
|
|||
|
||||
<tr th:each="staff : ${staff}">
|
||||
<td th:text="${staff.name}">Max</td>
|
||||
<td th:text="${staff.surname}">Musterkoch</td>
|
||||
<td th:text="${staff.job}">Koch</td>
|
||||
<td>
|
||||
<a th:href="@{'/staff/edit/' + ${staff.id}}"
|
||||
|
@ -44,10 +42,6 @@
|
|||
<label class="form-label" for="name">Name</label>
|
||||
<input class="form-control" type="text" name="name" required />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="surname">Nachname</label>
|
||||
<input class="form-control" type="text" name="surname" required />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="job">Beruf</label>
|
||||
<input class="form-control" type="text" name="job" required />
|
||||
|
|
Loading…
Reference in a new issue