Example #1
0
  @RequestMapping(method = RequestMethod.POST)
  @ResponseBody
  public Map<String, String> insertUser(@RequestBody User user) {

    if (StringUtils.isEmpty(user.getUserId()) || StringUtils.isEmpty(user.getName())) {
      Map<String, String> result = new HashMap<String, String>();
      result.put("errorCode", "500");
      result.put(
          "errorMessage", "there is not userId or name in params to creating user infomation");
      return result;
    }

    userService.insertUser(user);

    Map<String, String> result = new HashMap<String, String>();
    result.put("result", "SUCCESS");
    return result;
  }
Example #2
0
  @RequestMapping(method = RequestMethod.DELETE)
  @ResponseBody
  public Map<String, String> deletetUser(@RequestBody User user) {
    if (StringUtils.isEmpty(user.getUserId())) {
      Map<String, String> result = new HashMap<String, String>();
      result.put("errorCode", "500");
      result.put("errorMessage", "there is not userId in params to delete user");
      return result;
    }

    userService.deleteUser(user);

    Map<String, String> result = new HashMap<String, String>();
    result.put("result", "SUCCESS");
    return result;
  }