Задания Backend нто
Some checks failed
Android Test / validate-and-test (pull_request) Has been cancelled
Some checks failed
Android Test / validate-and-test (pull_request) Has been cancelled
This commit is contained in:
@@ -1,34 +1,47 @@
|
||||
package com.example.nto.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: ДОРАБОТАТЬ в рамках задания
|
||||
* =================================
|
||||
* МОЖНО: Добавлять методы, аннотации, зависимости
|
||||
* НЕЛЬЗЯ: Изменять название класса и пакета
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@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)
|
||||
private List<Booking> bookingList;
|
||||
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; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user