企业人事管理系统
完成一个企业人事管理系统,该系统中包含两个实体类:员工(Emp),部门(Dept),两个类中分别包含以下属性:
员工(工号,姓名,性别,职位,年龄,月薪,部门)
部门(编号,部门名,部门介绍,分机号,)
要求实现以下功能:
完成部门的创建,添加3个部门
向各个部门中添加若干员工
查询所有的员工信息和所在的部门信息
根据员工工号显示员工信息和所在的部门信息
修改指定工号员工的薪资
根据部门号查询出门中的所有员工
部门类:
根据需求,先创立一个部门类,在部门类中加入一个带员工类的链表,将每次向此部门添加的员工都放入本链表中:
package com;
import java.util.ArrayList;
public class Section {
private Integer deptid;
private String deptname;
private String deptsynopsis;
private Integer deptnumber;
private ArrayList<EmployeeData> emps;
public Section(Integer deptid, String deptname, String deptsynopsis, Integer deptnumber) {
super();
this.emps = new ArrayList<EmployeeData>(); //创建一个员工类的链表
this.deptid = deptid;
this.deptname = deptname;
this.deptsynopsis = deptsynopsis;
this.deptnumber = deptnumber;
}
protected Integer getDeptid() {
return deptid;
}
protected void setDeptid(Integer deptid) {
this.deptid = deptid;
}
protected String getDeptname() {
return deptname;
}
protected void setDeptname(String deptname) {
this.deptname = deptname;
}
protected String getDeptsynopsis() {
return deptsynopsis;
}
protected void setDeptsynopsis(String deptsynopsis) {
this.deptsynopsis = deptsynopsis;
}
protected Integer getDeptnumber() {
return deptnumber;
}
protected void setDeptnumber(Integer deptnumber) {
this.deptnumber = deptnumber;
}
protected ArrayList<EmployeeData> getEmps() {
return emps;
}
protected void setEmps(ArrayList<EmployeeData> emps) {
this.emps = emps;
}
@Override
public String toString() {
return "部门Id为 " + deptid + ",部门名 " + deptname + ",部门介绍 " + deptsynopsis + ",部门分机号 " + deptnumber + "]";
}
public Section() {
super();
this.emps = new ArrayList<EmployeeData>();
}
}
员工类:
创建一个员工类,用于保存员工信息,其中输入部门,以此将其加入相应的部门中
package com;
public class EmployeeData {
private Integer id;
private String name;
private String sex;
private String position;
private Integer age;
private Double salary;
private String section;
public EmployeeData(Integer id, String name, String sex, String position, Integer age, Double salary,
String section) {
super();
this.id = id;
this.name = name;
this.sex = sex;
this.position = position;
this.age = age;
this.salary = salary;
this.section = section;
}
protected Integer getId() {
return id;
}