1 | package project.educatum.model;
|
---|
2 |
|
---|
3 | import lombok.Data;
|
---|
4 | import lombok.NoArgsConstructor;
|
---|
5 |
|
---|
6 | import javax.persistence.*;
|
---|
7 | import java.time.LocalDateTime;
|
---|
8 |
|
---|
9 | @Data
|
---|
10 | @Entity
|
---|
11 | @Table(name = "casovi", schema = "project")
|
---|
12 | @NoArgsConstructor
|
---|
13 | public class Class {
|
---|
14 | @Id
|
---|
15 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
16 | @Column(name = "id_cas", nullable = false)
|
---|
17 | private Integer id;
|
---|
18 |
|
---|
19 | @Column(name = "vreme_pocetok")
|
---|
20 | private LocalDateTime beginningTime;
|
---|
21 |
|
---|
22 | @Column(name = "tema", nullable = false, length = 100)
|
---|
23 | private String topic;
|
---|
24 |
|
---|
25 | @ManyToOne
|
---|
26 | @JoinColumn(name = "id_nastavnik")
|
---|
27 | private Teacher idTeacher;
|
---|
28 |
|
---|
29 | @ManyToOne
|
---|
30 | @JoinColumn(name = "id_predmet")
|
---|
31 | private Subject subjectID;
|
---|
32 |
|
---|
33 | public Class(LocalDateTime beginningTime, String topic, Teacher idTeacher, Subject subjectID) {
|
---|
34 | this.beginningTime = beginningTime;
|
---|
35 | this.topic = topic;
|
---|
36 | this.idTeacher = idTeacher;
|
---|
37 | this.subjectID = subjectID;
|
---|
38 | }
|
---|
39 |
|
---|
40 | @Override
|
---|
41 | public String toString() {
|
---|
42 | return topic + "\t" + beginningTime.getDayOfMonth() + "." + beginningTime.getMonthValue() + "."
|
---|
43 | + beginningTime.getYear() + " " + beginningTime.getHour() + ":" +
|
---|
44 | beginningTime.getMinute() + "\n";
|
---|
45 | }
|
---|
46 |
|
---|
47 | public String beginningDate() {
|
---|
48 | return beginningTime.getDayOfMonth() + "." + beginningTime.getMonthValue() + "."
|
---|
49 | + beginningTime.getYear() + "\n";
|
---|
50 | }
|
---|
51 |
|
---|
52 | public String beginningTime() {
|
---|
53 | return beginningTime.getHour() + ":" + beginningTime.getMinute() + "h\n";
|
---|
54 | }
|
---|
55 | } |
---|