@RequestMapping(value = "role/audit")
 public ModelAndView auditRole(Integer roleId, Integer auditStatus) throws Exception {
   Map<String, Object> map = new HashMap<String, Object>();
   MapBindingResult result = new MapBindingResult(map, "");
   if (roleId == null || auditStatus == null) {
     FieldError error = new FieldError("sysRole", "roleName", "更新的角色不存在!");
     result.addError(error);
   } else {
     SysRole checkById = this.sysRoleUserService.selectOneRole(roleId);
     if (checkById == null) {
       FieldError error = new FieldError("sysRole", "roleName", "更新的角色不存在!");
       result.addError(error);
     }
   }
   if (result.hasErrors()) {
     List<SysRight> allRights = this.sysRoleUserService.findRights();
     RightModuleBuilder builder = RightModuleBuilder.initModules(allRights);
     map.put("builder", builder);
     return new ModelAndView("sys/sys_role_view", map);
   }
   // audit SysRole
   SysRole sysRole = this.sysRoleUserService.selectOneRole(roleId);
   sysRole.setAuditStatus(auditStatus);
   this.sysRoleUserService.auditRole(sysRole);
   //
   map.put("success_msg", "角色审核通过!");
   map.put("action", "update");
   return new ModelAndView("sys/sys_role_success", map);
 }
 @SuppressWarnings("unchecked")
 private static MultipartFile[] resolveMultipartFiles(
     HttpServletRequest request, MapBindingResult errors, String paramName) {
   if (request instanceof MultipartRequest) {
     try {
       Map<String, Object> map = ((MultipartRequest) request).getFileMap();
       MultipartFile[] multipartFiles = null;
       Object value = map.get(paramName);
       if (value instanceof MultipartFile) {
         multipartFiles = new MultipartFile[] {(MultipartFile) value};
       } else {
         multipartFiles = (MultipartFile[]) value;
       }
       return multipartFiles;
     } catch (Exception e) {
       errors.reject("fileuploaderror", e.getMessage());
     }
   }
   return null;
 }
  /**
   * 得到参数列表
   *
   * @param method
   * @param model
   * @param request
   * @param response
   * @param c
   * @return
   */
  @SuppressWarnings("unchecked")
  public static Object[] getArgs(
      Method method,
      Map<String, Object> model,
      HttpServletRequest request,
      HttpServletResponse response,
      Class<?> c) {
    Class<?>[] paramTypes = method.getParameterTypes();
    Object[] args = new Object[paramTypes.length];
    Map<String, Object> argMap = new HashMap<String, Object>(args.length);
    Map<String, String> pathValues = null;
    PathPattern pathPattern = method.getAnnotation(PathPattern.class);
    if (pathPattern != null) {
      String path = request.getRequestURI();
      int index = path.lastIndexOf('.');
      if (index != -1) {
        path = path.substring(0, index);
        String[] patterns = pathPattern.patterns();
        pathValues = getPathValues(patterns, path);
      }
    }
    MapBindingResult errors = new MapBindingResult(argMap, "");
    ParameterNameDiscoverer parameterNameDiscoverer =
        new LocalVariableTableParameterNameDiscoverer();
    for (int i = 0; i < paramTypes.length; i++) {
      Class<?> paramType = paramTypes[i];

      MethodParameter methodParam = new MethodParameter(method, i);
      methodParam.initParameterNameDiscovery(parameterNameDiscoverer);
      GenericTypeResolver.resolveParameterType(methodParam, c.getClass());

      String paramName = methodParam.getParameterName();
      // map
      if (Map.class.isAssignableFrom(paramType)) {
        args[i] = model;
      }
      // HttpServletRequest
      else if (HttpServletRequest.class.isAssignableFrom(paramType)) {
        args[i] = request;
      }
      // HttpServletResponse
      else if (HttpServletResponse.class.isAssignableFrom(paramType)) {
        args[i] = response;
      }
      // HttpSession
      else if (HttpSession.class.isAssignableFrom(paramType)) {
        args[i] = request.getSession();
      }
      // Errors
      else if (Errors.class.isAssignableFrom(paramType)) {
        args[i] = errors;
      }
      // MultipartFile
      else if (MultipartFile.class.isAssignableFrom(paramType)) {
        MultipartFile[] files = resolveMultipartFiles(request, errors, paramName);
        if (files != null && files.length > 0) {
          args[i] = files[0];
        }
      }
      // MultipartFile[]
      else if (MultipartFile[].class.isAssignableFrom(paramType)) {
        args[i] = resolveMultipartFiles(request, errors, paramName);
      } else {
        // 简单数据类型
        if (BeanUtils.isSimpleProperty(paramType)) {
          SimpleTypeConverter converter = new SimpleTypeConverter();
          Object value;
          // 是否是数组
          if (paramType.isArray()) {
            value = request.getParameterValues(paramName);
          } else {
            Object[] parameterAnnotations = methodParam.getParameterAnnotations();
            value = null;
            if (parameterAnnotations != null && parameterAnnotations.length > 0) {
              if (pathValues != null && pathValues.size() > 0) {
                for (Object object : parameterAnnotations) {
                  if (PathVariable.class.isInstance(object)) {
                    PathVariable pv = (PathVariable) object;
                    if (StringUtils.isEmpty(pv.value())) {
                      value = pathValues.get(paramName);
                    } else {
                      value = pathValues.get(pv.value());
                    }
                    break;
                  }
                }
              }
            } else {
              value = request.getParameter(paramName);
            }
          }
          try {
            args[i] = converter.convertIfNecessary(value, paramType, methodParam);
            model.put(paramName, args[i]);
          } catch (TypeMismatchException e) {
            errors.addError(new FieldError(paramName, paramName, e.getMessage()));
          }
        } else {
          // 复杂数据类型POJO类
          if (paramType.isArray()) {
            ObjectArrayDataBinder binder =
                new ObjectArrayDataBinder(paramType.getComponentType(), paramName);
            args[i] = binder.bind(request);
            model.put(paramName, args[i]);
          } else {
            Object bindObject = BeanUtils.instantiateClass(paramType);
            SummerServletRequestDataBinder binder =
                new SummerServletRequestDataBinder(bindObject, paramName);
            binder.bind(request);
            BindException be = new BindException(binder.getBindingResult());
            List<FieldError> fieldErrors = be.getFieldErrors();
            for (FieldError fieldError : fieldErrors) {
              errors.addError(fieldError);
            }
            args[i] = binder.getTarget();
            model.put(paramName, args[i]);
          }
        }
      }
    }
    return args;
  }