|
@@ -9,7 +9,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/user")
|
|
@@ -24,8 +27,19 @@ public class UserController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("/list")
|
|
|
- public List<User> findList(User user) {
|
|
|
- return userService.findList(user);
|
|
|
+ public JsonResult findList(User user) {
|
|
|
+ JsonResult result = new JsonResult();
|
|
|
+ result.setMsg("success");
|
|
|
+ result.setCode(JsonResult.SUCCESS);
|
|
|
+ User u = userService.get(new User("1"));
|
|
|
+
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ List<User> l = new ArrayList<>();
|
|
|
+ l.add(u);
|
|
|
+ data.put("items", l);
|
|
|
+ data.put("total", 1);
|
|
|
+ result.setData(data);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
@PostMapping("/save")
|
|
@@ -41,11 +55,25 @@ public class UserController {
|
|
|
User user = (User) subject.getPrincipal();
|
|
|
JsonResult result = new JsonResult();
|
|
|
result.setData(user);
|
|
|
+
|
|
|
+ User u = userService.get(new User("1"));
|
|
|
+ result.setData(u);
|
|
|
+ result.setCode(JsonResult.SUCCESS);
|
|
|
+ result.setMsg("success");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ @GetMapping("/info")
|
|
|
+ public JsonResult info(String token) {
|
|
|
+ Subject subject = SecurityUtils.getSubject();
|
|
|
+ User user = (User) subject.getPrincipal();
|
|
|
+ JsonResult result = new JsonResult();
|
|
|
+ result.setData(user);
|
|
|
+ User u = userService.get(new User("1"));
|
|
|
+ result.setData(u);
|
|
|
result.setCode(JsonResult.SUCCESS);
|
|
|
result.setMsg("success");
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
@RequestMapping("/infoById")
|
|
|
public User infoById(User user) {
|
|
|
return userService.get(user);
|