package com.wy.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import com.wy.dao.ObjectDao;
import com.wy.form.DepartmentForm;
import com.wy.form.EmployeeForm;
import com.wy.form.InviteJobForm;
import com.wy.form.ManagerForm;
import com.wy.tool.GetAutoNumber;
public class EmployeeAction extends DispatchAction {
private ObjectDao objectDao;
public ObjectDao getObjectDao() {
return objectDao;
}
public void setObjectDao(ObjectDao objectDao) {
this.objectDao = objectDao;
}
// 转向员工录用的页面
public ActionForward forwardEmploye(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
this.saveToken(request);
String condition = "from EmployeeForm order by id desc";
List list = objectDao.getObjectList(condition);
String autoNumber = "1";
if (list.size() != 0) {
EmployeeForm employeeform = (EmployeeForm) list.get(0);
Integer em_serialNumber = Integer.valueOf(employeeform.getId()) + 1;
autoNumber = String.valueOf(em_serialNumber);
}
autoNumber = GetAutoNumber.getMaxNuber(autoNumber);
request.setAttribute("departmentList", objectDao
.getObjectList("from DepartmentForm"));
EmployeeForm employeeForm =(EmployeeForm)form;
String id = request.getParameter("id");
InviteJobForm inviteJobForm = (InviteJobForm) objectDao
.getObjectForm("from InviteJobForm where id='" + id + "'");
employeeForm.setEm_serialNumber(autoNumber);//将员工编号自动赋值
employeeForm.setEm_name(inviteJobForm.getName());//将员工姓名赋值
employeeForm.setEm_afterschool(inviteJobForm.getAfterSchool());//将员工的毕业学校自动赋值
employeeForm.setEm_sex(inviteJobForm.getSex());//将员工的性别赋值
employeeForm.setEm_born(inviteJobForm.getBorn());//将员工的出生日期赋值
employeeForm.setEm_address(inviteJobForm.getAddress());//将员工地址赋值
employeeForm.setEm_culture(inviteJobForm.getTeachSchool());//将员工的文化程度赋值
employeeForm.setEm_tel(inviteJobForm.getTel());//将员工电话赋值
employeeForm.setEm_speciality(inviteJobForm.getSpecialty());//将员工所学专业赋值
request.setAttribute("employeeForm", employeeForm);
request.setAttribute("id", id);
return mapping.findForward("forwardEmploy");
}
//员工录用
public ActionForward addEmployee(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
EmployeeForm employeeForm = (EmployeeForm) form;
if (this.isTokenValid(request)) {
this.resetToken(request);
objectDao.insertObjectForm(employeeForm);
} else {
this.saveToken(request);
request.setAttribute("result", "不能重复提交!!!");
}
request.setAttribute("id", request.getParameter("id"));
return mapping.findForward("operationEmployee");
}
// 员工查看详细信息操作
public ActionForward queryOneEmployee(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
String em_serialNumber = request.getParameter("em_serialNumber");
String condition = "from EmployeeForm where em_serialNumber='"
+ em_serialNumber + "'";
EmployeeForm employeeForm = (EmployeeForm) objectDao
.getObjectForm(condition);
request.setAttribute("employeeForm", employeeForm);
request.setAttribute("departmentList", objectDao
.getObjectList("from DepartmentForm"));
return mapping.findForward("queryOneEmployee");
}
// 员工查看操作
public ActionForward queryEmployee(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
List list = null;
String condition = "from EmployeeForm order by id desc";
if (request.getParameter("departmentId") != null) {
String em_departmentId = request.getParameter("departmentId");
condition = "from EmployeeForm where em_departmentId='"
+ em_departmentId + "' order by id desc";
request.setAttribute("departmentId", em_departmentId);
}
list = objectDao.getObjectList(condition);
request.setAttribute("list", list);
request.setAttribute("departmentList", objectDao
.getObjectList("from DepartmentForm"));
return mapping.findForward("queryEmployee");
}
// 转向添加员工的页面
public ActionForward forwardInsertEmployee(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
this.saveToken(request);
String condition = "from EmployeeForm order by id desc";
List list = objectDao.getObjectList(condition);
String autoNumber = "1";
if (list.size() != 0) {
EmployeeForm employeeform = (EmployeeForm) list.get(0);
Integer em_serialNumber = Integer.valueOf(employeeform.getId()) + 1;
autoNumber = String.valueOf(em_serialNumber);
}
autoNumber = GetAutoNumber.getMaxNuber(autoNumber);
request.setAttribute("autoNumber", autoNumber);
request.setAttribute("departmentList", objectDao
.getObjectList("from DepartmentForm"));
return mapping.findForward("forwardInsertEmployee");
}
// 添加员工
public ActionForward saveEmployee(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
EmployeeForm employeeForm = (EmployeeForm) form;
if (this.isTokenValid(request)) {
this.resetToken(request);
objectDao.insertObjectForm(employeeForm);
} else {
this.saveToken(request);
request.setAttribute("result", "不能重复提交!!!");
}
return queryEmployee(mapping, form, request, response);
}
// 转向修改员工的页面
public ActionForward forwardUpdateEmployee(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
this.saveToken(request);
String em_serialNumber = request.getParameter("em_serialNumber");
String condition = "from EmployeeForm where em_serialNumber='"
+ em_serialNumber + "'";
EmployeeForm employeeForm = (EmployeeForm) objectDao
.getObjectForm(condition);
System.out.println("3213=" + employeeForm.getEm_sex());
request.setAttribute("employeeForm", employeeForm);
request.setAttribute("departmentList", objectDao
.getObjectList("from DepartmentForm"));
return mapping.findForward("forwardUpdateEmployee");
}
// 修改员工
public ActionForward updateEmployee(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
EmployeeForm employeeForm = (EmployeeForm) form;
if (this.isTokenValid(request)) {
this.resetToken(request);
objectDao.updateObjectForm(employeeForm);
} else {
this.saveToken(request);
request.setAttribute("result", "不能重复提交!!!");
}
return queryEmployee(mapping, form, request, response);
}
// 删除员工信息
public ActionForward deleteEmployee(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String em_serialNumber = request.getParameter("em_serialNumber");
String condition = "from EmployeeForm where em_serialNumber='"
+ em_serialNumber + "'";
EmployeeForm employeeForm = (EmployeeForm) objectDao
.getObjectForm(condition);
if (!objectDao.deleteObjectForm(employeeForm)) {
request.setAttribute("result", "删除员工信息失败,可能还存在其他的信息");
}
return mapping.findForward("operationEmployee");
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
java期末大作业 基于Java+JSP实现的企业人力资源管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业人力资源管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业人力资源管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业人力资源管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业人力资源管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业人力资源管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业人力资源管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业人力资源管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业人力资源管理系统源码(含SQL数据库文件) java期末大作业 基于Java+JSP实现的企业人力资源管理系统源码(含SQL数据库文件)
资源推荐
资源详情
资源评论
收起资源包目录
java期末大作业 基于Java+JSP实现的企业人力资源管理系统源码(含SQL数据库文件) (180个子文件)
EmployeeAction.class 6KB
EmployeeForm.class 5KB
PayAction.class 4KB
MyPagination.class 4KB
ManagerAction.class 4KB
InviteJobAction.class 3KB
InviteJobForm.class 3KB
CjAction.class 3KB
DepartmentAction.class 3KB
TrainAction.class 3KB
PayForm.class 3KB
TrainForm.class 2KB
ObjectDao.class 2KB
CjForm.class 2KB
DepartmentForm.class 1KB
ManagerForm.class 1KB
GetSystemTime.class 1KB
SelfRequestProcessor.class 967B
GetAutoNumber.class 759B
.classpath 836B
org.eclipse.wst.common.component 469B
org.eclipse.wst.jsdt.ui.superType.container 49B
style.css 3KB
Thumbs.db 42KB
constituteTrain.gif 4KB
addEmployee.gif 4KB
constituteDeal.gif 4KB
constituteCompensation.gif 4KB
addInvite.gif 4KB
addDepartment.gif 4KB
land.gif 3KB
top-1.gif 2KB
top-2.gif 2KB
top-3.gif 2KB
top-11.gif 1KB
top-33.gif 1KB
top-22.gif 1KB
spring.jar 2.57MB
hibernate3.jar 2.08MB
classes12.jar 1.84MB
axis.jar 1.53MB
commons-collections.jar 546KB
struts.jar 531KB
c3p0-0.9.0.jar 476KB
mysql-connector-java-3.1.12-bin.jar 436KB
antlr-2.7.6.jar 433KB
antlr-2.7.5H3.jar 423KB
quartz-1.5.2.jar 380KB
velocity-1.4.jar 353KB
cglib-nodep-2.1_3.jar 317KB
dom4j-1.6.1.jar 307KB
msbase.jar 278KB
spring-hibernate.jar 190KB
commons-beanutils.jar 184KB
commons-digester.jar 164KB
junit.jar 118KB
commons-dbcp.jar 105KB
commons-validator.jar 82KB
commons-io.jar 82KB
hessian-2.1.12.jar 81KB
commons-discovery.jar 70KB
jakarta-oro.jar 64KB
msutil.jar 58KB
ehcache-1.1.jar 46KB
spring-mock.jar 44KB
commons-pool.jar 41KB
commons-logging.jar 37KB
jaxrpc.jar 30KB
commons-fileupload.jar 22KB
jta.jar 9KB
aopalliance.jar 4KB
EmployeeAction.java 8KB
EmployeeForm.java 4KB
PayAction.java 3KB
InviteJobAction.java 3KB
ManagerAction.java 3KB
MyPagination.java 3KB
InviteJobForm.java 3KB
CjAction.java 2KB
DepartmentAction.java 2KB
TrainAction.java 2KB
PayForm.java 2KB
ObjectDao.java 2KB
TrainForm.java 1KB
CjForm.java 1KB
ManagerForm.java 991B
DepartmentForm.java 751B
SelfRequestProcessor.java 713B
GetSystemTime.java 508B
GetAutoNumber.java 244B
managerLand.jpg 185KB
top2.jpg 97KB
top1.jpg 64KB
top3.jpg 39KB
down.jpg 30KB
center1.jpg 25KB
center2.jpg 15KB
mm_menu.js 30KB
validate.js 2KB
.jsdtscope 503B
共 180 条
- 1
- 2
资源评论
- m0_750927022024-01-14支持这个资源,内容详细,主要是能解决当下的问题,感谢大佬分享~
柯晓楠
- 粉丝: 2w+
- 资源: 2847
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功