Explorar o código

改造为 SQL Server 数据库源

Huanyi hai 1 mes
pai
achega
1a40f17ee8

+ 8 - 8
ruoyi-admin/pom.xml

@@ -17,13 +17,18 @@
 
 
     <dependencies>
     <dependencies>
 
 
-        <!-- Mysql驱动包 -->
+        <!-- SqlServer驱动包 -->
         <dependency>
         <dependency>
-            <groupId>com.mysql</groupId>
-            <artifactId>mysql-connector-j</artifactId>
+            <groupId>com.microsoft.sqlserver</groupId>
+            <artifactId>mssql-jdbc</artifactId>
         </dependency>
         </dependency>
 
 
 <!--        &lt;!&ndash; mp支持的数据库均支持 只需要增加对应的jdbc依赖即可 &ndash;&gt;-->
 <!--        &lt;!&ndash; mp支持的数据库均支持 只需要增加对应的jdbc依赖即可 &ndash;&gt;-->
+<!--        &lt;!&ndash; MySQL &ndash;&gt;-->
+<!--        <dependency>-->
+<!--            <groupId>com.mysql</groupId>-->
+<!--            <artifactId>mysql-connector-j</artifactId>-->
+<!--        </dependency>-->
 <!--        &lt;!&ndash; Oracle &ndash;&gt;-->
 <!--        &lt;!&ndash; Oracle &ndash;&gt;-->
 <!--        <dependency>-->
 <!--        <dependency>-->
 <!--            <groupId>com.oracle.database.jdbc</groupId>-->
 <!--            <groupId>com.oracle.database.jdbc</groupId>-->
@@ -38,11 +43,6 @@
 <!--        <dependency>-->
 <!--        <dependency>-->
 <!--            <groupId>org.postgresql</groupId>-->
 <!--            <groupId>org.postgresql</groupId>-->
 <!--            <artifactId>postgresql</artifactId>-->
 <!--            <artifactId>postgresql</artifactId>-->
-<!--        </dependency>-->
-<!--        &lt;!&ndash; SqlServer &ndash;&gt;-->
-<!--        <dependency>-->
-<!--            <groupId>com.microsoft.sqlserver</groupId>-->
-<!--            <artifactId>mssql-jdbc</artifactId>-->
 <!--        </dependency>-->
 <!--        </dependency>-->
 
 
         <dependency>
         <dependency>

+ 3 - 4
ruoyi-admin/src/main/resources/application-dev.yml

@@ -44,11 +44,10 @@ spring:
         # 主库数据源
         # 主库数据源
         master:
         master:
           type: ${spring.datasource.type}
           type: ${spring.datasource.type}
-          driverClassName: com.mysql.cj.jdbc.Driver
+          driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
-          # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
-          url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
-          username: root
+          url: jdbc:sqlserver://localhost:1433;DatabaseName=ry-vue;SelectMethod=cursor;encrypt=false
+          username: SA
           password: root
           password: root
 #        # 从库数据源
 #        # 从库数据源
 #        slave:
 #        slave:

+ 3 - 4
ruoyi-admin/src/main/resources/application-prod.yml

@@ -47,11 +47,10 @@ spring:
         # 主库数据源
         # 主库数据源
         master:
         master:
           type: ${spring.datasource.type}
           type: ${spring.datasource.type}
-          driverClassName: com.mysql.cj.jdbc.Driver
+          driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
           # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
-          # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
-          url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
-          username: root
+          url: jdbc:sqlserver://localhost:1433;DatabaseName=ry-vue;SelectMethod=cursor;encrypt=false
+          username: SA
           password: root
           password: root
 #        # 从库数据源
 #        # 从库数据源
 #        slave:
 #        slave:

+ 3 - 3
ruoyi-extend/ruoyi-snailjob-server/src/main/resources/application-dev.yml

@@ -1,9 +1,9 @@
 spring:
 spring:
   datasource:
   datasource:
     type: com.zaxxer.hikari.HikariDataSource
     type: com.zaxxer.hikari.HikariDataSource
-    driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
-    username: root
+    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
+    url: jdbc:sqlserver://localhost:1433;DatabaseName=ry-vue;SelectMethod=cursor;encrypt=false
+    username: SA
     password: root
     password: root
     hikari:
     hikari:
       connection-timeout: 30000
       connection-timeout: 30000

+ 3 - 3
ruoyi-extend/ruoyi-snailjob-server/src/main/resources/application-prod.yml

@@ -1,9 +1,9 @@
 spring:
 spring:
   datasource:
   datasource:
     type: com.zaxxer.hikari.HikariDataSource
     type: com.zaxxer.hikari.HikariDataSource
-    driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
-    username: root
+    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
+    url: jdbc:sqlserver://localhost:1433;DatabaseName=ry-vue;SelectMethod=cursor;encrypt=false
+    username: SA
     password: root
     password: root
     hikari:
     hikari:
       connection-timeout: 30000
       connection-timeout: 30000

+ 5 - 5
ruoyi-modules/ruoyi-generator/pom.xml

@@ -61,26 +61,26 @@
 
 
         <dependency>
         <dependency>
             <groupId>org.anyline</groupId>
             <groupId>org.anyline</groupId>
-            <artifactId>anyline-data-jdbc-mysql</artifactId>
+            <artifactId>anyline-data-jdbc-mssql</artifactId>
             <version>${anyline.version}</version>
             <version>${anyline.version}</version>
         </dependency>
         </dependency>
 
 
-        <!-- anyline支持100+种类型数据库 添加对应的jdbc依赖与anyline对应数据库依赖包即可 -->
+        <!-- anyline支持1000+种类型数据库 添加对应的jdbc依赖与anyline对应数据库依赖包即可 -->
 <!--        <dependency>-->
 <!--        <dependency>-->
 <!--            <groupId>org.anyline</groupId>-->
 <!--            <groupId>org.anyline</groupId>-->
-<!--            <artifactId>anyline-data-jdbc-oracle</artifactId>-->
+<!--            <artifactId>anyline-data-jdbc-mysql</artifactId>-->
 <!--            <version>${anyline.version}</version>-->
 <!--            <version>${anyline.version}</version>-->
 <!--        </dependency>-->
 <!--        </dependency>-->
 
 
 <!--        <dependency>-->
 <!--        <dependency>-->
 <!--            <groupId>org.anyline</groupId>-->
 <!--            <groupId>org.anyline</groupId>-->
-<!--            <artifactId>anyline-data-jdbc-postgresql</artifactId>-->
+<!--            <artifactId>anyline-data-jdbc-oracle</artifactId>-->
 <!--            <version>${anyline.version}</version>-->
 <!--            <version>${anyline.version}</version>-->
 <!--        </dependency>-->
 <!--        </dependency>-->
 
 
 <!--        <dependency>-->
 <!--        <dependency>-->
 <!--            <groupId>org.anyline</groupId>-->
 <!--            <groupId>org.anyline</groupId>-->
-<!--            <artifactId>anyline-data-jdbc-mssql</artifactId>-->
+<!--            <artifactId>anyline-data-jdbc-postgresql</artifactId>-->
 <!--            <version>${anyline.version}</version>-->
 <!--            <version>${anyline.version}</version>-->
 <!--        </dependency>-->
 <!--        </dependency>-->