刚整理资料发现还有几篇公司的面经没有上传
(数据库里增加一个字段,还有仿照今日校园可以每次请假递交的时候选择老师)没有学生和辅导员绑定关系
import
import com.sun.javafx.tools.packager.MakeAllParams;
import java.util.ArrayList;
import java.util.List;
public class DepartmentTest {
public static void main(String[] args) {
List<Department> allDepartment = new ArrayList<>();
Department dep1 = new Department(1, 0, "北京总部");
Department dep3 = new Department(3, 1, "研发中心");
Department dep4 = new Department(4, 3, "后端研发组");
Department dep6 = new Department(6, 4, "后端实习生组");
Department dep7 = new Department(7, 3, "前端研发组");
Department dep8 = new Department(8, 1, "产品部");
allDepartment.add(dep6);
allDepartment.add(dep7);
allDepartment.add(dep8);
allDepartment.add(dep1);
allDepartment.add(dep3);
allDepartment.add(dep4);
List<Department> subDepartments = DepartmentTest.getSub(3, allDepartment);
for (Department subDepartment : subDepartments) {
System.out.println(subDepartment);
}
}
/**
* 根据id,获取所有子部门列表(包括隔代子部门,一直到叶子节点)
* 要求:不能新增参数,不能增加static变量
* @param id
* @return
*/
//递归找pid
public static List<Department> getSub(int id, List<Department> allDepartment) {
List<Department> all = new ArrayList<>();
for(Department de :allDepartment){
if(de.id = id){
digui(Department de, allDepartment,all);
}
}
//}
public void static digui(Department de,allDepartment,all){
//出口
if(de = null){
return ;
}
for(Department de1: allDepartment){
if(de.pid = de.id ){
all.add(de1);
digui(de1,allDepartment);
return all;
}
}
}
return null;
}
}
class Department {
/** id */
private int id;
/** parent id */
private int pid;
/** 名称 */
private String name;
public Department(int id, int pid, String name) {
this.id = id;
this.pid = pid;
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getPid() {
return pid;
}
public void setPid(int pid) {
this.pid = pid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "Department{" +
"id=" + id +
", pid=" + pid +
", name='" + name + '\'' +
'}';
}
}
主要hrsass ,从招聘到发放offer
ehr体系(部门等等管理)
实习生主要做人事中专调离等