mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-08-24 07:22:48 +08:00
优化文档...
This commit is contained in:
parent
ee59f1a2a2
commit
ac9fdd5c76
@ -2,10 +2,10 @@
|
|||||||
<img alt="logo" src="http://sa-token.dev33.cn/doc/logo.png" width="150" height="150" style="margin-bottom: 10px;">
|
<img alt="logo" src="http://sa-token.dev33.cn/doc/logo.png" width="150" height="150" style="margin-bottom: 10px;">
|
||||||
</p>
|
</p>
|
||||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">sa-token v1.4.0</h1>
|
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">sa-token v1.4.0</h1>
|
||||||
<h4 align="center">一个JavaWeb权限认证框架,强大、简单、好用</h4>
|
<h4 align="center">一个JavaWeb轻量级权限认证框架,功能全面,上手简单</h4>
|
||||||
<h4 align="center">
|
<h4 align="center">
|
||||||
|
<a href="https://gitee.com/sz6/sa-token/stargazers"><img src="https://gitee.com/sz6/sa-token/badge/star.svg"></a>
|
||||||
<a href="https://github.com/click33/sa-token"><img src="https://img.shields.io/badge/sa--token-v1.4.0-2B9939"></a>
|
<a href="https://github.com/click33/sa-token"><img src="https://img.shields.io/badge/sa--token-v1.4.0-2B9939"></a>
|
||||||
<a href="https://github.com/click33/sa-token"><img src="https://img.shields.io/badge/language-java-2B9939"></a>
|
|
||||||
<a href="https://github.com/click33/sa-token/stargazers"><img src="https://img.shields.io/github/stars/click33/sa-token"></a>
|
<a href="https://github.com/click33/sa-token/stargazers"><img src="https://img.shields.io/github/stars/click33/sa-token"></a>
|
||||||
<a href="https://github.com/click33/sa-token/watchers"><img src="https://img.shields.io/github/watchers/click33/sa-token"></a>
|
<a href="https://github.com/click33/sa-token/watchers"><img src="https://img.shields.io/github/watchers/click33/sa-token"></a>
|
||||||
<a href="https://github.com/click33/sa-token/network/members"><img src="https://img.shields.io/github/forks/click33/sa-token"></a>
|
<a href="https://github.com/click33/sa-token/network/members"><img src="https://img.shields.io/github/forks/click33/sa-token"></a>
|
||||||
|
@ -5,8 +5,20 @@
|
|||||||
- 你需要做的就是重写`sa-token`的dao层实现方式,参考以下方案:
|
- 你需要做的就是重写`sa-token`的dao层实现方式,参考以下方案:
|
||||||
|
|
||||||
|
|
||||||
## 具体代码
|
|
||||||
- 新建文件`SaTokenDaoRedis.java`,实现接口`SaTokenDao`, 并加上注解`@Component`,保证此类被springboot扫描到
|
### 1. 首先在pom.xml引入依赖
|
||||||
|
``` xml
|
||||||
|
<!-- SpringBoot整合redis -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-redis</artifactId>
|
||||||
|
<version>RELEASE</version>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### 2. 实现SaTokenDao接口
|
||||||
|
新建文件`SaTokenDaoRedis.java`,实现接口`SaTokenDao`, 并加上注解`@Component`,保证此类被springboot扫描到
|
||||||
- 代码参考:
|
- 代码参考:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#### StpUtil.getLoginId(T defaultValue)
|
#### StpUtil.getLoginId(T defaultValue)
|
||||||
- 获取当前会话登录id, 如果未登录,则返回默认值 (`defaultValue`可以为任意类型)
|
- 获取当前会话登录id, 如果未登录,则返回默认值 (`defaultValue`可以为任意类型)
|
||||||
- 类似API还有:
|
- 类似API还有:
|
||||||
- `StpUtil.getLoginId_defaultNull()` 获取当前会话登录id, 如果未登录,则返回null
|
- `StpUtil.getLoginIdDefaultNull()` 获取当前会话登录id, 如果未登录,则返回null
|
||||||
|
|
||||||
#### getLoginIdByToken(String tokenValue)
|
#### getLoginIdByToken(String tokenValue)
|
||||||
- 获取指定token对应的登录id,如果未登录,则返回 null
|
- 获取指定token对应的登录id,如果未登录,则返回 null
|
||||||
|
Loading…
Reference in New Issue
Block a user