refactor: 代码重构优化,用户权限缓存调整角色权限缓存

This commit is contained in:
haoxr
2023-11-29 22:17:16 +08:00
parent b2374bda69
commit c4463cfcc1
31 changed files with 665 additions and 239 deletions

View File

@@ -0,0 +1,27 @@
package com.youlai.system.common.constant;
/**
* 缓存常量
*
* @author haoxr
* @since 2023/11/24
*/
public interface CacheConstants {
/**
* 验证码缓存前缀
*/
String CAPTCHA_CODE_PREFIX = "captcha_code:";
/**
* 角色和权限缓存前缀
*/
String ROLE_PERMS_PREFIX = "role_perms:";
/**
* 黑名单Token缓存前缀
*/
String BLACKLIST_TOKEN_PREFIX = "blacklist_token:";
}

View File

@@ -1,16 +0,0 @@
package com.youlai.system.common.constant;
/**
* Excel 常量
*
* @author haoxr
* @since 3.0.0
*/
public interface ExcelConstants {
/**
* Excel 模板目录
*/
String EXCEL_TEMPLATE_DIR="excel-templates";
}

View File

@@ -0,0 +1,38 @@
package com.youlai.system.common.constant;
/**
* JWT Claims声明常量
* <p>
* JWT Claims 属于 Payload 的一部分,包含了一些实体(通常指的用户)的状态和额外的元数据。
*
* @author haoxr
* @since 2023/11/24
*/
public interface JwtClaimConstants {
/**
* 用户ID
*/
String USER_ID = "userId";
/**
* 用户名
*/
String USERNAME = "username";
/**
* 部门ID
*/
String DEPT_ID = "deptId";
/**
* 数据权限
*/
String DATA_SCOPE = "dataScope";
/**
* 权限(角色Code)集合
*/
String AUTHORITIES = "authorities";
}

View File

@@ -13,28 +13,5 @@ public interface SecurityConstants {
*/
String LOGIN_PATH = "/api/v1/auth/login";
/**
* Token 前缀
*/
String TOKEN_PREFIX = "Bearer ";
/**
* 请求头Token的Key
*/
String TOKEN_KEY = "Authorization";
/**
* 验证码缓存前缀
*/
String CAPTCHA_CODE_CACHE_PREFIX = "captcha_code:";
/**
* 用户权限集合缓存前缀
*/
String USER_PERMS_CACHE_PREFIX = "user_perms:";
/**
* 黑名单Token缓存前缀
*/
String BLACK_TOKEN_CACHE_PREFIX = "blacklist_token:";
}

View File

@@ -23,11 +23,4 @@ public interface SystemConstants {
* 超级管理员角色编码
*/
String ROOT_ROLE_CODE = "ROOT";
/**
* 超级管理员用户名
*/
String ROOT_USER_NAME = "root";
}