Added | Jooq 整合
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -35,3 +35,5 @@ out/
|
|||||||
|
|
||||||
### VS Code ###
|
### VS Code ###
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
|
jooq/
|
||||||
11
build.gradle
11
build.gradle
@@ -3,7 +3,7 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
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-core'
|
||||||
classpath "org.flywaydb:flyway-mysql:9.2.0"
|
classpath "org.flywaydb:flyway-mysql:9.2.0"
|
||||||
}
|
}
|
||||||
@@ -14,12 +14,14 @@ plugins {
|
|||||||
id 'org.springframework.boot' version '2.7.5'
|
id 'org.springframework.boot' version '2.7.5'
|
||||||
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
|
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
|
||||||
id "org.flywaydb.flyway" version "8.5.13"
|
id "org.flywaydb.flyway" version "8.5.13"
|
||||||
|
id 'nu.studer.jooq' version '7.1.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects{
|
allprojects{
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'org.springframework.boot'
|
apply plugin: 'org.springframework.boot'
|
||||||
apply plugin: 'io.spring.dependency-management'
|
apply plugin: 'io.spring.dependency-management'
|
||||||
|
apply plugin: 'nu.studer.jooq'
|
||||||
group = 'org.fycd'
|
group = 'org.fycd'
|
||||||
version = '0.0.1'
|
version = '0.0.1'
|
||||||
|
|
||||||
@@ -44,6 +46,8 @@ allprojects{
|
|||||||
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
|
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
|
||||||
annotationProcessor 'org.projectlombok:lombok'
|
annotationProcessor 'org.projectlombok:lombok'
|
||||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
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') {
|
tasks.named('test') {
|
||||||
@@ -64,7 +68,7 @@ task migrateDB(type: org.flywaydb.gradle.task.FlywayMigrateTask) {
|
|||||||
password = 'roottoor'
|
password = 'roottoor'
|
||||||
locations = ['filesystem:migrations']
|
locations = ['filesystem:migrations']
|
||||||
target = 'latest'
|
target = 'latest'
|
||||||
baselineVersion = '0.0.1.0.1'
|
baselineVersion = '0.0.1.1'
|
||||||
baselineOnMigrate = true
|
baselineOnMigrate = true
|
||||||
validateOnMigrate = true
|
validateOnMigrate = true
|
||||||
outOfOrder = true
|
outOfOrder = true
|
||||||
@@ -79,9 +83,10 @@ task cleanDB(type: org.flywaydb.gradle.task.FlywayCleanTask) {
|
|||||||
password = 'roottoor'
|
password = 'roottoor'
|
||||||
locations = ['filesystem:migrations']
|
locations = ['filesystem:migrations']
|
||||||
target = 'latest'
|
target = 'latest'
|
||||||
baselineVersion = '0.0.1.0.1'
|
baselineVersion = '0.0.1.1'
|
||||||
baselineOnMigrate = true
|
baselineOnMigrate = true
|
||||||
validateOnMigrate = true
|
validateOnMigrate = true
|
||||||
outOfOrder = true
|
outOfOrder = true
|
||||||
placeholderReplacement = false
|
placeholderReplacement = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,4 +12,40 @@ dependencies {
|
|||||||
|
|
||||||
test {
|
test {
|
||||||
useJUnitPlatform()
|
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'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -28,7 +28,6 @@ public class RefreshTokenService {
|
|||||||
|
|
||||||
public RefreshTokenSub createRefreshToken(Long userId) {
|
public RefreshTokenSub createRefreshToken(Long userId) {
|
||||||
RefreshTokenSub refreshToken = new RefreshTokenSub();
|
RefreshTokenSub refreshToken = new RefreshTokenSub();
|
||||||
|
|
||||||
refreshToken.setUser(userDao.findById(userId).get());
|
refreshToken.setUser(userDao.findById(userId).get());
|
||||||
refreshToken.setExpiryDate(LocalDateTime.now().plusSeconds(refreshTokenDuration));
|
refreshToken.setExpiryDate(LocalDateTime.now().plusSeconds(refreshTokenDuration));
|
||||||
refreshToken.setToken(UUID.randomUUID().toString());
|
refreshToken.setToken(UUID.randomUUID().toString());
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
rootProject.name = 'big-data'
|
rootProject.name = 'big-data'
|
||||||
include 'security-core'
|
include 'security-core'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user