93 lines
2.6 KiB
Java
93 lines
2.6 KiB
Java
package com.srsystem.entity;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
import com.srsystem.entity.enums.DispatchStatus;
|
|
import com.srsystem.entity.enums.EmpStatus;
|
|
import com.srsystem.entity.enums.RoleCode;
|
|
import jakarta.persistence.*;
|
|
import lombok.*;
|
|
import org.hibernate.annotations.SQLDelete;
|
|
import org.hibernate.annotations.SQLRestriction;
|
|
|
|
import java.time.LocalDate;
|
|
import java.util.List;
|
|
|
|
@Entity
|
|
@Table(name = "tb_employee")
|
|
@Getter
|
|
@Setter
|
|
@NoArgsConstructor
|
|
@AllArgsConstructor
|
|
@Builder
|
|
@SQLDelete(sql = "UPDATE tb_employee SET is_deleted = 'Y' WHERE id = ?")
|
|
@SQLRestriction("is_deleted = 'N'")
|
|
public class Employee extends BaseEntity {
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sq_employees")
|
|
@SequenceGenerator(name = "sq_employees", sequenceName = "sq_employees", allocationSize = 50)
|
|
@Column(name = "id")
|
|
private Long empId;
|
|
|
|
@Column(name = "login_id", nullable = false, unique = true, length = 50)
|
|
private String loginId;
|
|
|
|
@Column(name = "password", nullable = false)
|
|
private String password;
|
|
|
|
@Column(name = "name", nullable = false, length = 100)
|
|
private String name;
|
|
|
|
@Column(name = "email", length = 255)
|
|
private String email;
|
|
|
|
@Column(name = "phone", length = 20)
|
|
private String phone;
|
|
|
|
@Builder.Default
|
|
@Enumerated(EnumType.STRING)
|
|
@Column(name = "role_code", nullable = false, length = 20)
|
|
private RoleCode roleCode = RoleCode.EMPLOYEE;
|
|
|
|
@Builder.Default
|
|
@Enumerated(EnumType.STRING)
|
|
@Column(name = "emp_status", nullable = false, length = 20)
|
|
private EmpStatus empStatus = EmpStatus.ACTIVE;
|
|
|
|
@Builder.Default
|
|
@Enumerated(EnumType.STRING)
|
|
@Column(name = "dispatch_status", nullable = false, length = 20)
|
|
private DispatchStatus dispatchStatus = DispatchStatus.WAITING;
|
|
|
|
@Column(name = "joined_date")
|
|
private LocalDate joinedDate;
|
|
|
|
@Column(name = "left_date")
|
|
private LocalDate leftDate;
|
|
|
|
@Column(name = "birth_date")
|
|
private LocalDate birthDate;
|
|
|
|
@Column(name = "education", length = 20)
|
|
private String education;
|
|
|
|
@Column(name = "major", length = 100)
|
|
private String major;
|
|
|
|
@Column(name = "school_name", length = 200)
|
|
private String schoolName;
|
|
|
|
@Column(name = "graduation_date")
|
|
private LocalDate graduationDate;
|
|
|
|
@Column(name = "residence", length = 255)
|
|
private String residence;
|
|
|
|
@Column(name = "profile_image", length = 500)
|
|
private String profileImage;
|
|
|
|
@OneToMany(mappedBy = "employee", cascade = CascadeType.ALL, orphanRemoval = true)
|
|
@OrderBy("sortOrder ASC")
|
|
private List<EmployeeEmergencyContact> emergencyContacts;
|
|
}
|