Relation Database
This commit is contained in:
parent
ba9e100a18
commit
2d8b87cb5b
@ -2,14 +2,16 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="47c3fbf4-4238-47d3-9ffa-fcd23da4e01e" name="Default Changelist" comment="">
|
<list default="true" id="47c3fbf4-4238-47d3-9ffa-fcd23da4e01e" name="Default Changelist" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/config/CORSConfig.kt" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/config/WebConfig.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/jpa/model/Position.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/jpa/model/Staff.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/controller/ProductController.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/controller/ProductController.kt" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/controller/ProductController.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/controller/ProductController.kt" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/jpa/model/Product.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/jpa/model/Product.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/jpa/model/Customer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/jpa/model/Customer.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/jpa/repo/ProductRepo.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/jpa/repo/ProductRepo.kt" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/jpa/model/Order.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/jpa/model/Order.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/jpa/service/product/ProductServiceImpl.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/com/chantha/jdbc/jpa/service/product/ProductServiceImpl.kt" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/target/classes/com/chantha/jdbc/controller/ProductController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/chantha/jdbc/controller/ProductController.class" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/target/classes/com/chantha/jdbc/controller/ProductController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/chantha/jdbc/controller/ProductController.class" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/target/classes/com/chantha/jdbc/jpa/service/product/ProductServiceImpl.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/chantha/jdbc/jpa/service/product/ProductServiceImpl.class" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/target/classes/com/chantha/jdbc/jpa/model/Order.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/chantha/jdbc/jpa/model/Order.class" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -21,9 +23,9 @@
|
|||||||
<list>
|
<list>
|
||||||
<option value="Interface" />
|
<option value="Interface" />
|
||||||
<option value="Kotlin Interface" />
|
<option value="Kotlin Interface" />
|
||||||
<option value="Class" />
|
|
||||||
<option value="Kotlin Class" />
|
<option value="Kotlin Class" />
|
||||||
<option value="Kotlin File" />
|
<option value="Kotlin File" />
|
||||||
|
<option value="Class" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
@ -49,7 +51,7 @@
|
|||||||
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||||
<property name="aspect.path.notification.shown" value="true" />
|
<property name="aspect.path.notification.shown" value="true" />
|
||||||
<property name="last_opened_file_path" value="D:/projectfloder/clinic-api" />
|
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||||
<property name="restartRequiresConfirmation" value="false" />
|
<property name="restartRequiresConfirmation" value="false" />
|
||||||
</component>
|
</component>
|
||||||
<component name="RecentsManager">
|
<component name="RecentsManager">
|
||||||
@ -86,7 +88,9 @@
|
|||||||
<workItem from="1589602595035" duration="1232000" />
|
<workItem from="1589602595035" duration="1232000" />
|
||||||
<workItem from="1589605337172" duration="14812000" />
|
<workItem from="1589605337172" duration="14812000" />
|
||||||
<workItem from="1589690218526" duration="3238000" />
|
<workItem from="1589690218526" duration="3238000" />
|
||||||
<workItem from="1589695280458" duration="2028000" />
|
<workItem from="1589695280458" duration="9667000" />
|
||||||
|
<workItem from="1589774040527" duration="72000" />
|
||||||
|
<workItem from="1589788206287" duration="48000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
@ -102,65 +106,65 @@
|
|||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state x="690" y="276" key="#com.intellij.codeInsight.editorActions.RestoreReferencesDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1589601961718" />
|
<state x="690" y="276" key="#com.intellij.codeInsight.editorActions.RestoreReferencesDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1589601961718" />
|
||||||
<state x="765" y="197" key="#com.intellij.ide.util.MemberChooser" timestamp="1589695931011">
|
<state x="765" y="197" key="#com.intellij.ide.util.MemberChooser" timestamp="1589700451727">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state x="765" y="197" key="#com.intellij.ide.util.MemberChooser/0.0.1920.1040@0.0.1920.1040" timestamp="1589695931011" />
|
<state x="765" y="197" key="#com.intellij.ide.util.MemberChooser/0.0.1920.1040@0.0.1920.1040" timestamp="1589700451727" />
|
||||||
<state x="649" y="437" key="#com.intellij.refactoring.move.MoveHandler.SelectRefactoringDialog" timestamp="1589690277066">
|
<state x="649" y="437" key="#com.intellij.refactoring.move.MoveHandler.SelectRefactoringDialog" timestamp="1589690277066">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state x="649" y="437" key="#com.intellij.refactoring.move.MoveHandler.SelectRefactoringDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1589690277066" />
|
<state x="649" y="437" key="#com.intellij.refactoring.move.MoveHandler.SelectRefactoringDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1589690277066" />
|
||||||
<state x="690" y="268" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog" timestamp="1589596932250">
|
<state x="690" y="268" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog" timestamp="1589700278039">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state x="690" y="268" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1589596932250" />
|
<state x="690" y="268" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1589700278039" />
|
||||||
<state x="739" y="31" key="#org.jetbrains.kotlin.idea.refactoring.move.moveDeclarations.ui.MoveKotlinTopLevelDeclarationsDialog" timestamp="1589608464352">
|
<state x="739" y="31" key="#org.jetbrains.kotlin.idea.refactoring.move.moveDeclarations.ui.MoveKotlinTopLevelDeclarationsDialog" timestamp="1589608464352">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state x="739" y="31" key="#org.jetbrains.kotlin.idea.refactoring.move.moveDeclarations.ui.MoveKotlinTopLevelDeclarationsDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1589608464352" />
|
<state x="739" y="31" key="#org.jetbrains.kotlin.idea.refactoring.move.moveDeclarations.ui.MoveKotlinTopLevelDeclarationsDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1589608464352" />
|
||||||
<state x="740" y="276" key="FileChooserDialogImpl" timestamp="1589695324127">
|
<state x="740" y="276" key="FileChooserDialogImpl" timestamp="1589774110803">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state x="740" y="276" key="FileChooserDialogImpl/0.0.1920.1040@0.0.1920.1040" timestamp="1589695324127" />
|
<state x="740" y="276" key="FileChooserDialogImpl/0.0.1920.1040@0.0.1920.1040" timestamp="1589774110803" />
|
||||||
<state width="1877" height="420" key="GridCell.Tab.0.bottom" timestamp="1589697284781">
|
<state width="1877" height="420" key="GridCell.Tab.0.bottom" timestamp="1589709359957">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="420" key="GridCell.Tab.0.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1589697284781" />
|
<state width="1877" height="420" key="GridCell.Tab.0.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1589709359957" />
|
||||||
<state width="1877" height="420" key="GridCell.Tab.0.center" timestamp="1589697284781">
|
<state width="1877" height="420" key="GridCell.Tab.0.center" timestamp="1589709359957">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="420" key="GridCell.Tab.0.center/0.0.1920.1040@0.0.1920.1040" timestamp="1589697284781" />
|
<state width="1877" height="420" key="GridCell.Tab.0.center/0.0.1920.1040@0.0.1920.1040" timestamp="1589709359957" />
|
||||||
<state width="1877" height="420" key="GridCell.Tab.0.left" timestamp="1589697284781">
|
<state width="1877" height="420" key="GridCell.Tab.0.left" timestamp="1589709359957">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="420" key="GridCell.Tab.0.left/0.0.1920.1040@0.0.1920.1040" timestamp="1589697284781" />
|
<state width="1877" height="420" key="GridCell.Tab.0.left/0.0.1920.1040@0.0.1920.1040" timestamp="1589709359957" />
|
||||||
<state width="1877" height="420" key="GridCell.Tab.0.right" timestamp="1589697284781">
|
<state width="1877" height="420" key="GridCell.Tab.0.right" timestamp="1589709359957">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="420" key="GridCell.Tab.0.right/0.0.1920.1040@0.0.1920.1040" timestamp="1589697284781" />
|
<state width="1877" height="420" key="GridCell.Tab.0.right/0.0.1920.1040@0.0.1920.1040" timestamp="1589709359957" />
|
||||||
<state width="1877" height="420" key="GridCell.Tab.1.bottom" timestamp="1589697284781">
|
<state width="1877" height="420" key="GridCell.Tab.1.bottom" timestamp="1589709359958">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="420" key="GridCell.Tab.1.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1589697284781" />
|
<state width="1877" height="420" key="GridCell.Tab.1.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1589709359958" />
|
||||||
<state width="1877" height="420" key="GridCell.Tab.1.center" timestamp="1589697284781">
|
<state width="1877" height="420" key="GridCell.Tab.1.center" timestamp="1589709359957">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="420" key="GridCell.Tab.1.center/0.0.1920.1040@0.0.1920.1040" timestamp="1589697284781" />
|
<state width="1877" height="420" key="GridCell.Tab.1.center/0.0.1920.1040@0.0.1920.1040" timestamp="1589709359957" />
|
||||||
<state width="1877" height="420" key="GridCell.Tab.1.left" timestamp="1589697284781">
|
<state width="1877" height="420" key="GridCell.Tab.1.left" timestamp="1589709359957">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="420" key="GridCell.Tab.1.left/0.0.1920.1040@0.0.1920.1040" timestamp="1589697284781" />
|
<state width="1877" height="420" key="GridCell.Tab.1.left/0.0.1920.1040@0.0.1920.1040" timestamp="1589709359957" />
|
||||||
<state width="1877" height="420" key="GridCell.Tab.1.right" timestamp="1589697284781">
|
<state width="1877" height="420" key="GridCell.Tab.1.right" timestamp="1589709359958">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1877" height="420" key="GridCell.Tab.1.right/0.0.1920.1040@0.0.1920.1040" timestamp="1589697284781" />
|
<state width="1877" height="420" key="GridCell.Tab.1.right/0.0.1920.1040@0.0.1920.1040" timestamp="1589709359958" />
|
||||||
<state x="767" y="433" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1589538516704">
|
<state x="767" y="433" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2" timestamp="1589538516704">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state x="767" y="433" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/0.0.1920.1040@0.0.1920.1040" timestamp="1589538516704" />
|
<state x="767" y="433" key="com.intellij.openapi.vcs.update.UpdateOrStatusOptionsDialogupdate-v2/0.0.1920.1040@0.0.1920.1040" timestamp="1589538516704" />
|
||||||
<state x="623" y="225" width="672" height="678" key="search.everywhere.popup" timestamp="1589696948784">
|
<state x="623" y="225" width="672" height="678" key="search.everywhere.popup" timestamp="1589699975397">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state x="623" y="225" width="672" height="678" key="search.everywhere.popup/0.0.1920.1040@0.0.1920.1040" timestamp="1589696948784" />
|
<state x="623" y="225" width="672" height="678" key="search.everywhere.popup/0.0.1920.1040@0.0.1920.1040" timestamp="1589699975397" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
7
pom.xml
7
pom.xml
@ -39,6 +39,13 @@
|
|||||||
<version>42.2.12</version>
|
<version>42.2.12</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-security -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
<version>2.3.0.RELEASE</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>kotlin-reflect</artifactId>
|
<artifactId>kotlin-reflect</artifactId>
|
||||||
|
4
src/main/kotlin/com/chantha/jdbc/config/WebConfig.java
Normal file
4
src/main/kotlin/com/chantha/jdbc/config/WebConfig.java
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
package com.chantha.jdbc.config;
|
||||||
|
|
||||||
|
public class WebConfig {
|
||||||
|
}
|
@ -5,6 +5,7 @@ import com.chantha.jdbc.jpa.model.view.ProductWithOrderDetail
|
|||||||
import com.chantha.jdbc.jpa.repo.ProductRepo
|
import com.chantha.jdbc.jpa.repo.ProductRepo
|
||||||
import com.chantha.jdbc.jpa.service.product.ProductService
|
import com.chantha.jdbc.jpa.service.product.ProductService
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
|
import org.springframework.web.bind.annotation.CrossOrigin
|
||||||
import org.springframework.web.bind.annotation.GetMapping
|
import org.springframework.web.bind.annotation.GetMapping
|
||||||
import org.springframework.web.bind.annotation.RestController
|
import org.springframework.web.bind.annotation.RestController
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ public class ProductController @Autowired constructor(private val productService
|
|||||||
fun product():List<ProductWithOrderDetail>{
|
fun product():List<ProductWithOrderDetail>{
|
||||||
return productService.fetchAllProducts()
|
return productService.fetchAllProducts()
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/api/product/getproduct")
|
@GetMapping("/api/product/getproduct")
|
||||||
fun getAllProduct():List<Product>{
|
fun getAllProduct():List<Product>{
|
||||||
return productRepo.readAllRecord()
|
return productRepo.readAllRecord()
|
||||||
|
@ -72,4 +72,5 @@ public class Customer implements Serializable {
|
|||||||
@JsonManagedReference
|
@JsonManagedReference
|
||||||
@OneToMany(mappedBy = "customer")
|
@OneToMany(mappedBy = "customer")
|
||||||
private List<Order> orders;
|
private List<Order> orders;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,11 @@ public class Order implements Serializable {
|
|||||||
@JoinColumn(name = "cusId",nullable = false,referencedColumnName = "id")
|
@JoinColumn(name = "cusId",nullable = false,referencedColumnName = "id")
|
||||||
private Customer customer;
|
private Customer customer;
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JsonBackReference
|
||||||
|
@JoinColumn(name = "sid",nullable = false,referencedColumnName = "id")
|
||||||
|
private Staff staff;
|
||||||
|
|
||||||
|
|
||||||
@OneToMany(mappedBy = "order")
|
@OneToMany(mappedBy = "order")
|
||||||
private List<OrderDetail> orderDetails;
|
private List<OrderDetail> orderDetails;
|
||||||
@ -39,6 +44,14 @@ public class Order implements Serializable {
|
|||||||
return orderId;
|
return orderId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Staff getStaff() {
|
||||||
|
return staff;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStaff(Staff staff) {
|
||||||
|
this.staff = staff;
|
||||||
|
}
|
||||||
|
|
||||||
public void setOrderId(Long orderId) {
|
public void setOrderId(Long orderId) {
|
||||||
this.orderId = orderId;
|
this.orderId = orderId;
|
||||||
}
|
}
|
||||||
@ -80,10 +93,11 @@ public class Order implements Serializable {
|
|||||||
public Order() {
|
public Order() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Order(Long orderId,Date orderDate,double amount,Customer customer,List<OrderDetail> orderDetails) {
|
public Order(Long orderId,Date orderDate,double amount,Customer customer,List<OrderDetail> orderDetails,Staff staff) {
|
||||||
this.orderId=orderId;
|
this.orderId=orderId;
|
||||||
this.orderDate=orderDate;
|
this.orderDate=orderDate;
|
||||||
this.amount=amount;
|
this.amount=amount;
|
||||||
this.orderDetails=orderDetails;
|
this.orderDetails=orderDetails;
|
||||||
|
this.staff=staff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
25
src/main/kotlin/com/chantha/jdbc/jpa/model/Position.java
Normal file
25
src/main/kotlin/com/chantha/jdbc/jpa/model/Position.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package com.chantha.jdbc.jpa.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Data
|
||||||
|
public class Position {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
private String tittle;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "position")
|
||||||
|
@JsonManagedReference
|
||||||
|
private List<Staff> staff;
|
||||||
|
}
|
33
src/main/kotlin/com/chantha/jdbc/jpa/model/Staff.java
Normal file
33
src/main/kotlin/com/chantha/jdbc/jpa/model/Staff.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package com.chantha.jdbc.jpa.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class Staff {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
private Gender gender;
|
||||||
|
private double salary;
|
||||||
|
|
||||||
|
|
||||||
|
@JsonManagedReference
|
||||||
|
@OneToMany(mappedBy = "staff")
|
||||||
|
private List<Order> orderList;
|
||||||
|
|
||||||
|
@JsonBackReference
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY,cascade = CascadeType.ALL)
|
||||||
|
@JoinColumn(name = "posId",nullable = false,referencedColumnName = "id")
|
||||||
|
private Position position;
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
BIN
target/classes/com/chantha/jdbc/jpa/model/Position.class
Normal file
BIN
target/classes/com/chantha/jdbc/jpa/model/Position.class
Normal file
Binary file not shown.
BIN
target/classes/com/chantha/jdbc/jpa/model/Staff.class
Normal file
BIN
target/classes/com/chantha/jdbc/jpa/model/Staff.class
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user