39 lines
1019 B
Java
39 lines
1019 B
Java
package com.bwie.auth.controller;
|
|
|
|
import com.bwie.auth.service.AuthService;
|
|
import com.bwie.common.domain.User;
|
|
import com.bwie.common.domain.request.LoginRequest;
|
|
import com.bwie.common.result.Result;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
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
|
|
private AuthService service;
|
|
|
|
|
|
/**
|
|
* 登录
|
|
* @param loginRequest
|
|
* @return
|
|
*/
|
|
@PostMapping("login")
|
|
public Result login(@RequestBody LoginRequest loginRequest){
|
|
return service.login(loginRequest);
|
|
}
|
|
|
|
/**
|
|
* 获取用户信息
|
|
* @return
|
|
*/
|
|
@GetMapping("userInfo")
|
|
public Result userInfo(){
|
|
User user = service.userInfo();
|
|
return Result.success(user);
|
|
}
|
|
}
|