提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.dal.mysql.oauth2; |
H |
2 |
|
|
3 |
import com.iailab.framework.common.pojo.PageResult; |
|
4 |
import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
|
5 |
import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
|
6 |
import com.iailab.framework.tenant.core.aop.TenantIgnore; |
|
7 |
import com.iailab.module.system.controller.admin.oauth2.vo.token.OAuth2AccessTokenPageReqVO; |
|
8 |
import com.iailab.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO; |
|
9 |
import org.apache.ibatis.annotations.Mapper; |
|
10 |
|
|
11 |
import java.time.LocalDateTime; |
|
12 |
import java.util.List; |
|
13 |
|
|
14 |
@Mapper |
|
15 |
public interface OAuth2AccessTokenMapper extends BaseMapperX<OAuth2AccessTokenDO> { |
|
16 |
|
|
17 |
@TenantIgnore // 获取 token 的时候,需要忽略租户编号。原因是:一些场景下,可能不会传递 tenant-id 请求头,例如说文件上传、积木报表等等 |
|
18 |
default OAuth2AccessTokenDO selectByAccessToken(String accessToken) { |
|
19 |
return selectOne(OAuth2AccessTokenDO::getAccessToken, accessToken); |
|
20 |
} |
|
21 |
|
|
22 |
default List<OAuth2AccessTokenDO> selectListByRefreshToken(String refreshToken) { |
|
23 |
return selectList(OAuth2AccessTokenDO::getRefreshToken, refreshToken); |
|
24 |
} |
|
25 |
|
|
26 |
default PageResult<OAuth2AccessTokenDO> selectPage(OAuth2AccessTokenPageReqVO reqVO) { |
|
27 |
return selectPage(reqVO, new LambdaQueryWrapperX<OAuth2AccessTokenDO>() |
|
28 |
.eqIfPresent(OAuth2AccessTokenDO::getUserId, reqVO.getUserId()) |
|
29 |
.eqIfPresent(OAuth2AccessTokenDO::getUserType, reqVO.getUserType()) |
|
30 |
.likeIfPresent(OAuth2AccessTokenDO::getClientId, reqVO.getClientId()) |
|
31 |
.gt(OAuth2AccessTokenDO::getExpiresTime, LocalDateTime.now()) |
|
32 |
.orderByDesc(OAuth2AccessTokenDO::getId)); |
|
33 |
} |
|
34 |
|
|
35 |
} |