package com.wages.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import com.wages.dao.DepartmentDao;
import com.wages.dao.StaffDao;
import com.wages.hentity.Department;
import com.wages.hentity.Staff;
public class StaffAction {
private StaffDao staffDao;
private DepartmentDao departmentDao;
public DepartmentDao getDepartmentDao() {
return departmentDao;
}
public void setDepartmentDao(DepartmentDao departmentDao) {
this.departmentDao = departmentDao;
}
public StaffDao getStaffDao() {
return staffDao;
}
public void setStaffDao(StaffDao staffDao) {
this.staffDao = staffDao;
}
public Staff sta;
public Staff getSta() {
return sta;
}
public void setSta(Staff sta) {
this.sta = sta;
}
// 查
public String staffs() {
HttpServletRequest request = ServletActionContext.getRequest();
List<Staff> staffs = staffDao.staffs();
request.setAttribute("staffs", staffs);
return "departments";
}
// 改
public String staffDetail() {
HttpServletRequest request = ServletActionContext.getRequest();
Staff curStaff = staffDao.queryStaff(sta.getStaffId());
request.setAttribute("curStaff", curStaff);
List<Department> departments = departmentDao.department();
request.setAttribute("departments", departments);
return "staffDetail";
}
public String updateStaff()
{
staffDao.updateStaff(sta);
return staffs();
}
//删
public String delStaffs() {
staffDao.delStaff(sta.getStaffId());
return staffs();
}
////增
public String staffAdd() {
staffDao.staffAdd(sta);
return staffs();
}
// 查已拥有的部门
public String departmentId() {
HttpServletRequest request = ServletActionContext.getRequest();
List<Department> departments = departmentDao.department();
request.setAttribute("departments", departments);
return "addStaff";
}
}
最近下载更多
255921158 LV5
2024年7月17日
pangzhihui LV14
2024年5月15日
阿昌先生 LV13
2024年3月26日
wuying8208 LV15
2023年11月25日
hz1109 LV7
2023年11月7日
微信网友_6482083022819328 LV14
2023年5月22日
qfch120 LV8
2023年3月28日
13655961071 LV5
2022年12月24日
微信网友_6254095067451392 LV3
2022年12月9日
zhaoyangwfd LV17
2022年10月11日
最近浏览更多
奋斗的小蚂蚁 LV17
10月17日
benben2020
3月19日
暂无贡献等级
571818771 LV3
2024年12月17日
随便取个名字_哈哈 LV27
2024年11月23日
微信网友_7253744540979200 LV1
2024年11月14日
zhangsan_lisi
2024年9月18日
暂无贡献等级
255921158 LV5
2024年7月17日
quartz LV8
2024年7月1日
educationAAA LV11
2024年6月23日
ailixiya LV1
2024年6月11日

