feat: add class for models: trainig, orders, training_exam. Add relationship between their.
This commit is contained in:
parent
1fbc4460ad
commit
98c889a0cc
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
9
.idea/PutBit.iml
generated
Normal file
9
.idea/PutBit.iml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
.idea/misc.xml
generated
Normal file
6
.idea/misc.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_19" default="true" project-jdk-name="19" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/PutBit.iml" filepath="$PROJECT_DIR$/.idea/PutBit.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
19
app/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
19
app/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
wrapperVersion=3.3.2
|
||||
distributionType=only-script
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
|
BIN
app/data.mv.db
Normal file
BIN
app/data.mv.db
Normal file
Binary file not shown.
@ -26,4 +26,7 @@ public class Exam {
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, mappedBy = "exam")
|
||||
List<ExamResult> users;
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, mappedBy = "exam")
|
||||
List<TrainingExam> trainings;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class ExamResult {
|
||||
@JoinColumn(name = "exam_id", nullable = false)
|
||||
private Exam exam ;
|
||||
|
||||
@Column(name = "points", unique = true, nullable = false, length = 3)
|
||||
@Column(name = "points", nullable = false, length = 3)
|
||||
private int points ;
|
||||
|
||||
}
|
||||
|
27
app/src/main/java/putBit/app/models/Order.java
Normal file
27
app/src/main/java/putBit/app/models/Order.java
Normal file
@ -0,0 +1,27 @@
|
||||
package putBit.app.models;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Entity(name = "orders")
|
||||
public class Order {
|
||||
|
||||
@Id
|
||||
@OneToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private User user;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "training_id")
|
||||
Training training;
|
||||
|
||||
@Column(name = "confirm", columnDefinition = "boolean")
|
||||
Boolean confirm = false;
|
||||
}
|
47
app/src/main/java/putBit/app/models/Training.java
Normal file
47
app/src/main/java/putBit/app/models/Training.java
Normal file
@ -0,0 +1,47 @@
|
||||
package putBit.app.models;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Entity(name = "trainings")
|
||||
public class Training {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(name = "id")
|
||||
private int id;
|
||||
|
||||
@Column(name = "num", unique = true, nullable = false, length = 50)
|
||||
private String num ;
|
||||
|
||||
@Column(name = "title", unique = true, nullable = false, length = 50)
|
||||
private String title ;
|
||||
|
||||
@Column(name = "desc", nullable = false, length = 300)
|
||||
private String desc ;
|
||||
|
||||
@Column(name = "prof", unique = true, nullable = false, length = 300)
|
||||
private String prof ;
|
||||
|
||||
@Column(name = "basic_places", nullable = false, length = 3)
|
||||
private int basic_places ;
|
||||
|
||||
@Column(name = "benefit_places", nullable = false, length = 3)
|
||||
private int benefit_places ;
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, mappedBy = "training")
|
||||
List<TrainingExam> exams;
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, mappedBy = "training")
|
||||
List<Order> orders;
|
||||
|
||||
}
|
32
app/src/main/java/putBit/app/models/TrainingExam.java
Normal file
32
app/src/main/java/putBit/app/models/TrainingExam.java
Normal file
@ -0,0 +1,32 @@
|
||||
package putBit.app.models;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Entity(name = "training_exams")
|
||||
public class TrainingExam {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(name = "id")
|
||||
private int id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "training_id", nullable = false)
|
||||
private Training training ;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "exam_id", nullable = false)
|
||||
private Exam exam ;
|
||||
|
||||
@Column(name = "points", nullable = false, length = 3)
|
||||
private int points ;
|
||||
|
||||
}
|
@ -58,4 +58,6 @@ public class User {
|
||||
@OneToMany(fetch = FetchType.EAGER, mappedBy = "user")
|
||||
List<ExamResult> exams;
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER, mappedBy = "user" )
|
||||
Order order;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user