@RequestMapping("party-entity-remove")
  public String remove(
      @RequestParam("selectedItem") List<Long> selectedItem,
      RedirectAttributes redirectAttributes) {
    partyEntityManager.removeAll(partyEntityManager.findByIds(selectedItem));
    messageHelper.addFlashMessage(redirectAttributes, "core.success.delete", "删除成功");

    return "redirect:/party/party-entity-list.do";
  }
  @RequestMapping("party-entity-list")
  public String list(
      @ModelAttribute Page page, @RequestParam Map<String, Object> parameterMap, Model model) {
    String tenantId = tenantHolder.getTenantId();
    List<PropertyFilter> propertyFilters = PropertyFilter.buildFromMap(parameterMap);
    propertyFilters.add(new PropertyFilter("EQS_tenantId", tenantId));
    page = partyEntityManager.pagedQuery(page, propertyFilters);
    model.addAttribute("page", page);

    return "party/party-entity-list";
  }
  @RequestMapping("party-entity-input")
  public String input(@RequestParam(value = "id", required = false) Long id, Model model) {
    String tenantId = tenantHolder.getTenantId();

    if (id != null) {
      PartyEntity partyEntity = partyEntityManager.get(id);
      model.addAttribute("model", partyEntity);
    }

    List<PartyType> partyTypes = partyTypeManager.findBy("tenantId", tenantId);
    model.addAttribute("partyTypes", partyTypes);

    return "party/party-entity-input";
  }
  @RequestMapping("party-entity-save")
  public String save(
      @ModelAttribute PartyEntity partyEntity,
      @RequestParam("partyTypeId") Long partyTypeId,
      RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    PartyEntity dest = null;
    Long id = partyEntity.getId();

    if (id != null) {
      dest = partyEntityManager.get(id);
      beanMapper.copy(partyEntity, dest);
    } else {
      dest = partyEntity;
      dest.setTenantId(tenantId);
    }

    dest.setPartyType(partyTypeManager.get(partyTypeId));
    partyEntityManager.save(dest);

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

    return "redirect:/party/party-entity-list.do";
  }
  @RequestMapping("party-entity-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 = partyEntityManager.pagedQuery(page, propertyFilters);

    List<PartyEntity> partyEntities = (List<PartyEntity>) page.getResult();
    List<PartyEntityDTO> partyDtos = partyEntityConverter.createPartyEntityDtos(partyEntities);
    TableModel tableModel = new TableModel();
    tableModel.setName("party entity");
    tableModel.addHeaders("id", "type", "code", "name");
    tableModel.setData(partyDtos);
    exportor.export(request, response, tableModel);
  }