|
@@ -1,6 +1,8 @@ |
|
|
package com.ffii.tsms.modules.data.entity; |
|
|
package com.ffii.tsms.modules.data.entity; |
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonBackReference; |
|
|
import com.fasterxml.jackson.annotation.JsonBackReference; |
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo; |
|
|
|
|
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators; |
|
|
import com.ffii.core.entity.BaseEntity; |
|
|
import com.ffii.core.entity.BaseEntity; |
|
|
import com.ffii.tsms.modules.user.entity.User; |
|
|
import com.ffii.tsms.modules.user.entity.User; |
|
|
import jakarta.persistence.*; |
|
|
import jakarta.persistence.*; |
|
@@ -8,6 +10,9 @@ import jakarta.validation.constraints.NotNull; |
|
|
|
|
|
|
|
|
@Entity |
|
|
@Entity |
|
|
@Table(name = "team") |
|
|
@Table(name = "team") |
|
|
|
|
|
@JsonIdentityInfo( |
|
|
|
|
|
generator = ObjectIdGenerators.PropertyGenerator.class, |
|
|
|
|
|
property = "id") |
|
|
public class Team extends BaseEntity<Long> { |
|
|
public class Team extends BaseEntity<Long> { |
|
|
@Column(name = "description", length = 1500) |
|
|
@Column(name = "description", length = 1500) |
|
|
private String description; |
|
|
private String description; |
|
@@ -22,14 +27,10 @@ public class Team extends BaseEntity<Long> { |
|
|
|
|
|
|
|
|
@NotNull |
|
|
@NotNull |
|
|
@OneToOne |
|
|
@OneToOne |
|
|
@JsonBackReference |
|
|
|
|
|
|
|
|
// @JsonBackReference |
|
|
@JoinColumn(name = "teamLead", unique = true) |
|
|
@JoinColumn(name = "teamLead", unique = true) |
|
|
private Staff staff; |
|
|
private Staff staff; |
|
|
|
|
|
|
|
|
// @NotNull |
|
|
|
|
|
@OneToOne(mappedBy = "team", cascade = CascadeType.ALL, orphanRemoval = true) |
|
|
|
|
|
private Staff teamLead; |
|
|
|
|
|
|
|
|
|
|
|
public String getDescription() { |
|
|
public String getDescription() { |
|
|
return description; |
|
|
return description; |
|
|
} |
|
|
} |
|
@@ -58,5 +59,5 @@ public class Team extends BaseEntity<Long> { |
|
|
|
|
|
|
|
|
public void setStaff(Staff staff) { this.staff = staff; } |
|
|
public void setStaff(Staff staff) { this.staff = staff; } |
|
|
|
|
|
|
|
|
public Staff getTeamLead() { return teamLead;} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |