45 lines
1.2 KiB
Java
45 lines
1.2 KiB
Java
package com.aos.auth.controller;
|
|
|
|
import com.aos.auth.PathConstant;
|
|
import com.aos.auth.domain.req.user.LoginUseReq;
|
|
import com.aos.auth.service.AosAuthLoginService;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.List;
|
|
|
|
@RestController
|
|
@RequestMapping(PathConstant.BASE_API)
|
|
@Api(tags = "用户登录接口")
|
|
@Slf4j
|
|
@RequiredArgsConstructor(onConstructor__ = @Autowired)
|
|
public class LoginController {
|
|
private final AosAuthLoginService aosAuthLoginService;
|
|
|
|
@PostMapping(PathConstant.LOGIN)
|
|
@ApiOperation("登录")
|
|
public String login(@RequestBody LoginUseReq loginUseReq) {
|
|
String token = aosAuthLoginService.login(loginUseReq);
|
|
return token;
|
|
}
|
|
|
|
@GetMapping(PathConstant.USER_PREM)
|
|
@ApiOperation("获取当前用户权限码")
|
|
public List<String> userPrem() {
|
|
List<String> strings = aosAuthLoginService.userPrem();
|
|
return strings;
|
|
}
|
|
|
|
@GetMapping(PathConstant.LOGOUT)
|
|
@ApiOperation("退出登录")
|
|
public String logout() {
|
|
return "ok";
|
|
}
|
|
|
|
|
|
}
|