648540858 2 سال پیش
والد
کامیت
a91fe69f76
3فایلهای تغییر یافته به همراه60 افزوده شده و 4 حذف شده
  1. 1 0
      README.md
  2. 51 4
      doc/_content/introduction/config.md
  3. 8 0
      src/main/resources/all-application.yml

+ 1 - 0
README.md

@@ -104,6 +104,7 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git
 - [X] 云端录像,推流/代理/国标视频均可以录制在云端服务器,支持预览和下载
 - [X] 支持打包可执行jar和war
 - [X] 支持跨域请求,支持前后端分离部署
+- [X] 支持Mysql,Postgresql,金仓等数据库
 
 # 授权协议
 本项目自有代码使用宽松的MIT协议,在保留版权信息的情况下可以自由应用于各自商用、非商业的项目。 但是本项目也零碎的使用了一些其他的开源代码,在商用的情况下请自行替代或剔除; 由于使用本项目而产生的商业纠纷或侵权行为一概与本项目及开发者无关,请自行承担法律风险。 在使用本项目代码时,也应该在授权协议中同时表明本项目依赖的第三方库的协议

+ 51 - 4
doc/_content/introduction/config.md

@@ -29,10 +29,57 @@ java -jar wvp-pro-*.jar
 ```
 这也是我自己最常用的方式。
 ## 2 配置WVP-PRO
-### 2.1 Mysql数据库配置
-首先你需要创建一个名为wvp(也可使用其他名字)的数据库,并使用sql/mysql.sql导入数据库,初始化数据库结构。
-(这里注意,取决于版本,新版的sql文件夹下有update.sql,补丁包,一定要注意运行导入)
-在application-dev.yml中配置(使用1.2方式的是在jar包的同级目录的application.yml)配置数据库连接,包括数据库连接信息,密码。
+wvp支持多种数据库,包括Mysql,Postgresql,金仓等,配置任选一种即可。
+### 2.1 数据库配置
+####  2.1.1 初始化数据库
+首先使用创建数据库,然后使用sql/初始化.sql初始化数据库,如果是从旧版升级上来的,使用升级sql更新。
+####  2.1.2 Mysql数据库配置
+数据库名称以wvp为例
+```yaml
+spring:
+  datasource:
+    type: com.zaxxer.hikari.HikariDataSource
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true
+    username: root
+    password: 12345678
+
+mybatis:
+  configuration:
+    map-underscore-to-camel-case: true
+```
+####  2.1.3 Postgresql数据库配置
+数据库名称以wvp为例
+```yaml
+spring:
+  datasource:
+    type: com.zaxxer.hikari.HikariDataSource
+    driver-class-name: org.postgresql.Driver
+    url: jdbc:postgresql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true
+    username: root
+    password: 12345678
+mybatis:
+  configuration:
+    map-underscore-to-camel-case: true
+pagehelper:
+  helper-dialect: postgresql
+```
+####  2.1.4 金仓数据库配置
+数据库名称以wvp为例
+```yaml
+spring:
+  datasource:
+    type: com.zaxxer.hikari.HikariDataSource
+    driver-class-name: com.kingbase8.Driver
+    url: jdbc:kingbase8://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=utf8
+    username: root
+    password: 12345678
+mybatis:
+  configuration:
+    map-underscore-to-camel-case: true
+pagehelper:
+  helper-dialect: postgresql
+```
 ### 2.2 Redis数据库配置
 配置wvp中的redis连接信息,建议wvp自己单独使用一个db。
 ### 2.3 配置服务启动端口(可直接使用默认配置)

+ 8 - 0
src/main/resources/all-application.yml

@@ -43,6 +43,14 @@ spring:
             idle-timeout: 300000                  # 允许连接在连接池中空闲的最长时间(以毫秒为单位)
             max-lifetime: 1200000                 # 是池中连接关闭后的最长生命周期(以毫秒为单位)
 
+# 修改为数据库字段下划线分隔直接对应java驼峰命名
+mybatis:
+    configuration:
+        map-underscore-to-camel-case: true
+
+# 修改分页插件为 postgresql, 数据库类型为mysql不需要
+#pagehelper:
+#    helper-dialect: postgresql
 
 # [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口
 server: