@RequestMapping("job-type-save")
  public String save(
      @ModelAttribute JobType jobType,
      @RequestParam(value = "jobTypeId", required = false) Long jobTypeId,
      RedirectAttributes redirectAttributes) {
    String tenantId = tenantHolder.getTenantId();
    JobType dest = null;
    Long id = jobType.getId();

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

    if (jobTypeId != null) {
      dest.setJobType(jobTypeManager.get(jobTypeId));
    } else {
      dest.setJobType(null);
    }

    jobTypeManager.save(dest);

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

    return "redirect:/org/job-type-list.do";
  }
  @RequestMapping("job-type-input")
  public String input(@RequestParam(value = "id", required = false) Long id, Model model) {
    String tenantId = tenantHolder.getTenantId();

    if (id != null) {
      JobType jobType = jobTypeManager.get(id);
      model.addAttribute("model", jobType);
    }

    model.addAttribute("jobTypes", jobTypeManager.findBy("tenantId", tenantId));

    return "org/job-type-input";
  }
  @RequestMapping("job-type-remove")
  public String remove(
      @RequestParam("selectedItem") List<Long> selectedItem,
      RedirectAttributes redirectAttributes) {
    List<JobType> jobTypes = jobTypeManager.findByIds(selectedItem);

    for (JobType jobType : jobTypes) {
      jobTypeManager.remove(jobType);
    }

    messageHelper.addFlashMessage(redirectAttributes, "core.success.delete", "删除成功");

    return "redirect:/org/job-type-list.do";
  }
  @RequestMapping("job-type-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 = jobTypeManager.pagedQuery(page, propertyFilters);

    model.addAttribute("page", page);

    return "org/job-type-list";
  }
  @RequestMapping("job-type-export")
  public void export(
      @ModelAttribute Page page,
      @RequestParam Map<String, Object> parameterMap,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    String tenantId = tenantHolder.getTenantId();
    List<PropertyFilter> propertyFilters = PropertyFilter.buildFromMap(parameterMap);
    propertyFilters.add(new PropertyFilter("EQS_tenantId", tenantId));
    page = jobTypeManager.pagedQuery(page, propertyFilters);

    List<JobType> jobTypes = (List<JobType>) page.getResult();

    TableModel tableModel = new TableModel();
    tableModel.setName("org");
    tableModel.addHeaders("id", "name");
    tableModel.setData(jobTypes);
    exportor.export(request, response, tableModel);
  }