Skip to content

Commit

Permalink
UserController 添加处理根据id获取用户全部信息的请求的方法
Browse files Browse the repository at this point in the history
  • Loading branch information
suvvm committed Nov 29, 2019
1 parent a32ba13 commit 0442c31
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package qdu.suvvm.onlinesurvey.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -115,4 +116,15 @@ public String insertUserInv(@RequestParam("uid") String uid, @RequestParam("iid"
}
return "error";
}

@PostMapping("/getUserById")
public String getUserById(@RequestParam("id") String id) {
User user = new User();
user.setId(Integer.parseInt(id));
List<User> users = userMapper.getUser(user);
if(!users.isEmpty()){
return JSON.toJSONString(users.get(0));
}
return "error";
}
}

0 comments on commit 0442c31

Please sign in to comment.