@RequestMapping("perm-type-remove")
  public String remove(
      @RequestParam("selectedItem") List<Long> selectedItem,
      RedirectAttributes redirectAttributes) {
    List<PermType> permTypes = permTypeManager.findByIds(selectedItem);
    permTypeManager.removeAll(permTypes);
    messageHelper.addFlashMessage(redirectAttributes, "core.success.delete", "删除成功");

    return "redirect:/auth/perm-type-list.do";
  }
  @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";
  }
  @RequestMapping("perm-type-list")
  public String list(
      @ModelAttribute Page page, @RequestParam Map<String, Object> parameterMap, Model model) {
    List<PropertyFilter> propertyFilters = PropertyFilter.buildFromMap(parameterMap);
    propertyFilters.add(new PropertyFilter("EQS_tenantId", tenantHolder.getTenantId()));
    page = permTypeManager.pagedQuery(page, propertyFilters);
    model.addAttribute("page", page);

    return "auth/perm-type-list";
  }
  @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";
  }
  @RequestMapping("perm-type-export")
  public void export(
      @ModelAttribute Page page,
      @RequestParam Map<String, Object> parameterMap,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    List<PropertyFilter> propertyFilters = PropertyFilter.buildFromMap(parameterMap);
    page = permTypeManager.pagedQuery(page, propertyFilters);

    List<PermType> permTypees = (List<PermType>) page.getResult();
    TableModel tableModel = new TableModel();
    tableModel.setName("permType");
    tableModel.addHeaders("id", "type", "value", "perm.name", "priority", "app.name");
    tableModel.setData(permTypees);
    exportor.export(request, response, tableModel);
  }