mirror of
https://github.com/st-tu-dresden-praktikum/swt23w23
synced 2024-07-07 05:29:39 +02:00
b4dfa72852
Co-authored-by: Denis Natusch <denis.natusch@mailbox.tu-dresden.de> Co-authored-by: Simon Bruder <simon.bruder@mailbox.tu-dresden.de>
37 lines
859 B
Java
37 lines
859 B
Java
package catering.staff;
|
|
|
|
import java.util.Optional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.web.bind.annotation.SessionAttributes;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.data.util.Streamable;
|
|
|
|
@Component
|
|
@Transactional
|
|
@SessionAttributes("staff")
|
|
public class StaffManagement {
|
|
|
|
private final StaffRepository staffRepository;
|
|
|
|
public StaffManagement(StaffRepository staffRepository) {
|
|
this.staffRepository = staffRepository;
|
|
}
|
|
|
|
public Optional<Staff> findById(Long staffID) {
|
|
return staffRepository.findById(staffID);
|
|
}
|
|
|
|
public Staff save(Staff staff) {
|
|
return staffRepository.save(staff);
|
|
}
|
|
|
|
public Streamable<Staff> findAll() {
|
|
return staffRepository.findAll();
|
|
}
|
|
|
|
public void deleteStaff(Long staffID) {
|
|
staffRepository.deleteById(staffID);
|
|
}
|
|
|
|
}
|