| 1234567891011121314151617181920212223242526272829303132333435 |
- package com.seecoder.BlueWhale.controller;
- import com.seecoder.BlueWhale.service.UserService;
- import com.seecoder.BlueWhale.vo.ResultVO;
- import com.seecoder.BlueWhale.vo.UserVO;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- @RestController
- @RequestMapping("/api/users")
- public class UserController {
- @Autowired
- UserService userService;
- @PostMapping("/register")
- public ResultVO<Boolean> register(@RequestBody UserVO userVO){
- return ResultVO.buildSuccess(userService.register(userVO));
- }
- @PostMapping("/login")
- public ResultVO<String> login(@RequestParam("phone") String phone, @RequestParam("password") String password){
- return ResultVO.buildSuccess(userService.login(phone, password));
- }
- @GetMapping
- public ResultVO<UserVO> getInformation(){
- return ResultVO.buildSuccess(userService.getInformation());
- }
- @PostMapping
- public ResultVO<Boolean> updateInformation(@RequestBody UserVO userVO){
- return ResultVO.buildSuccess(userService.updateInformation(userVO));
- }
- }
|