예제 #1
0
 @RequestMapping(value = "hr/add-init.htm")
 @AuthRole
 public String add(
     @ModelAttribute("staff") Staff staff,
     BindingResult result,
     ModelMap model,
     SystemUserAgent agent,
     Cookyjar cookyjar) {
   staff.setPageSize(100);
   staff = (Staff) staffService.getPaginatedStaff(staff);
   model.addAttribute("leaderlist", staff);
   return "hr/addStaff";
 }
예제 #2
0
  @AuthRole
  @RequestMapping(value = "/hr/add.htm", method = RequestMethod.POST)
  public String success(
      @ModelAttribute("staff") Staff staff,
      BindingResult result,
      ModelMap model,
      SystemUserAgent agent,
      Cookyjar cookyjar,
      @RequestParam("upfile") MultipartFile upfile)
      throws UploadFileException {
    UploadFileResult result2 = uploadManager.uploadFile(upfile);
    if (result2.isSuccess()) {
      int sum = CalLeave(staff);
      staff.setAnnualLeave(sum);
      staff.setPhoto(result2.getFilePath());
      staffService.save(staff);
    }

    return "redirect:/hr/list.htm";
  }