コード例 #1
0
  @RequestMapping(value = "/index", method = RequestMethod.GET)
  @ResponseBody
  public ModelAndView Index(
      Integer departmentId,
      Boolean inUse,
      HttpSession session,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    String lcode = "employee";
    Boolean hasAuthority = SystemCache.hasAuthority(session, lcode);
    if (!hasAuthority) {
      throw new PermissionDeniedDataAccessException("没有员工管理的权限", null);
    }

    request.setAttribute("departmentlist", SystemCache.departmentlist);
    if (departmentId == null) {
      if (inUse == null) {
        request.setAttribute("employeelist", SystemCache.employeelist);
      } else {
        List<Employee> list = new ArrayList<Employee>();
        for (Employee e : SystemCache.employeelist) {
          if (inUse == e.getInUse()) {
            list.add(e);
          }
        }
        request.setAttribute("employeelist", list);
      }
    } else {
      List<Employee> list = new ArrayList<Employee>();
      for (Employee e : SystemCache.employeelist) {
        if (inUse == null) {
          if (e.getDepartmentId() == departmentId) {
            list.add(e);
          }
        } else {
          if (e.getDepartmentId() == departmentId && inUse == e.getInUse()) {
            list.add(e);
          }
        }
      }
      request.setAttribute("employeelist", list);
    }

    //		String tabname = request.getParameter("tab");
    //		Map<String,Object> model = new HashMap<String,Object>();
    //		model.put("tab", tabname);
    return new ModelAndView("systeminfo/employee");
  }
コード例 #2
0
 // 2015-5-10花名册
 @RequestMapping(value = "/list", method = RequestMethod.GET)
 @ResponseBody
 public ModelAndView list(
     Boolean inUse, HttpSession session, HttpServletRequest request, HttpServletResponse response)
     throws Exception {
   String lcode = "renshi/employees";
   Boolean hasAuthority = SystemCache.hasAuthority(session, lcode);
   if (!hasAuthority) {
     throw new PermissionDeniedDataAccessException("没有查看花名册的权限", null);
   }
   if (inUse == null) {
     request.setAttribute("employeelist", SystemCache.employeelist);
   } else {
     List<Employee> list = new ArrayList<Employee>();
     for (Employee e : SystemCache.employeelist) {
       if (inUse == e.getInUse()) {
         list.add(e);
       }
     }
     request.setAttribute("employeelist", list);
   }
   return new ModelAndView("employee/list");
 }