Exemplo n.º 1
0
  @RequestMapping(
      value = "ajax/{id}/rename",
      method = RequestMethod.GET,
      produces = "application/json")
  @ResponseBody
  public Object ajaxRename(
      HttpServletRequest request,
      @PathVariable("id") M tree,
      @RequestParam("newName") String newName) {

    if (permissionList != null) {
      permissionList.assertHasUpdatePermission();
    }

    tree.setName(newName);
    baseService.update(tree);
    return convertToZtree(tree, true, true);
  }
Exemplo n.º 2
0
  @RequestMapping(value = "{id}/update", method = RequestMethod.GET)
  public String updateForm(
      @PathVariable("id") M m, Model model, RedirectAttributes redirectAttributes) {

    if (permissionList != null) {
      permissionList.assertHasUpdatePermission();
    }

    if (m == null) {
      redirectAttributes.addFlashAttribute(Constants.ERROR, "您修改的数据不存在!");
      return redirectToUrl(viewName("success"));
    }

    setCommonData(model);
    model.addAttribute("m", m);
    model.addAttribute(Constants.OP_NAME, "修改");
    return viewName("editForm");
  }
Exemplo n.º 3
0
  @RequestMapping(value = "{id}/update", method = RequestMethod.POST)
  public String update(
      Model model,
      @ModelAttribute("m") M m,
      BindingResult result,
      RedirectAttributes redirectAttributes) {

    if (permissionList != null) {
      permissionList.assertHasUpdatePermission();
    }

    if (result.hasErrors()) {
      return updateForm(m, model, redirectAttributes);
    }

    baseService.update(m);
    redirectAttributes.addFlashAttribute(Constants.MESSAGE, "修改成功");
    return redirectToUrl(viewName("success"));
  }