mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 21:00:53 +08:00 
			
		
		
		
	perf: 对获取路由信息接口增加缓存处理
1.优化 Spring Cache 配置 2.暂时移除 Jackson 针对数值类型:Long、BigInteger、BigDecimal 的 toString 处理(TreeUtil 疑似在字符串类型 parentId 时会出现转换异常)
This commit is contained in:
		| @@ -45,6 +45,7 @@ import top.charles7c.cnadmin.common.util.RedisUtils; | ||||
| import top.charles7c.cnadmin.common.util.SecureUtils; | ||||
| import top.charles7c.cnadmin.common.util.helper.LoginHelper; | ||||
| import top.charles7c.cnadmin.common.util.validate.ValidationUtils; | ||||
| import top.charles7c.cnadmin.monitor.annotation.Log; | ||||
| import top.charles7c.cnadmin.system.model.vo.UserDetailVO; | ||||
| import top.charles7c.cnadmin.system.service.UserService; | ||||
|  | ||||
| @@ -92,6 +93,7 @@ public class LoginController { | ||||
|         return R.ok(); | ||||
|     } | ||||
|  | ||||
|     @Log(ignore = true) | ||||
|     @Operation(summary = "获取用户信息", description = "获取登录用户信息") | ||||
|     @GetMapping("/user/info") | ||||
|     public R<UserInfoVO> getUserInfo() { | ||||
| @@ -103,9 +105,10 @@ public class LoginController { | ||||
|         return R.ok(userInfoVO); | ||||
|     } | ||||
|  | ||||
|     @Log(ignore = true) | ||||
|     @Operation(summary = "获取路由信息", description = "获取登录用户的路由信息") | ||||
|     @GetMapping("/route") | ||||
|     public R<List<RouteVO>> listMenu() { | ||||
|     public R<List<RouteVO>> listRoute() { | ||||
|         Long userId = LoginHelper.getUserId(); | ||||
|         List<RouteVO> routeTree = loginService.buildRouteTree(userId); | ||||
|         return R.ok(routeTree); | ||||
|   | ||||
| @@ -50,7 +50,7 @@ spring.liquibase: | ||||
|   # 配置文件路径 | ||||
|   change-log: classpath:/db/changelog/db.changelog-master.yaml | ||||
|  | ||||
| --- ### Redis 单机配置 | ||||
| --- ### Redis 配置(单机版) | ||||
| spring: | ||||
|   redis: | ||||
|     # 地址 | ||||
| @@ -65,6 +65,13 @@ spring: | ||||
|     timeout: 10s | ||||
|     # 是否开启 SSL | ||||
|     ssl: false | ||||
|   ## Spring Cache 配置 | ||||
|   cache: | ||||
|     redis: | ||||
|       # 缓存过期时长(单位:毫秒,默认 -1,表示永不过期) | ||||
|       time-to-live: 7200000 | ||||
|       # 是否允许缓存空值(默认 true,表示允许,可以解决缓存穿透问题) | ||||
|       cache-null-values: true | ||||
|  | ||||
| --- ### 邮件配置 | ||||
| spring.mail: | ||||
|   | ||||
| @@ -50,7 +50,7 @@ spring.liquibase: | ||||
|   # 配置文件路径 | ||||
|   change-log: classpath:/db/changelog/db.changelog-master.yaml | ||||
|  | ||||
| --- ### Redis 单机配置 | ||||
| --- ### Redis 配置(单机版) | ||||
| spring: | ||||
|   redis: | ||||
|     # 地址 | ||||
| @@ -65,6 +65,13 @@ spring: | ||||
|     timeout: 10s | ||||
|     # 是否开启 SSL | ||||
|     ssl: false | ||||
|   ## Spring Cache 配置 | ||||
|   cache: | ||||
|     redis: | ||||
|       # 缓存过期时长(单位:毫秒,默认 -1,表示永不过期) | ||||
|       time-to-live: 7200000 | ||||
|       # 是否允许缓存空值(默认 true,表示允许,可以解决缓存穿透问题) | ||||
|       cache-null-values: true | ||||
|  | ||||
| --- ### 邮件配置 | ||||
| spring.mail: | ||||
|   | ||||
| @@ -212,14 +212,6 @@ spring: | ||||
|     deserialization: | ||||
|       # 允许反序列化不存在的属性 | ||||
|       FAIL_ON_UNKNOWN_PROPERTIES: false | ||||
|   ## 缓存配置(@Cacheable) | ||||
|   cache: | ||||
|     type: redis | ||||
|     redis: | ||||
|       # 缓存过期时长(单位:毫秒,默认 -1,表示永不过期) | ||||
|       time-to-live: 7200000 | ||||
|       # 是否允许缓存空值(默认 true,表示允许,可以解决缓存穿透问题) | ||||
|       cache-null-values: true | ||||
|  | ||||
| --- ### 健康检查配置 | ||||
| management.health: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user