Esempio n. 1
0
 @RequestMapping(value = "/add/landmark", method = RequestMethod.POST)
 public HttpEntity<String> addLandmark(@RequestBody Landmark landmark, Model model) {
   Long id = landmarkService.saveLandmark(landmark);
   JSONResponse jsonResponse =
       new JSONResponse(
           id > 0 ? new GrantResult(SUCCESS, "地标创建成功") : new GrantResult(FAILD, "地标创建失败"));
   return new ResponseEntity<String>(jsonResponse.getBody(), jsonResponse.getHttpStatus());
 }
Esempio n. 2
0
 @RequestMapping(value = "/edit/landmark", method = RequestMethod.POST)
 public HttpEntity<String> editLandmark(@RequestBody Landmark landmark, Model model) {
   JSONResponse jsonResponse =
       new JSONResponse(
           landmarkService.modifyLandmark(landmark)
               ? new GrantResult(SUCCESS, "编辑地标成功")
               : new GrantResult(FAILD, "编辑地标失败"));
   return new ResponseEntity<String>(jsonResponse.getBody(), jsonResponse.getHttpStatus());
 }
Esempio n. 3
0
  @RequestMapping(value = "/landmark", method = RequestMethod.GET)
  public String initLandmarkMaintain(
      @RequestParam(value = "city_code", required = false, defaultValue = "330100")
          String city_code,
      Map<String, Object> model,
      LandmarkSearcher searcher)
      throws Exception {
    // 默认加载杭州市地标(city_code = 330100)
    String _city_code = "330100";
    if (!StringUtils.isBlank(city_code)
        && city_code.length() == 6
        && NumberUtils.isDigits(city_code)) {
      _city_code = city_code.toString();
    }
    model.put("city_code", _city_code);
    // 加载地标
    List<Landmark> landmarks =
        landmarkService.loadLandmarkMap((LandmarkExample) searcher.getExample()).get(_city_code);
    model.put("landmarks", landmarks);

    return "landmark/landmark_list";
  }