master
parent
bb5b177cfd
commit
6c420c79ab
|
@ -62,10 +62,9 @@ public class TableFie{
|
||||||
private Integer tableId;
|
private Integer tableId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字段别名
|
* 字段数据
|
||||||
*/
|
*/
|
||||||
@TableField(exist = false)
|
private String dataValue;
|
||||||
private String dataField;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 映射字段
|
* 映射字段
|
||||||
|
@ -83,7 +82,7 @@ public class TableFie{
|
||||||
.primarys(tableFie.getPrimarys())
|
.primarys(tableFie.getPrimarys())
|
||||||
.annotation(tableFie.getAnnotation())
|
.annotation(tableFie.getAnnotation())
|
||||||
.tableId(tableFie.getTableId())
|
.tableId(tableFie.getTableId())
|
||||||
.dataField(tableFie.getDataField())
|
.dataValue(tableFie.getDataValue())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +139,7 @@ public class TableFie{
|
||||||
.primarys(tableFie.getPrimarys())
|
.primarys(tableFie.getPrimarys())
|
||||||
.annotation(tableFie.getAnnotation())
|
.annotation(tableFie.getAnnotation())
|
||||||
.tableId(tableFie.getTableId())
|
.tableId(tableFie.getTableId())
|
||||||
.dataField(tableFie.getDataField())
|
.dataValue(tableFie.getDataValue())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,18 +4,13 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:yang
|
* @Author:yang
|
||||||
|
|
|
@ -173,6 +173,10 @@ public class DataRunNameServiceImpl implements DataRunNameService {
|
||||||
// item.setDataMapping(item.getType());
|
// item.setDataMapping(item.getType());
|
||||||
// });
|
// });
|
||||||
fieArrayList.forEach(tableFy -> {
|
fieArrayList.forEach(tableFy -> {
|
||||||
|
|
||||||
|
String str = this.tableFySelect(dataName.getName(),tableName1.getName(),tableFy.getField());
|
||||||
|
tableFy.setDataValue(str);
|
||||||
|
|
||||||
executorService.submit(
|
executorService.submit(
|
||||||
new Runnable() {
|
new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -184,7 +188,6 @@ public class DataRunNameServiceImpl implements DataRunNameService {
|
||||||
tableFy.setDataMapping(dataValue.getType());
|
tableFy.setDataMapping(dataValue.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
@ -198,6 +201,34 @@ public class DataRunNameServiceImpl implements DataRunNameService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String tableFySelect(String dataDame, String tableName, String field) {
|
||||||
|
|
||||||
|
// 从连接池获取数据库连接
|
||||||
|
DruidDataSource conn = JdbcHelper.getConnRs(dataDame);
|
||||||
|
// 初始化一个列表,用于存储数据值对象
|
||||||
|
List<DataValue> list = new ArrayList<>();
|
||||||
|
PreparedStatement preparedStatement = null;
|
||||||
|
try {
|
||||||
|
DruidPooledConnection connection = conn.getConnection();
|
||||||
|
// 准备SQL查询语句
|
||||||
|
connection.prepareStatement("select "+field+" FROM "+tableName);
|
||||||
|
|
||||||
|
ResultSet resultSet = preparedStatement.executeQuery();
|
||||||
|
while (resultSet.next()) {
|
||||||
|
String fields = resultSet.getString(field);
|
||||||
|
// 返回包含数据值的列表
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 释放数据库连接
|
||||||
|
} catch (SQLException e) {
|
||||||
|
// 如果发生SQL异常,抛出运行时异常
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据类型转换
|
* 数据类型转换
|
||||||
* @para 数据类型转换ID
|
* @para 数据类型转换ID
|
||||||
|
@ -224,7 +255,7 @@ public class DataRunNameServiceImpl implements DataRunNameService {
|
||||||
try {
|
try {
|
||||||
PreparedStatement preparedStatement = conn.prepareStatement("select * FROM "+tableName);
|
PreparedStatement preparedStatement = conn.prepareStatement("select * FROM "+tableName);
|
||||||
|
|
||||||
getDataResult(conn, list, preparedStatement);
|
this.getDataResult(conn, list, preparedStatement);
|
||||||
JdbcHelper.close(conn,null,null);
|
JdbcHelper.close(conn,null,null);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
|
@ -11076,3 +11076,4 @@ java.util.concurrent.TimeoutException: Waited 3000 milliseconds (plus 12 millise
|
||||||
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
|
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
|
||||||
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
|
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
|
||||||
at java.base/java.lang.Thread.run(Thread.java:842)
|
at java.base/java.lang.Thread.run(Thread.java:842)
|
||||||
|
20:24:24.046 [com.alibaba.nacos.client.naming.grpc.redo.0] ERROR c.a.n.c.r.client - [printIfErrorEnabled,102] - Send request fail, request = InstanceRequest{headers={accessToken=AUTH_DISABLED, app=unknown}, requestId='null'}, retryTimes = 0, errorMessage = java.lang.InterruptedException
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue