예제 #1
0
  @RequestMapping("perm-type-input")
  public String input(@RequestParam(value = "id", required = false) Long id, Model model) {
    if (id != null) {
      PermType permType = permTypeManager.get(id);
      model.addAttribute("model", permType);
    }

    return "auth/perm-type-input";
  }
예제 #2
0
  @RequestMapping("perm-type-save")
  public String save(@ModelAttribute PermType permType, RedirectAttributes redirectAttributes) {
    // copy
    PermType dest = null;
    Long id = permType.getId();

    if (id != null) {
      dest = permTypeManager.get(id);
      beanMapper.copy(permType, dest);
    } else {
      dest = permType;
    }

    if (id == null) {
      dest.setTenantId(tenantHolder.getTenantId());
    }

    // save
    permTypeManager.save(dest);

    messageHelper.addFlashMessage(redirectAttributes, "core.success.save", "保存成功");

    return "redirect:/auth/perm-type-list.do";
  }