Browse Source

优化

4.0
yaoq 2 years ago
parent
commit
23b89a4518
2 changed files with 26 additions and 2 deletions
  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 View File

@@ -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 View File

@@ -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…
Cancel
Save