46 lines
1.3 KiB
Java
46 lines
1.3 KiB
Java
package com.example.nto.entity;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
import jakarta.persistence.*;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
@Entity
|
|
@Table(name = "employee")
|
|
public class Employee {
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
private long id;
|
|
|
|
private String name;
|
|
|
|
@Column(unique = true)
|
|
private String code;
|
|
|
|
private String photoUrl;
|
|
|
|
@OneToMany(mappedBy = "employee", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
|
@JsonIgnore
|
|
private List<Booking> bookingList = new ArrayList<>();
|
|
|
|
public Employee() {}
|
|
|
|
public Employee(String name, String code, String photoUrl) {
|
|
this.name = name;
|
|
this.code = code;
|
|
this.photoUrl = photoUrl;
|
|
}
|
|
|
|
public long getId() { return id; }
|
|
public void setId(long id) { this.id = id; }
|
|
public String getName() { return name; }
|
|
public void setName(String name) { this.name = name; }
|
|
public String getCode() { return code; }
|
|
public void setCode(String code) { this.code = code; }
|
|
public String getPhotoUrl() { return photoUrl; }
|
|
public void setPhotoUrl(String photoUrl) { this.photoUrl = photoUrl; }
|
|
public List<Booking> getBookingList() { return bookingList; }
|
|
public void setBookingList(List<Booking> bookingList) { this.bookingList = bookingList; }
|
|
}
|