/**
  * 得到地区列表页面
  *
  * @return
  */
 @RequestMapping(value = "/index.htm", method = RequestMethod.GET)
 public ModelAndView index() {
   String id = StringUtil.getUUID();
   System.out.println("gen id====" + id);
   areaService.insertAndDeleteArea(id);
   ModelAndView modelAndView = new ModelAndView();
   modelAndView.setViewName("/area/areaList");
   return modelAndView;
 }
 /**
  * 添加或修改 地区
  *
  * @param id
  * @return
  */
 @RequestMapping(value = "/{id}.json", method = RequestMethod.POST)
 @ResponseBody
 public JSONResult addOrUpdate(@PathVariable String id, Area area) {
   JSONResult result = new JSONResult();
   try {
     area.setName(StringUtil.urlDecode(area.getName()));
     area.setCode(StringUtil.urlDecode(area.getCode()));
     area.setParentId(StringUtil.urlDecode(area.getParentId()));
     area.setRemark(StringUtil.decode(area.getRemark()));
     if (areaService.exists(id)) { // 数据库中已经存在
       areaService.updateEntity(area);
     } else {
       areaService.addEntity(area);
     }
     result.setResult(true);
     result.setData(area);
   } catch (Exception e) {
     result.setResult(false);
     result.setErrorDesc("出现异常:" + e.getMessage());
   }
   return result;
 }