-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmp.java
More file actions
67 lines (55 loc) · 1.48 KB
/
Emp.java
File metadata and controls
67 lines (55 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package app.entity;
import app.dto.EmpDto;
import app.entity.Dept;
import jakarta.persistence.*;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import java.time.LocalDate;
@NoArgsConstructor
@Getter
@ToString
@Builder
@Entity
public class Emp {
@Id
@Column(name = "empno")
private Integer empno;
@Column(name = "ename")
private String ename;
@Column(name = "job")
private String job;
@Column(name = "mgr")
private Integer mgr;
@Column(name = "hiredate")
private LocalDate hiredate;
@Column(name = "sal")
private Double sal;
@Column(name = "comm")
private Double comm;
@ManyToOne
@JoinColumn(name = "deptno")
private Dept dept;
@Builder
public Emp(int empno, String ename, String job, Integer mgr, LocalDate hiredate, Double sal, Double comm, Dept dept) {
this.empno = empno;
this.ename = ename;
this.job = job;
this.mgr = mgr;
this.hiredate = hiredate;
this.sal = sal;
this.comm = comm;
this.dept = dept;
}
public void updateInfo(EmpDto updateEmp, Dept updateDept) {
this.empno = updateEmp.getEmpno();
this.ename = updateEmp.getEname();
this.job = updateEmp.getJob();
this.mgr = updateEmp.getMgr();
this.hiredate = updateEmp.getHiredate();
this.sal = updateEmp.getSal();
this.comm = updateEmp.getComm();
this.dept = updateDept;
}
}