UserController.java 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package space.anyi.BI.controller;
  2. import org.springframework.stereotype.Controller;
  3. import org.springframework.web.bind.annotation.PostMapping;
  4. import org.springframework.web.bind.annotation.RequestBody;
  5. import org.springframework.web.bind.annotation.RequestMapping;
  6. import org.springframework.web.bind.annotation.ResponseBody;
  7. import space.anyi.BI.entity.ResponseResult;
  8. import space.anyi.BI.entity.User;
  9. import space.anyi.BI.service.UserService;
  10. import javax.annotation.Resource;
  11. /**
  12. * @ProjectName: BI
  13. * @FileName: UserController
  14. * @Author: 杨逸
  15. * @Data:2024/11/28 19:52
  16. * @Description:
  17. */
  18. @Controller()
  19. @RequestMapping("/user")
  20. public class UserController {
  21. @Resource
  22. private UserService userService;
  23. @PostMapping("/login")
  24. @ResponseBody
  25. public ResponseResult login(@RequestBody User user){
  26. return userService.login(user);
  27. }
  28. @PostMapping("/register")
  29. @ResponseBody
  30. public ResponseResult resister(@RequestBody User user){
  31. return userService.register(user);
  32. }
  33. }