feat(auth): 新增用户权限管理模块

- 新增权限、角色、用户角色关联等数据对象及Mapper
- 实现权限数据同步至Redis的功能
- 新增用户登录与注册接口,支持验证码登录
- 完善全局异常处理,增加对Guava参数校验异常的捕获
- 修改用户DO字段类型,使用LocalDate与LocalDateTime替代Date
- 新增删除状态枚举类DeletedEnum和状态枚举类StatusEnum
- 调整响应码结构,区分邮件相关错误码
- 新增RedisKeyConstants中关于用户角色与角色权限的KEY构建方法
- 新增RoleConstants定义普通用户角色ID常量
This commit is contained in:
Hanserwei
2025-10-01 20:50:36 +08:00
parent 32562dbb67
commit eb9f887ac3
24 changed files with 851 additions and 12 deletions

View File

@@ -0,0 +1,30 @@
package com.hanserwei.hannote.auth.controller;
import com.hanserwei.framework.biz.operationlog.aspect.ApiOperationLog;
import com.hanserwei.framework.common.response.Response;
import com.hanserwei.hannote.auth.model.vo.user.UserLoginReqVO;
import com.hanserwei.hannote.auth.service.UserService;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/user")
@Slf4j
@RequiredArgsConstructor
public class UserController {
@Resource
private UserService userService;
@PostMapping("/login")
@ApiOperationLog(description = "用户登录/注册")
public Response<String> loginAndRegister(@Validated @RequestBody UserLoginReqVO userLoginReqVO) {
return userService.loginAndRegister(userLoginReqVO);
}
}