fix(抽取数据): 处理kettle tinyint 识别错误的问题

This commit is contained in:
taojinlong 2021-07-09 17:28:28 +08:00
parent b027c85790
commit 60f4f11d50
3 changed files with 12 additions and 6 deletions

View File

@ -376,7 +376,11 @@ public class MysqlQueryProvider extends QueryProvider {
public String createRawQuerySQL(String table, List<DatasetTableField> fields) {
String[] array = fields.stream().map(f -> {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("`").append(f.getOriginName()).append("` AS ").append(f.getDataeaseName());
if(f.getDeExtractType() == 4){ // 处理 tinyint
stringBuilder.append("concat(`").append(f.getOriginName()).append("`,'') AS ").append(f.getDataeaseName());
}else {
stringBuilder.append("`").append(f.getOriginName()).append("` AS ").append(f.getDataeaseName());
}
return stringBuilder.toString();
}).toArray(String[]::new);
return MessageFormat.format("SELECT {0} FROM {1} ORDER BY null", StringUtils.join(array, ","), table);

View File

@ -112,6 +112,8 @@ public class DataSetTableService {
datasetTableTask.setType("all_scope");
datasetTableTask.setName(datasetTable.getName() + " 更新设置");
datasetTableTask.setEnd("0");
datasetTableTask.setStatus(TaskStatus.Underway.name());
datasetTableTask.setStartTime(System.currentTimeMillis());
dataSetTaskRequest.setDatasetTableTask(datasetTableTask);
dataSetTableTaskService.save(dataSetTaskRequest);
}

View File

@ -894,11 +894,11 @@ public class ExtractDataService {
private StepMeta udjc(List<DatasetTableField> datasetTableFields, boolean isExcel) {
String needToChangeColumnType = "";
for (DatasetTableField datasetTableField : datasetTableFields) {
if (datasetTableField.getDeExtractType() != null && datasetTableField.getDeExtractType() == 4) {
needToChangeColumnType = needToChangeColumnType + alterColumnTypeCode.replace("FILED", datasetTableField.getDataeaseName());
}
}
// for (DatasetTableField datasetTableField : datasetTableFields) {
// if (datasetTableField.getDeExtractType() != null && datasetTableField.getDeExtractType() == 4) {
// needToChangeColumnType = needToChangeColumnType + alterColumnTypeCode.replace("FILED", datasetTableField.getDataeaseName());
// }
// }
UserDefinedJavaClassMeta userDefinedJavaClassMeta = new UserDefinedJavaClassMeta();
List<UserDefinedJavaClassMeta.FieldInfo> fields = new ArrayList<>();