Sfoglia il codice sorgente

重构代码,修复swaggerUI不能显示的bug

宋悦 8 anni fa
parent
commit
982f69d141

+ 2 - 2
exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/ExamStudentService.java

@@ -59,8 +59,8 @@ public class ExamStudentService {
      * @param examId
      * @return
      */
-    public ResponseEntity getExamStudentByExamId(Long examId){
-        return new ResponseEntity(examStudentRepo.findByExamId(examId),HttpStatus.OK);
+    public ResponseEntity getExamStudentByExamId(Long examId,Pageable pageable){
+        return new ResponseEntity(examStudentRepo.findByExamId(examId,pageable),HttpStatus.OK);
     }
 
     /**

+ 6 - 0
exam-work-domain/pom.xml

@@ -12,6 +12,12 @@
     <artifactId>exam-work-domain</artifactId>
 
     <dependencies>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>${mysql.version}</version>
+        </dependency>
+
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-jpa</artifactId>

+ 2 - 1
exam-work-domain/src/main/java/cn/com/qmth/examcloud/service/examwork/dao/ExamStudentRepo.java

@@ -1,11 +1,12 @@
 package cn.com.qmth.examcloud.service.examwork.dao;
 
 import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.repository.JpaRepository;
 
 import cn.com.qmth.examcloud.service.examwork.entity.ExamStudent;
 import org.springframework.data.repository.query.QueryByExampleExecutor;
 
 public interface ExamStudentRepo extends JpaRepository<ExamStudent, Long>,QueryByExampleExecutor<ExamStudent> {
-    Page<ExamStudent> findByExamId(Long examId);
+    Page<ExamStudent> findByExamId(Long examId, Pageable pageable);
 }

+ 5 - 0
exam-work-main/pom.xml

@@ -11,6 +11,11 @@
 
     <artifactId>exam-work-main</artifactId>
     <dependencies>
+        <dependency>
+            <groupId>cn.com.qmth.examcloud.service</groupId>
+            <artifactId>exam-work-api</artifactId>
+            <version>0.1.0</version>
+        </dependency>
         <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-feign</artifactId>

+ 1 - 1
exam-work-main/src/main/java/cn/com/qmth/examcloud/service/examwork/Swagger2.java

@@ -27,7 +27,7 @@ public class Swagger2 {
     }
     private ApiInfo apiInfo() {
         return new ApiInfoBuilder()
-                .title("考试云平台基础信息接口")
+                .title("考试云平台考务接口")
                 .description("基于swagger构建的Restful API")
                 .version("1.0")
                 .build();

+ 1 - 0
exam-work-main/src/main/resources/application.properties

@@ -3,6 +3,7 @@ spring.datasource.username=root
 spring.datasource.password=root
 spring.datasource.validation-query=SELECT 1 FROM DUAL
 spring.datasource.test-on-borrow=true
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
 
 #redis
 #spring.redis.host=192.168.199.102

+ 16 - 35
pom.xml

@@ -19,7 +19,7 @@
     <parent>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
-        <version>1.4.0.RELEASE</version>
+        <version>1.4.3.RELEASE</version>
     </parent>
 
 
@@ -40,6 +40,7 @@
         <!-- maven plugins -->
         <maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
         <maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
+        <spring.boot.version>1.4.3.RELEASE</spring.boot.version>
     </properties>
 
     <dependencyManagement>
@@ -79,42 +80,22 @@
     <build>
         <plugins>
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring.boot.version}</version>
+                <configuration><!-- 指定该Main Class为全局的唯一入口 -->
+                    <mainClass>cn.com.qmth.examcloud.service.examwork.Application</mainClass>
+                    <layout>ZIP</layout>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中-->
+                        </goals>
+                    </execution>
+                </executions>
             </plugin>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-            </plugin>
-
         </plugins>
-
-        <pluginManagement>
-            <plugins>
-
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-surefire-plugin</artifactId>
-                    <version>${maven-surefire-plugin.version}</version>
-                    <configuration>
-                        <testFailureIgnore>true</testFailureIgnore>
-                    </configuration>
-                </plugin>
-
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-compiler-plugin</artifactId>
-                    <version>${maven-compiler-plugin.version}</version>
-                    <configuration>
-                        <source>1.8</source>
-                        <target>1.8</target>
-                        <compilerArgument>-proc:none</compilerArgument>
-                    </configuration>
-                </plugin>
-
-            </plugins>
-        </pluginManagement>
     </build>
 
 </project>