43 lines
971 B
Java
Executable File
43 lines
971 B
Java
Executable File
package com.plannaplan.services;
|
|
|
|
import java.util.List;
|
|
import java.util.Optional;
|
|
|
|
import com.plannaplan.entities.Groups;
|
|
import com.plannaplan.repositories.GroupRepository;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@Service
|
|
public class GroupService {
|
|
@Autowired
|
|
private GroupRepository repo;
|
|
|
|
public GroupService() {
|
|
}
|
|
|
|
public Groups find(int time, int capacity, String room) {
|
|
return this.repo.find(time, room, capacity);
|
|
}
|
|
|
|
public List<Groups> getGroupsByCourse(Long id) {
|
|
return this.repo.getByCourse(id);
|
|
}
|
|
|
|
public void save(Groups group) {
|
|
this.repo.save(group);
|
|
}
|
|
|
|
public void delete(Groups groups) {
|
|
this.repo.delete(groups);
|
|
}
|
|
|
|
public int getGroupsAmmount() {
|
|
return (int) this.repo.count();
|
|
}
|
|
|
|
public Optional<Groups> getGroupById(Long id) {
|
|
return this.repo.findById(id);
|
|
}
|
|
} |