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