private and course
This commit is contained in:
		| @@ -0,0 +1,41 @@ | |||||||
|  | package com.plannaplan.entities; | ||||||
|  |  | ||||||
|  | import java.util.ArrayList; | ||||||
|  | import java.util.List; | ||||||
|  |  | ||||||
|  | import javax.persistence.Entity; | ||||||
|  | import javax.persistence.GeneratedValue; | ||||||
|  | import javax.persistence.GenerationType; | ||||||
|  | import javax.persistence.Id; | ||||||
|  | import javax.persistence.OneToMany; | ||||||
|  |  | ||||||
|  | @Entity | ||||||
|  | public class Course { | ||||||
|  |     @Id | ||||||
|  |     @GeneratedValue(strategy = GenerationType.AUTO) | ||||||
|  |     private Long id; | ||||||
|  |     private String name; | ||||||
|  |     private String symbol; | ||||||
|  |     @OneToMany(mappedBy = "id") | ||||||
|  |     private List<Groups> groups = new ArrayList<>(); | ||||||
|  |  | ||||||
|  |     public Course() { | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public String getName() { | ||||||
|  |         return name; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public String getSymbol() { | ||||||
|  |         return symbol; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void setSymbol(String symbol) { | ||||||
|  |         this.symbol = symbol; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     public void setName(String name) { | ||||||
|  |         this.name = name; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -15,7 +15,9 @@ public class Groups { | |||||||
|     @Id |     @Id | ||||||
|     @GeneratedValue(strategy = GenerationType.AUTO) |     @GeneratedValue(strategy = GenerationType.AUTO) | ||||||
|     private Long id; |     private Long id; | ||||||
|     private Long courseId; |     @ManyToOne | ||||||
|  |     @JoinColumn(name = "course_id") | ||||||
|  |     private Course courseId; | ||||||
|     private int time; |     private int time; | ||||||
|     private String room; |     private String room; | ||||||
|     private int capacity; |     private int capacity; | ||||||
| @@ -76,11 +78,11 @@ public class Groups { | |||||||
|         this.time = time; |         this.time = time; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public Long getCourseId() { |     public Course getCourseId() { | ||||||
|         return courseId; |         return courseId; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void setCourseId(Long courseId) { |     public void setCourseId(Course courseId) { | ||||||
|         this.courseId = courseId; |         this.courseId = courseId; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -0,0 +1,11 @@ | |||||||
|  | package com.plannaplan.repositories; | ||||||
|  |  | ||||||
|  | import com.plannaplan.entities.Course; | ||||||
|  |  | ||||||
|  | import org.springframework.data.jpa.repository.JpaRepository; | ||||||
|  | import org.springframework.stereotype.Repository; | ||||||
|  |  | ||||||
|  | @Repository | ||||||
|  | public interface CourseRepository extends JpaRepository<Course, Long> { | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -9,7 +9,7 @@ import org.springframework.stereotype.Service; | |||||||
| @Service | @Service | ||||||
| public class AssignmentService implements EventCreator { | public class AssignmentService implements EventCreator { | ||||||
|     @Autowired |     @Autowired | ||||||
|     AssignmentRepository repo; |     private AssignmentRepository repo; | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void update() { |     public void update() { | ||||||
|   | |||||||
| @@ -0,0 +1,12 @@ | |||||||
|  | package com.plannaplan.services; | ||||||
|  |  | ||||||
|  | import com.plannaplan.repositories.CourseRepository; | ||||||
|  |  | ||||||
|  | import org.springframework.beans.factory.annotation.Autowired; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  |  | ||||||
|  | @Service | ||||||
|  | public class CourseService { | ||||||
|  |     @Autowired | ||||||
|  |     private CourseRepository repo; | ||||||
|  | } | ||||||
| @@ -8,5 +8,5 @@ import org.springframework.stereotype.Service; | |||||||
| @Service | @Service | ||||||
| public class LecturerService { | public class LecturerService { | ||||||
|     @Autowired |     @Autowired | ||||||
|     LecturerRepository repo; |     private LecturerRepository repo; | ||||||
| } | } | ||||||
| @@ -9,7 +9,7 @@ import org.springframework.stereotype.Service; | |||||||
| @Service | @Service | ||||||
| public class UserService implements EventCreator { | public class UserService implements EventCreator { | ||||||
|     @Autowired |     @Autowired | ||||||
|     UserRepository repo; |     private UserRepository repo; | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void update() { |     public void update() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user