From 23e9658bd56bb16243c5ccd645dace7a8db0e836 Mon Sep 17 00:00:00 2001 From: Superdandan <1033719135@qq.com> Date: Sat, 28 Sep 2024 21:24:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 2 ++ gradle/wrapper/gradle-wrapper.properties | 2 +- .../org/echo/QuestionnaireApplication.kt | 11 ++++++++ .../org/echo/questionnaire/Questionnaire.kt | 21 --------------- .../org/echo/questionnaire/Repository.kt | 27 +++++++++++++++++++ 5 files changed, 41 insertions(+), 22 deletions(-) create mode 100644 src/main/kotlin/org/echo/QuestionnaireApplication.kt create mode 100644 src/main/kotlin/org/echo/questionnaire/Repository.kt diff --git a/build.gradle.kts b/build.gradle.kts index 8a469d0..1f9acfd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -40,6 +40,8 @@ dependencies { implementation("org.apache.httpcomponents:httpclient:4.5.14") implementation("com.google.code.gson:gson:2.10.1") + implementation("org.apache.poi:poi-ooxml:5.2.2") + runtimeOnly("com.mysql:mysql-connector-j") testImplementation("org.springframework.boot:spring-boot-starter-test") diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d869fed..be8da3c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Sat Aug 10 19:08:03 CST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-8.8-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/org/echo/QuestionnaireApplication.kt b/src/main/kotlin/org/echo/QuestionnaireApplication.kt new file mode 100644 index 0000000..31a9aa9 --- /dev/null +++ b/src/main/kotlin/org/echo/QuestionnaireApplication.kt @@ -0,0 +1,11 @@ +package org.echo + +import org.springframework.boot.autoconfigure.SpringBootApplication +import org.springframework.boot.runApplication + +@SpringBootApplication +class QuestionnaireApplication + +fun main(args: Array) { + runApplication(*args) +} \ No newline at end of file diff --git a/src/main/kotlin/org/echo/questionnaire/Questionnaire.kt b/src/main/kotlin/org/echo/questionnaire/Questionnaire.kt index f19bb10..2cfa48b 100644 --- a/src/main/kotlin/org/echo/questionnaire/Questionnaire.kt +++ b/src/main/kotlin/org/echo/questionnaire/Questionnaire.kt @@ -478,27 +478,6 @@ enum class ComputeMethod( ): Double } - -interface QuestionnaireRepository { - fun save(questionnaire: Questionnaire): Questionnaire - fun findById(id: Long): Optional -} - -@Repository -class QuestionnaireRepositoryImpl(private val jdbcQuestionnaireRepository: JdbcQuestionnaireRepository) : - QuestionnaireRepository { - override fun save(questionnaire: Questionnaire): Questionnaire { - return jdbcQuestionnaireRepository.save(questionnaire) - } - - override fun findById(id: Long): Optional { - return jdbcQuestionnaireRepository.findById(id) - } -} - -@Repository -interface JdbcQuestionnaireRepository : CrudRepository - @DslMarker annotation class QuestionnaireDsl diff --git a/src/main/kotlin/org/echo/questionnaire/Repository.kt b/src/main/kotlin/org/echo/questionnaire/Repository.kt new file mode 100644 index 0000000..c8eaee8 --- /dev/null +++ b/src/main/kotlin/org/echo/questionnaire/Repository.kt @@ -0,0 +1,27 @@ +package org.echo.questionnaire + +import org.echo.org.echo.questionnaire.Questionnaire +import org.springframework.data.repository.CrudRepository +import org.springframework.stereotype.Repository +import java.util.* + + +interface QuestionnaireRepository { + fun save(questionnaire: Questionnaire): Questionnaire + fun findById(id: Long): Optional +} + +@Repository +class QuestionnaireRepositoryImpl(private val jdbcQuestionnaireRepository: JdbcQuestionnaireRepository) : + QuestionnaireRepository { + override fun save(questionnaire: Questionnaire): Questionnaire { + return jdbcQuestionnaireRepository.save(questionnaire) + } + + override fun findById(id: Long): Optional { + return jdbcQuestionnaireRepository.findById(id) + } +} + +@Repository +interface JdbcQuestionnaireRepository : CrudRepository \ No newline at end of file