示例#1
0
 // 员工查看详细信息操作
 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");
 }
示例#2
0
 // 删除员工信息
 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");
 }
示例#3
0
  // 转向修改员工的页面
  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");
  }
示例#4
0
  // 转向员工录用的页面(inviteJob_query.jsp点击录用按钮时调用,之后跳转至/employee_employ.jsp)
  public ActionForward forwardEmploye(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    this.saveToken(request); // 利用Token(令牌)防止用户重复提交

    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); // desc降序排列,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; // 将ActionFrom强制转换成EmployeeFrom
    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");
  }