1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
| package com.gkhy.safePlatform.commons.enums;
|
| public enum RedisKeyEnum {
|
| // 用户token
| AUTH_TOKEN("auth:token:access:{%s}"),
| // 刷新token
| AUTH_REFRESH("auth:token:refresh:{%s}"),
| // 权限
| AUTH_AUTHORITIES("auth:authorities:{%s}"),
| // 菜单
| AUTH_MENU("auth:menu"),
| // 部门
| AUTH_DEP("auth:dep")
| ;
|
| RedisKeyEnum(String key) {
| this.key = key;
| }
|
| private String key;
|
|
| public String getKey() {
| return key;
| }
|
| /**
| * @Description: 获取key
| */
| public static String authKey(RedisKeyEnum keyEnum,Long userId) {
| return String.format(keyEnum.getKey(), userId + "");
| }
|
| /**
| * @Description: 获取key
| */
| public static String authKey(RedisKeyEnum keyEnum,String param) {
| return String.format(keyEnum.getKey(), param );
| }
| }
|
|