/** * 员工实体类 * 遵循单一职责原则,只负责表示员工的基本信息 */ package com.employeetraining.model; import java.util.Objects; public class Employee { private String employeeId; private String name; private String department; private String position; private double salary; private String email; public Employee() { } public Employee(String employeeId, String name, String department, String position, double salary, String email) { this.employeeId = employeeId; this.name = name; this.department = department; this.position = position; this.salary = salary; this.email = email; } // Getters and Setters public String getEmployeeId() { return employeeId; } public void setEmployeeId(String employeeId) { this.employeeId = employeeId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDepartment() { return department; } public void setDepartment(String department) { this.department = department; } public String getPosition() { return position; } public void setPosition(String position) { this.position = position; } public double getSalary() { return salary; } public void setSalary(double salary) { this.salary = salary; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Employee employee = (Employee) o; return Objects.equals(employeeId, employee.employeeId); } @Override public int hashCode() { return Objects.hash(employeeId); } @Override public String toString() { return "Employee{" + "employeeId='" + employeeId + '\'' + ", name='" + name + '\'' + ", department='" + department + '\'' + ", position='" + position + '\'' + ", salary=" + salary + ", email='" + email + '\'' + '}'; } }