Changeset 6c1d611 for springapp/src/main
- Timestamp:
- 07/26/22 23:09:04 (2 years ago)
- Branches:
- main
- Children:
- b7ec74e
- Parents:
- 9506ca8
- Location:
- springapp/src/main
- Files:
-
- 17 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
springapp/src/main/java/mk/profesori/springapp/Controller/MainController.java
r9506ca8 r6c1d611 14 14 import mk.profesori.springapp.Model.Faculty; 15 15 import mk.profesori.springapp.Model.Professor; 16 import mk.profesori.springapp.Model.StudyProgramme; 16 17 import mk.profesori.springapp.Model.University; 17 18 import mk.profesori.springapp.Service.MainService; … … 32 33 @RequestMapping(value = "/professor/{professorId}", method = RequestMethod.GET) 33 34 public Professor getProfessorById(@PathVariable Long professorId) { 34 return mainService.getProfessorById(professorId); 35 return mainService.getProfessorById(professorId); //vrakja profesor spored id 36 } 37 38 @RequestMapping(value = "/study_programmes", method = RequestMethod.GET) 39 public List<StudyProgramme> getStudyProgrammesByFaculty(@RequestParam Optional<Long> facultyId) { 40 41 if(!facultyId.isPresent()) return mainService.getAllStudyProgrammes(); //ako nema parametar facultyId gi vrakja site studiski programi 42 return mainService.getStudyProgrammesByFacultyId(facultyId.get()); 43 } 44 45 @RequestMapping(value = "/study_programme/{studyProgrammeId}", method = RequestMethod.GET) 46 public StudyProgramme getStudyProgrammeById(@PathVariable Long studyProgrammeId) { 47 return mainService.getStudyProgrammeById(studyProgrammeId); //vrakja studiska programa spored id 35 48 } 36 49 … … 44 57 @RequestMapping(value = "/faculty/{facultyId}", method = RequestMethod.GET) 45 58 public Faculty getFacultyById(@PathVariable Long facultyId) { 46 return mainService.getFacultyById(facultyId); 59 return mainService.getFacultyById(facultyId); //vrakja fakultet spored id 47 60 } 48 61 … … 56 69 @RequestMapping(value = "/university/{universityId}", method = RequestMethod.GET) 57 70 public University getUniversityById(@PathVariable Long universityId) { 58 return mainService.getUniversityById(universityId); 71 return mainService.getUniversityById(universityId); //vrakja univerzitet spored id 59 72 } 60 73 … … 66 79 @RequestMapping(value = "/city/{cityId}", method = RequestMethod.GET) 67 80 public City getCityById(@PathVariable Long cityId) { 68 return mainService.getCityById(cityId); 81 return mainService.getCityById(cityId); //vrakja grad spored id 69 82 } 70 83 71 72 84 } -
springapp/src/main/java/mk/profesori/springapp/Model/StudyProgramme.java
r9506ca8 r6c1d611 29 29 private String studyProgrammeName; 30 30 31 @Column(name = "cycle") 32 private int cycle; 33 31 34 @ManyToOne 32 35 @JoinColumn(name = "faculty_id") … … 45 48 } 46 49 50 public int getCycle() { 51 return cycle; 52 } 53 47 54 @JsonBackReference 48 55 public Faculty getFaculty() { -
springapp/src/main/java/mk/profesori/springapp/Repository/CityRepository.java
r9506ca8 r6c1d611 4 4 5 5 import org.springframework.data.repository.CrudRepository; 6 import org.springframework.stereotype.Repository; 6 7 7 8 import mk.profesori.springapp.Model.City; 8 9 10 @Repository 9 11 public interface CityRepository extends CrudRepository<City, Long>{ 10 12 -
springapp/src/main/java/mk/profesori/springapp/Repository/FacultyRepository.java
r9506ca8 r6c1d611 4 4 5 5 import org.springframework.data.repository.CrudRepository; 6 import org.springframework.stereotype.Repository; 6 7 7 8 import mk.profesori.springapp.Model.Faculty; 8 9 import mk.profesori.springapp.Model.University; 9 10 11 @Repository 10 12 public interface FacultyRepository extends CrudRepository<Faculty, Long>{ 11 13 -
springapp/src/main/java/mk/profesori/springapp/Repository/ProfessorRepository.java
r9506ca8 r6c1d611 4 4 5 5 import org.springframework.data.repository.CrudRepository; 6 import org.springframework.stereotype.Repository; 6 7 7 8 import mk.profesori.springapp.Model.Faculty; 8 9 import mk.profesori.springapp.Model.Professor; 9 10 11 @Repository 10 12 public interface ProfessorRepository extends CrudRepository<Professor, Long>{ 11 13 -
springapp/src/main/java/mk/profesori/springapp/Repository/UniversityRepository.java
r9506ca8 r6c1d611 4 4 5 5 import org.springframework.data.repository.CrudRepository; 6 import org.springframework.stereotype.Repository; 6 7 7 8 import mk.profesori.springapp.Model.City; … … 9 10 import mk.profesori.springapp.Model.University; 10 11 12 @Repository 11 13 public interface UniversityRepository extends CrudRepository<University, Long>{ 12 14 -
springapp/src/main/java/mk/profesori/springapp/Service/MainService.java
r9506ca8 r6c1d611 10 10 import mk.profesori.springapp.Repository.FacultyRepository; 11 11 import mk.profesori.springapp.Repository.ProfessorRepository; 12 import mk.profesori.springapp.Repository.StudyProgrammeRepository; 12 13 import mk.profesori.springapp.Repository.UniversityRepository; 13 14 import mk.profesori.springapp.Model.City; 14 15 import mk.profesori.springapp.Model.Faculty; 15 16 import mk.profesori.springapp.Model.Professor; 17 import mk.profesori.springapp.Model.StudyProgramme; 16 18 import mk.profesori.springapp.Model.University; 17 19 … … 21 23 @Autowired 22 24 private ProfessorRepository professorRepository; 25 @Autowired 26 private StudyProgrammeRepository studyProgrammeRepository; 23 27 @Autowired 24 28 private FacultyRepository facultyRepository; … … 46 50 List<Professor> list = new ArrayList<>(); 47 51 professorRepository.findByFaculty(faculty).forEach(list::add); 52 return list; 53 } 54 55 public List<StudyProgramme> getAllStudyProgrammes() { 56 57 List<StudyProgramme> list = new ArrayList<>(); 58 studyProgrammeRepository.findAll().forEach(list::add); 59 return list; 60 } 61 62 public StudyProgramme getStudyProgrammeById(Long id) { 63 64 return studyProgrammeRepository.findByStudyProgrammeId(id); 65 } 66 67 public List<StudyProgramme> getStudyProgrammesByFacultyId(Long facultyId) { 68 69 Faculty faculty = facultyRepository.findByFacultyId(facultyId); 70 71 List<StudyProgramme> list = new ArrayList<>(); 72 studyProgrammeRepository.findByFaculty(faculty).forEach(list::add); 48 73 return list; 49 74 } -
springapp/src/main/resources/application.properties
r9506ca8 r6c1d611 2 2 spring.datasource.username=postgres 3 3 spring.datasource.password=1win7337 4 spring.jpa.hibernate.ddl-auto= none4 spring.jpa.hibernate.ddl-auto=update 5 5 spring.jpa.show-sql=false 6 6 spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect 7 7 spring.jpa.properties.hibernate.format_sql=true 8 server.address=192.168.0.17 9 spring.mail.host=192.168.0.24 10 spring.mail.username=mailuser 11 spring.mail.password=mailpass 12 spring.mail.port=1025
Note:
See TracChangeset
for help on using the changeset viewer.