@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";
  }