29 lines
981 B
Java
29 lines
981 B
Java
package com.zyh.auth.controller;
|
|
import com.zyh.auth.service.AuthService;
|
|
import com.zyh.common.domain.User;
|
|
import com.zyh.common.domain.request.UserRequest;
|
|
import com.zyh.common.domain.response.UserResponse;
|
|
import com.zyh.common.result.Result;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
@RestController
|
|
public class AuthController {
|
|
@Autowired
|
|
AuthService authService;
|
|
@PostMapping("login")
|
|
public Result<UserResponse> login(@RequestBody UserRequest userRequest) {
|
|
Result<UserResponse> login = authService.login(userRequest);
|
|
return login;
|
|
}
|
|
|
|
@PostMapping("user/info")
|
|
public Result<User> userInfo() {
|
|
User user = authService.userInfo();
|
|
Result<User> result = Result.success(user);
|
|
return result;
|
|
}
|
|
}
|