Added | Jooq 整合

This commit is contained in:
2022-11-14 15:57:20 +08:00
parent 376db324bd
commit 58515e20b2
6 changed files with 46 additions and 5 deletions

2
.gitignore vendored
View File

@@ -35,3 +35,5 @@ out/
### VS Code ###
.vscode/
jooq/

View File

@@ -3,7 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'org.jooq:jooq-codegen:3.6.1'
classpath 'org.jooq:jooq-codegen:3.16.11'
classpath 'org.flywaydb:flyway-core'
classpath "org.flywaydb:flyway-mysql:9.2.0"
}
@@ -14,12 +14,14 @@ plugins {
id 'org.springframework.boot' version '2.7.5'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id "org.flywaydb.flyway" version "8.5.13"
id 'nu.studer.jooq' version '7.1.1'
}
allprojects{
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'nu.studer.jooq'
group = 'org.fycd'
version = '0.0.1'
@@ -44,6 +46,8 @@ allprojects{
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
jooqGenerator 'org.mariadb.jdbc:mariadb-java-client'
jooqGenerator 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0'
}
tasks.named('test') {
@@ -64,7 +68,7 @@ task migrateDB(type: org.flywaydb.gradle.task.FlywayMigrateTask) {
password = 'roottoor'
locations = ['filesystem:migrations']
target = 'latest'
baselineVersion = '0.0.1.0.1'
baselineVersion = '0.0.1.1'
baselineOnMigrate = true
validateOnMigrate = true
outOfOrder = true
@@ -79,9 +83,10 @@ task cleanDB(type: org.flywaydb.gradle.task.FlywayCleanTask) {
password = 'roottoor'
locations = ['filesystem:migrations']
target = 'latest'
baselineVersion = '0.0.1.0.1'
baselineVersion = '0.0.1.1'
baselineOnMigrate = true
validateOnMigrate = true
outOfOrder = true
placeholderReplacement = false
}

View File

@@ -12,4 +12,40 @@ dependencies {
test {
useJUnitPlatform()
}
jooq {
version = '3.16.11' // default (can be omitted)
configurations {
main { // name of the jOOQ configuration
generationTool {
jdbc {
driver = 'org.mariadb.jdbc.Driver'
url = 'jdbc:mariadb://localhost:3306/fycd?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Taipei'
user = 'root'
password = 'roottoor'
}
generator {
name = 'org.jooq.codegen.DefaultGenerator'
database {
name = 'org.jooq.meta.mariadb.MariaDBDatabase'
inputSchema = 'fycd'
includes = 'flyway_schema_history'
}
generate {
deprecated = false
records = true
immutablePojos = true
fluentSetters = true
}
target {
packageName = 'jooq'
directory = 'src/main/java/org/fycd/bigdata/infra' // default (can be omitted)
}
strategy.name = 'org.jooq.codegen.DefaultGeneratorStrategy'
}
}
}
}
}

View File

@@ -28,7 +28,6 @@ public class RefreshTokenService {
public RefreshTokenSub createRefreshToken(Long userId) {
RefreshTokenSub refreshToken = new RefreshTokenSub();
refreshToken.setUser(userDao.findById(userId).get());
refreshToken.setExpiryDate(LocalDateTime.now().plusSeconds(refreshTokenDuration));
refreshToken.setToken(UUID.randomUUID().toString());

View File

@@ -1,3 +1,2 @@
rootProject.name = 'big-data'
include 'security-core'