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 ); } }