feat: 完善备注
This commit is contained in:
parent
2992a6cfc8
commit
0f6bc1e931
@ -14,9 +14,27 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
* @since 2025/6/14
|
* @since 2025/6/14
|
||||||
*/
|
*/
|
||||||
public interface AuthService {
|
public interface AuthService {
|
||||||
|
/**
|
||||||
|
* 登录系统
|
||||||
|
*
|
||||||
|
* @param loginRequest 登录请求
|
||||||
|
* @return token
|
||||||
|
*/
|
||||||
String login(LoginRequest loginRequest);
|
String login(LoginRequest loginRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出登录
|
||||||
|
*
|
||||||
|
* @param loginRequest 退出登录请求
|
||||||
|
* @return 请求结果
|
||||||
|
*/
|
||||||
ApiResponse<?> logout(HttpServletRequest request) throws SecurityException;
|
ApiResponse<?> logout(HttpServletRequest request) throws SecurityException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册
|
||||||
|
*
|
||||||
|
* @param request 注册请求
|
||||||
|
* @return 请求结果
|
||||||
|
*/
|
||||||
ApiResponse<?> register(RegisterRequest request) throws Exception;
|
ApiResponse<?> register(RegisterRequest request) throws Exception;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,4 +33,10 @@ public interface UserService {
|
|||||||
* @return 更新状态
|
* @return 更新状态
|
||||||
*/
|
*/
|
||||||
ApiResponse<?> updateUserInfo(UpdateUserRequest request);
|
ApiResponse<?> updateUserInfo(UpdateUserRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更改用户角色信息
|
||||||
|
* @return 请求结果
|
||||||
|
*/
|
||||||
|
ApiResponse<?> updateUserRole();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,6 +43,12 @@ public class AuthServiceImpl implements AuthService {
|
|||||||
private final PasswordEncoder passwordEncoder;
|
private final PasswordEncoder passwordEncoder;
|
||||||
private final UserMapper userMapper;
|
private final UserMapper userMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录系统
|
||||||
|
*
|
||||||
|
* @param loginRequest 登录请求
|
||||||
|
* @return token
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String login(LoginRequest loginRequest) {
|
public String login(LoginRequest loginRequest) {
|
||||||
Authentication authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(
|
Authentication authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(
|
||||||
@ -54,6 +60,12 @@ public class AuthServiceImpl implements AuthService {
|
|||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出登录
|
||||||
|
*
|
||||||
|
* @param loginRequest 退出登录请求
|
||||||
|
* @return 请求结果
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<?> logout(HttpServletRequest request) throws SecurityException {
|
public ApiResponse<?> logout(HttpServletRequest request) throws SecurityException {
|
||||||
try {
|
try {
|
||||||
@ -64,6 +76,12 @@ public class AuthServiceImpl implements AuthService {
|
|||||||
return ApiResponse.ofStatus(Status.LOGOUT);
|
return ApiResponse.ofStatus(Status.LOGOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册
|
||||||
|
*
|
||||||
|
* @param request 注册请求
|
||||||
|
* @return 请求结果
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<?> register(RegisterRequest request) throws Exception {
|
public ApiResponse<?> register(RegisterRequest request) throws Exception {
|
||||||
|
|
||||||
|
|||||||
@ -108,4 +108,9 @@ public class UserServiceImpl implements UserService {
|
|||||||
return ApiResponse.ofSuccess("更新失败");
|
return ApiResponse.ofSuccess("更新失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiResponse<?> updateUserRole() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user