Last change
on this file was d3cf3a1, checked in by Marija Micevska <marija_micevska@…>, 2 years ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | package project.educatum.service.impl;
|
---|
2 |
|
---|
3 | import org.springframework.stereotype.Service;
|
---|
4 | import project.educatum.model.relations.TeacherStudentRelation;
|
---|
5 | import project.educatum.model.primarykeys.TeacherStudentRelationID;
|
---|
6 | import project.educatum.repository.TeacherStudentRepository;
|
---|
7 | import project.educatum.service.TeacherStudentService;
|
---|
8 |
|
---|
9 | import java.util.List;
|
---|
10 |
|
---|
11 | @Service
|
---|
12 | public class TeacherStudentServiceImpl implements TeacherStudentService {
|
---|
13 |
|
---|
14 | private final TeacherStudentRepository teacherStudentRepository;
|
---|
15 |
|
---|
16 | public TeacherStudentServiceImpl(TeacherStudentRepository teacherStudentRepository) {
|
---|
17 | this.teacherStudentRepository = teacherStudentRepository;
|
---|
18 | }
|
---|
19 |
|
---|
20 | @Override
|
---|
21 | public TeacherStudentRelation find(Integer idTeacher, Integer studentID) {
|
---|
22 | List<TeacherStudentRelation> teacherStudentRelationList = teacherStudentRepository.findAll();
|
---|
23 | TeacherStudentRelation result = new TeacherStudentRelation();
|
---|
24 | for (TeacherStudentRelation p : teacherStudentRelationList) {
|
---|
25 | TeacherStudentRelationID pId = p.getId();
|
---|
26 | if (pId.getTeacherID().equals(idTeacher) && pId.getStudentID().equals(studentID))
|
---|
27 | result = p;
|
---|
28 | }
|
---|
29 | return result;
|
---|
30 | }
|
---|
31 |
|
---|
32 | @Override
|
---|
33 | public List<TeacherStudentRelation> findAll() {
|
---|
34 | return teacherStudentRepository.findAll();
|
---|
35 | }
|
---|
36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.