fix:() 优化任务调动方法
parent
70b0f5f0d9
commit
19b9a8ed69
|
@ -38,18 +38,18 @@ public class DataLinkController {
|
|||
|
||||
/**
|
||||
* 查询表数据count
|
||||
* @param basicDataName 数据库名称
|
||||
* @param targetTableName sql语句
|
||||
* @param databaseName 数据库名称
|
||||
* @param tableName sql语句
|
||||
* @param listList sql语句
|
||||
* @return 反护试图
|
||||
*/
|
||||
@PostMapping("/addProduct")
|
||||
public Result addProduct(@RequestParam("targetDatabase") String targetDatabase,
|
||||
@RequestParam("targetTableName") String targetTableName,
|
||||
public Result addProduct(@RequestParam("databaseName") String databaseName,
|
||||
@RequestParam("tableName") String tableName,
|
||||
@RequestBody DataValue[][] listList){
|
||||
long begin = System.currentTimeMillis();
|
||||
|
||||
int i = dataLinkService.addProduct(targetDatabase,targetTableName,listList);
|
||||
int i = dataLinkService.addProduct(databaseName,tableName,listList);
|
||||
|
||||
|
||||
long end = System.currentTimeMillis();
|
||||
|
|
|
@ -61,10 +61,10 @@ public interface DataLinkService {
|
|||
|
||||
/**
|
||||
* 查询表数据count
|
||||
* @param basicDataName 数据库名称
|
||||
* @param targetTableName sql语句
|
||||
* @param databaseName 数据库名称
|
||||
* @param tableName sql语句
|
||||
* @param listList sql语句
|
||||
* @return 反护试图
|
||||
*/
|
||||
int addProduct(String targetDatabase, String targetTableName, DataValue[]... listList);
|
||||
int addProduct(String databaseName, String tableName, DataValue[]... listList);
|
||||
}
|
||||
|
|
|
@ -134,15 +134,15 @@ public class DataLinkServiceImpl implements DataLinkService {
|
|||
/**
|
||||
* 添加方法
|
||||
* @param databaseName 数据库名称
|
||||
* @param targetTableName sql语句
|
||||
* @param tableName sql语句
|
||||
* @param listList sql语句
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Log(title = "添加产品数据库", businessType = BusinessType.INSERT)
|
||||
public int addProduct(String targetDatabase, String targetTableName, DataValue[]... listList) {
|
||||
public int addProduct(String databaseName, String tableName, DataValue[]... listList) {
|
||||
|
||||
Connect connect = connectService.selectData(targetDatabase);
|
||||
Connect connect = connectService.selectData(databaseName);
|
||||
|
||||
ConnectReq connectReq = new ConnectReq();
|
||||
HikariConfig hikariConfig = new HikariConfig();
|
||||
|
@ -169,7 +169,7 @@ public class DataLinkServiceImpl implements DataLinkService {
|
|||
for (DataValue[][] batch : batches) {
|
||||
executorService.submit(() -> {
|
||||
try (Statement stmt = conn.createStatement()) {
|
||||
String sql = buildBatchInsertSQL(targetTableName, batch);
|
||||
String sql = buildBatchInsertSQL(tableName, batch);
|
||||
stmt.executeUpdate(sql);
|
||||
addCount.addAndGet(batch.length);
|
||||
} catch (SQLException e) {
|
||||
|
|
Loading…
Reference in New Issue