Lecturer +

This commit is contained in:
Filip Izydorczyk 2020-07-25 10:21:42 +02:00
parent 8b5d73a5dd
commit 3c026115fe
5 changed files with 82 additions and 1 deletions

View File

@ -4,6 +4,8 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import com.plannaplan.types.GroupType; import com.plannaplan.types.GroupType;
import com.plannaplan.types.WeekDay; import com.plannaplan.types.WeekDay;
@ -19,10 +21,21 @@ public class Groups {
private int capacity; private int capacity;
private GroupType type; private GroupType type;
private WeekDay day; private WeekDay day;
@ManyToOne
@JoinColumn(name = "lecturer_id")
private Lecturer lecturer;
public Groups() { public Groups() {
} }
public Lecturer getLecturer() {
return lecturer;
}
public void setLecturer(Lecturer lecturer) {
this.lecturer = lecturer;
}
public WeekDay getDay() { public WeekDay getDay() {
return day; return day;
} }

View File

@ -0,0 +1,44 @@
package com.plannaplan.entities;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Lecturer {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String title;
private String name;
private String surname;
public Lecturer() {
}
public String getTitle() {
return title;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setTitle(String title) {
this.title = title;
}
}

View File

@ -0,0 +1,12 @@
package com.plannaplan.repositories;
import com.plannaplan.entities.Lecturer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface LecturerRepository extends JpaRepository<Lecturer, Long> {
}

View File

@ -0,0 +1,12 @@
package com.plannaplan.services;
import com.plannaplan.repositories.LecturerRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class LecturerService {
@Autowired
LecturerRepository repo;
}

View File

@ -4,7 +4,7 @@ spring.datasource.username=root
spring.datasource.password=example spring.datasource.password=example
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.open-in-view=true spring.jpa.open-in-view=true
spring.jpa.hibernate.ddl-auto=create spring.jpa.hibernate.ddl-auto=create-drop
spring.jackson.serialization.fail-on-empty-beans=false spring.jackson.serialization.fail-on-empty-beans=false
server.port=1285 server.port=1285