@RequestMapping(value = "/update/{id}", method = RequestMethod.GET)
 public String update(@PathVariable Integer id, Model model) {
   model.addAttribute("types", EnumUtils.enumProp2NameMap(LocatorType.class, "name"));
   model.addAttribute(locatorService.getLocatorBean(id));
   model.addAttribute(new LocatorDTO());
   return "locator/edit";
 }
  @RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
  public String update(
      @PathVariable Integer id, @Valid LocatorDTO locatorDTO, BindingResult br, Model model) {
    if (br.hasErrors()) {
      return "locator/edit";
    }
    CaseBean caseBean = new CaseBean();
    caseBean.setId(locatorDTO.getCaseId());

    LocatorBean locatorBean = locatorService.getLocatorBean(id);
    locatorBean.setCaseBean(caseBean);
    locatorBean.setLocatorData(locatorDTO.getLocatorData());
    locatorBean.setLocatorDataName(locatorDTO.getLocatorDataName());
    locatorBean.setLocatorType(locatorDTO.getLocatorType());
    locatorService.updateLocator(locatorBean);
    return "redirect:/locator/case/" + locatorDTO.getCaseId();
  }
 @RequestMapping(value = "/add/{id}", method = RequestMethod.POST)
 public String add(@Valid LocatorDTO locatorDTO, BindingResult br) {
   if (br.hasErrors()) {
     return "locator/add";
   }
   CaseBean caseBean = new CaseBean();
   caseBean.setId(locatorDTO.getCaseId());
   LocatorBean locatorBean = new LocatorBean();
   locatorBean.setCaseBean(caseBean);
   locatorBean.setLocatorData(locatorDTO.getLocatorData());
   locatorBean.setLocatorDataName(locatorDTO.getLocatorDataName());
   locatorBean.setLocatorType(locatorDTO.getLocatorType());
   locatorService.addLocator(locatorBean);
   return "redirect:/locator/case/" + locatorDTO.getCaseId();
 }
 @RequestMapping("/delete/{id}")
 public String delete(@PathVariable Integer id) {
   LocatorBean locatorBean = locatorService.getLocatorBean(id);
   locatorService.delLocator(id);
   return "redirect:/locator/case/" + locatorBean.getCaseBean().getId();
 }
 @RequestMapping("/case/{id}")
 public String list(@PathVariable Integer id, Model model) {
   model.addAttribute("caseBean", caseService.getCaseBean(id));
   model.addAttribute("datas", locatorService.getLoatorBeanPager(id));
   return "locator/list";
 }