瀏覽代碼

优化

4.0
yaoq 2 年之前
父節點
當前提交
23b89a4518
共有 2 個文件被更改,包括 26 次插入2 次删除
  1. +21
    -1
      smtweb-framework/canal/file/src/main/java/cc/smtweb/system/canal/file/common/AbstractFileWork.java
  2. +5
    -1
      smtweb-framework/canal/file/src/main/resources/config/application.yaml

+ 21
- 1
smtweb-framework/canal/file/src/main/java/cc/smtweb/system/canal/file/common/AbstractFileWork.java 查看文件

@@ -90,8 +90,10 @@ public abstract class AbstractFileWork {
int deleteSize = 0;
int createSize = 0;
int alterSize = 0;
int dropSize = 0;
for (CanalVO canal : list) {
if (canal.createIs()) {
doDropSql(canal);
doCreateSql(canal);
createSize++;
continue;
@@ -101,6 +103,11 @@ public abstract class AbstractFileWork {
alterSize++;
continue;
}
if (canal.dropIs()) {
doDropSql(canal);
dropSize++;
continue;
}
if (canal.insertIs()) {
doInsertSql(canal);
insertSize++;
@@ -116,7 +123,7 @@ public abstract class AbstractFileWork {
deleteSize++;
}
}
log.debug("[解析canal文件]:::file:" + file.getName() + " insert size:[" + insertSize + "] update size:[" + updateSize + "] delete size:[" + deleteSize + "] create size:[" + createSize + "] alter size:[" + alterSize + "]");
log.debug("[解析canal文件]:::file:" + file.getName() + " insert size:[" + insertSize + "] update size:[" + updateSize + "] delete size:[" + deleteSize + "] create size:[" + createSize + "] alter size:[" + alterSize + "]" + "drop size:[" + dropSize + "]");
}

protected abstract String getDbType();
@@ -125,6 +132,19 @@ public abstract class AbstractFileWork {

protected abstract void doAlterSql(CanalVO canalVO);


protected void doDropSql(CanalVO canalVO) {
String sql = "";
if (!StringUtil.isEmpty(getSchemaName(canalVO))) {
sql = "drop table if exists " + getSchemaName(canalVO) + "." + canalVO.getTableName();

} else {
sql = "drop table if exists " + canalVO.getTableName();
}
log.debug("sql:::" + sql);
getDbEngine().update(sql);
}

protected String getSchemaName(CanalVO canalVO) {
return "";
}


+ 5
- 1
smtweb-framework/canal/file/src/main/resources/config/application.yaml 查看文件

@@ -20,7 +20,7 @@ devtools:
enabled: false # 热部署开关
additional-paths: src/main/java #重启目录
server:
port: 8088
port: 8081
servlet:
context-path:
logging:
@@ -38,6 +38,9 @@ spring:
url: jdbc:kingbase8://10.176.246.198:54321/pgzx?useUnicode=true&characterEncoding=utf-8
username: 'zhengxie'
password: '%TGB6yhn'
# url: jdbc:kingbase8://172.28.123.205:54321/HLJTY?useUnicode=true&characterEncoding=utf-8
# username: system
# password: system
servlet:
multipart:
max-file-size: 104857600000
@@ -55,6 +58,7 @@ canal:
file:
enable: true
path: /data/canalFile
#path: E:/canalFile

# http 规则配置
http-config:


Loading…
取消
儲存