mirror of
https://github.com/vran-dev/databasir.git
synced 2025-09-20 02:39:20 +08:00
feat: support oauth2 login
This commit is contained in:
@@ -90,6 +90,12 @@ public abstract class BaseDao<R> {
|
||||
.fetchInto(pojoType);
|
||||
}
|
||||
|
||||
public List<R> selectAll() {
|
||||
return this.getDslContext()
|
||||
.selectFrom(table())
|
||||
.fetchInto(pojoType);
|
||||
}
|
||||
|
||||
public Page<R> selectByPage(Pageable request, Condition condition) {
|
||||
Integer count = getDslContext()
|
||||
.selectCount().from(table).where(condition)
|
||||
|
@@ -40,6 +40,13 @@ public class LoginDao extends BaseDao<LoginPojo> {
|
||||
.fetchOptionalInto(LoginPojo.class);
|
||||
}
|
||||
|
||||
public Optional<LoginPojo> selectByAccessToken(String accessToken) {
|
||||
return getDslContext()
|
||||
.selectFrom(LOGIN).where(LOGIN.ACCESS_TOKEN.eq(accessToken)
|
||||
.and(LOGIN.ACCESS_TOKEN_EXPIRE_AT.ge(LocalDateTime.now())))
|
||||
.fetchOptionalInto(LoginPojo.class);
|
||||
}
|
||||
|
||||
public void updateAccessToken(String accessToken, LocalDateTime accessTokenExpireAt, Integer userId) {
|
||||
getDslContext()
|
||||
.update(LOGIN)
|
||||
|
Reference in New Issue
Block a user