SQL 语句:
select *
from employees e
left join dept_emp de on e.emp_no = de.emp_no
left join dept_manager dm on e.emp_no = dm.emp_no
left join salaries s on e.emp_no = s.emp_no
where e.emp_no = 10001
查询结果:
https://i.imgur.com/CYXwtvu.png
生成的 PoJo:
@lombok.Data
@lombok.NoArgsConstructor
@lombok.AllArgsConstructor
public class Demo {
private long empNo ;//employees
private java.util.Date birthDate ;//employees
private String firstName ;//employees
private String lastName ;//employees
private String gender ;//employees
private java.util.Date hireDate ;//employees
private long empNo ;//dept_emp
private String deptNo ;//dept_emp
private java.util.Date fromDate ;//dept_emp
private java.util.Date toDate ;//dept_emp
private long empNo ;//dept_manager
private String deptNo ;//dept_manager
private java.util.Date fromDate ;//dept_manager
private java.util.Date toDate ;//dept_manager
private long empNo ;//salaries
private long salary ;//salaries
private java.util.Date fromDate ;//salaries
private java.util.Date toDate ;//salaries
}
脚本地址:
https://gist.github.com/lihongjie0209/0d8a3b4504888e8981f5530479164fc7
说明: