From e6b21e3a499003c3734a6eea02e4334a3c047f3a Mon Sep 17 00:00:00 2001
From: Loki <654612@qq.com>
Date: Tue, 31 May 2022 17:40:17 +0800
Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E8=BF=9B=E9=94=80=E5=AD=98?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E5=A2=9E=E5=8A=A0p6spy=E6=97=A5=E5=BF=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
yudao-server/pom.xml | 6 +++++
.../src/main/resources/application-local.yaml | 19 ++++++++-------
.../src/main/resources/application.yaml | 2 ++
.../src/main/resources/spy.properties | 24 +++++++++++++++++++
.../zsw/erp/datasource/entities/Function.java | 2 ++
.../datasource/entities/InventorySeason.java | 2 ++
.../zsw/erp/datasource/entities/Material.java | 2 ++
.../entities/MaterialCurrentStock.java | 2 ++
.../datasource/entities/MaterialExtend.java | 2 ++
.../entities/MaterialInitialStock.java | 2 ++
.../erp/datasource/entities/SystemConfig.java | 2 ++
11 files changed, 56 insertions(+), 9 deletions(-)
create mode 100644 yudao-server/src/main/resources/spy.properties
diff --git a/yudao-server/pom.xml b/yudao-server/pom.xml
index c20c98d6..1fd2bc7f 100644
--- a/yudao-server/pom.xml
+++ b/yudao-server/pom.xml
@@ -85,6 +85,12 @@
yudao-spring-boot-starter-protection
+
+ p6spy
+ p6spy
+ 3.9.1
+
+
diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml
index d9242442..a84e5058 100644
--- a/yudao-server/src/main/resources/application-local.yaml
+++ b/yudao-server/src/main/resources/application-local.yaml
@@ -44,31 +44,32 @@ spring:
datasource:
master:
name: ruoyi-vue-pro
- url: jdbc:mysql://192.168.10.250:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
- driver-class-name: com.mysql.jdbc.Driver
+ url: jdbc:p6spy:mysql://192.168.10.250:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
+# driver-class-name: com.mysql.jdbc.Driver
+ driver-class-name: com.p6spy.engine.spy.P6SpyDriver
username: root
password: root
slave: # 模拟从库,可根据自己需要修改
name: ruoyi-vue-pro
- url: jdbc:mysql://192.168.10.250:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
- driver-class-name: com.mysql.jdbc.Driver
+ url: jdbc:p6spy:mysql://192.168.10.250:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
+ driver-class-name: com.p6spy.engine.spy.P6SpyDriver
username: root
password: root
bxg: # 农场数据源
name: bxg
- url: jdbc:mysql://192.168.10.250:3306/${spring.datasource.dynamic.datasource.bxg.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
- driver-class-name: com.mysql.jdbc.Driver
+ url: jdbc:p6spy:mysql://192.168.10.250:3306/${spring.datasource.dynamic.datasource.bxg.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
+ driver-class-name: com.p6spy.engine.spy.P6SpyDriver
username: root
password: root
erp: # 进销存
name: erp
- url: jdbc:mysql://192.168.10.250:3306/${spring.datasource.dynamic.datasource.erp.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
- driver-class-name: com.mysql.jdbc.Driver
+ url: jdbc:p6spy:mysql://192.168.10.250:3306/${spring.datasource.dynamic.datasource.erp.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
+ driver-class-name: com.p6spy.engine.spy.P6SpyDriver
username: root
password: root
# farm: # 农场数据源
# name: zsw-farm
-# url: jdbc:mysql://192.168.10.129:3306/${spring.datasource.dynamic.datasource.farm.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
+# url: jdbc:p6spy:mysql://192.168.10.129:3306/${spring.datasource.dynamic.datasource.farm.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
# driver-class-name: com.mysql.jdbc.Driver
# username: root
# password: root
diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml
index 64fe6faa..9af11a91 100644
--- a/yudao-server/src/main/resources/application.yaml
+++ b/yudao-server/src/main/resources/application.yaml
@@ -127,6 +127,8 @@ yudao:
- infra_job_log
- infra_job_log
- yx_system_city
+ - jsh_sequence
+ - jsh_material_property
sms-code: # 短信验证码相关的配置项
expire-times: 10m
send-frequency: 1m
diff --git a/yudao-server/src/main/resources/spy.properties b/yudao-server/src/main/resources/spy.properties
new file mode 100644
index 00000000..af0bb2a7
--- /dev/null
+++ b/yudao-server/src/main/resources/spy.properties
@@ -0,0 +1,24 @@
+#3.2.1以上使用
+modulelist=com.baomidou.mybatisplus.extension.p6spy.MybatisPlusLogFactory,com.p6spy.engine.outage.P6OutageFactory
+#3.2.1以下使用或者不配置
+#modulelist=com.p6spy.engine.logging.P6LogFactory,com.p6spy.engine.outage.P6OutageFactory
+# 自定义日志打印
+logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger
+#日志输出到控制台
+appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger
+# 使用日志系统记录 sql
+#appender=com.p6spy.engine.spy.appender.Slf4JLogger
+# 设置 p6spy driver 代理
+deregisterdrivers=true
+# 取消JDBC URL前缀
+useprefix=true
+# 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset.
+excludecategories=info,debug,result,commit,resultset
+# 日期格式
+dateformat=yyyy-MM-dd HH:mm:ss
+# 实际驱动可多个
+#driverlist=org.h2.Driver
+# 是否开启慢SQL记录
+outagedetection=true
+# 慢SQL记录标准 2 秒
+outagedetectioninterval=2
\ No newline at end of file
diff --git a/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/Function.java b/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/Function.java
index 1e3b22d7..6760a6ef 100644
--- a/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/Function.java
+++ b/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/Function.java
@@ -1,7 +1,9 @@
package com.zsw.erp.datasource.entities;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+@TableName("jsh_function")
public class Function {
@TableId(type = IdType.AUTO)
private Long id;
diff --git a/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/InventorySeason.java b/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/InventorySeason.java
index bdf71609..67d475b5 100644
--- a/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/InventorySeason.java
+++ b/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/InventorySeason.java
@@ -3,11 +3,13 @@ package com.zsw.erp.datasource.entities;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.time.LocalDateTime;
@Data
+@TableName("jsh_inventory_season")
public class InventorySeason {
@TableId(type = IdType.AUTO)
diff --git a/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/Material.java b/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/Material.java
index 1e282f1d..a61be4f4 100644
--- a/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/Material.java
+++ b/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/Material.java
@@ -3,11 +3,13 @@ package com.zsw.erp.datasource.entities;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
@Data
+@TableName("jsh_material")
public class Material {
@TableId(type = IdType.AUTO)
diff --git a/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/MaterialCurrentStock.java b/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/MaterialCurrentStock.java
index 2e7e639f..2cdd6272 100644
--- a/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/MaterialCurrentStock.java
+++ b/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/MaterialCurrentStock.java
@@ -1,5 +1,6 @@
package com.zsw.erp.datasource.entities;
+import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -8,6 +9,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
@Data
+@TableName("jsh_material_current_stock")
public class MaterialCurrentStock {
@TableId(type = IdType.AUTO)
private Long id;
diff --git a/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/MaterialExtend.java b/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/MaterialExtend.java
index 3c504008..db4c434c 100644
--- a/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/MaterialExtend.java
+++ b/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/MaterialExtend.java
@@ -1,5 +1,6 @@
package com.zsw.erp.datasource.entities;
+import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
@Data
+@TableName("jsh_material_extend")
public class MaterialExtend {
@TableId(type = IdType.AUTO)
private Long id;
diff --git a/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/MaterialInitialStock.java b/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/MaterialInitialStock.java
index 52b39e2b..a2b27e36 100644
--- a/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/MaterialInitialStock.java
+++ b/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/MaterialInitialStock.java
@@ -1,6 +1,7 @@
package com.zsw.erp.datasource.entities;
import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
@Data
+@TableName("jsh_material_initial_stock")
public class MaterialInitialStock {
@TableId(type = IdType.AUTO)
private Long id;
diff --git a/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/SystemConfig.java b/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/SystemConfig.java
index 9d2fc0aa..abbab340 100644
--- a/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/SystemConfig.java
+++ b/zsw-erp/src/main/java/com/zsw/erp/datasource/entities/SystemConfig.java
@@ -2,9 +2,11 @@ package com.zsw.erp.datasource.entities;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
+@TableName("jsh_system_config")
public class SystemConfig {
@TableId(type = IdType.AUTO)
private Long id;