feat: support oauth2 login

This commit is contained in:
vran
2022-03-01 23:27:10 +08:00
parent 18edc58d2f
commit c1ab379f31
23 changed files with 307 additions and 137 deletions

View File

@@ -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)

View File

@@ -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)