资产更新版本2.0豪华版
parent
72e2aade10
commit
0ca04cc481
|
@ -59,10 +59,19 @@ public class DataRunNameController {
|
||||||
@PostMapping("/extractDataTableName")
|
@PostMapping("/extractDataTableName")
|
||||||
@Operation(summary = "获取数据库名",description = "返回所有数据库以及所有表的结果集")
|
@Operation(summary = "获取数据库名",description = "返回所有数据库以及所有表的结果集")
|
||||||
public Result<List<DataName>> getDataBaseTableName(){
|
public Result<List<DataName>> getDataBaseTableName(){
|
||||||
|
|
||||||
return success(dataRunNameService.getDataBaseTableName());
|
return success(dataRunNameService.getDataBaseTableName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击获取字段 映射 和类型信息
|
||||||
|
* @return 返回结果集
|
||||||
|
*/
|
||||||
|
@PostMapping("/tableStructureShow")
|
||||||
|
@Operation(summary = "获取数据库名",description = "返回所有数据库以及所有表的结果集")
|
||||||
|
public Result<List<TableFie>> tableStructureShow(@RequestBody TableNames tableNames){
|
||||||
|
return success(dataRunNameService.tableStructureShow(tableNames));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资产展示
|
* 资产展示
|
||||||
* 连接数据库获取当前所有的数据库名称和所有字段
|
* 连接数据库获取当前所有的数据库名称和所有字段
|
||||||
|
|
|
@ -81,5 +81,9 @@ public interface DataRunNameService {
|
||||||
*/
|
*/
|
||||||
boolean addDeptAssetAuthorization(AssetAuthorization authorization);
|
boolean addDeptAssetAuthorization(AssetAuthorization authorization);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击获取字段 映射 和类型信息
|
||||||
|
* @return 返回结果集
|
||||||
|
*/
|
||||||
|
List<TableFie> tableStructureShow(TableNames tableNames);
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,50 +240,7 @@ public class DataRunNameServiceImpl implements DataRunNameService {
|
||||||
* @param dataName 库名参数
|
* @param dataName 库名参数
|
||||||
*/
|
*/
|
||||||
public void tableNameRun(TableNames tableName1, DataName dataName) {
|
public void tableNameRun(TableNames tableName1, DataName dataName) {
|
||||||
if (StringUtils.isNotBlank(String.valueOf(tableName1.getId()))) {
|
|
||||||
List<TableFie> tableFieList = tableFieldService.list(new LambdaQueryWrapper<TableFie>()
|
|
||||||
.eq(TableFie::getTableId, tableName1.getId()))
|
|
||||||
.stream()
|
|
||||||
.map(TableFie::tableFieBuild).toList();
|
|
||||||
log.info("字段类型名称集合:{}", tableFieList);
|
|
||||||
ArrayList<TableFie> fieArrayList = new ArrayList<>(tableFieList);
|
|
||||||
tableName1.setTableFie(fieArrayList);
|
|
||||||
|
|
||||||
//创建线程池
|
|
||||||
ExecutorService executorService = Executors.newFixedThreadPool(50);
|
|
||||||
List<DataValue> tableValue = this.findTableValue(String.valueOf(dataName.getId()), tableName1.getName());
|
|
||||||
// fieArrayList.stream().filter(item->item.getField().equals(tableValue.stream().filter(key -> key.getKey()!=null).toList()))
|
|
||||||
// .forEach(item->{
|
|
||||||
// item.setDataMapping(item.getType());
|
|
||||||
// });
|
|
||||||
fieArrayList.forEach(tableFy -> {
|
|
||||||
//查询字段映射信息
|
|
||||||
String str = this.tableFySelect(dataName.getName(),tableName1.getName(),tableFy.getField());
|
|
||||||
tableFy.setDataValue(str);
|
|
||||||
// executorService.submit(
|
|
||||||
// new Runnable() {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
log.info("字段数据对象:{}", tableFy);
|
|
||||||
|
|
||||||
for (DataValue dataValue : tableValue) {
|
|
||||||
if (tableFy.getField().equals(dataValue.getKey())) {
|
|
||||||
tableFy.setDataMapping(dataValue.getType().getJavaType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// try {
|
|
||||||
// Thread.sleep(1000);
|
|
||||||
// } catch (InterruptedException e) {
|
|
||||||
// throw new RuntimeException(e);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
});
|
|
||||||
log.info("字段数据信息:{}", fieArrayList);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,4 +454,33 @@ public class DataRunNameServiceImpl implements DataRunNameService {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TableFie> tableStructureShow(TableNames tableNames) {
|
||||||
|
|
||||||
|
List<TableFie> tableFieList = null;
|
||||||
|
if (StringUtils.isNotBlank(String.valueOf(tableNames.getId()))) {
|
||||||
|
tableFieList = tableFieldService.list(new LambdaQueryWrapper<TableFie>()
|
||||||
|
.eq(TableFie::getTableId, tableNames.getId()))
|
||||||
|
.stream()
|
||||||
|
.map(TableFie::tableFieBuild).toList();
|
||||||
|
log.info("字段类型名称集合:{}", tableFieList);
|
||||||
|
DataName dataName = dataNameService.getById(tableNames.getDataId());
|
||||||
|
List<DataValue> tableValue = this.findTableValue(String.valueOf(dataName.getId()), tableNames.getName());
|
||||||
|
tableFieList.forEach(tableFy -> {
|
||||||
|
//查询字段映射信息
|
||||||
|
String str = this.tableFySelect(dataName.getName(), tableNames.getName(), tableFy.getField());
|
||||||
|
tableFy.setDataValue(str);
|
||||||
|
log.info("字段数据对象:{}", tableFy);
|
||||||
|
|
||||||
|
for (DataValue dataValue : tableValue) {
|
||||||
|
if (tableFy.getField().equals(dataValue.getKey())) {
|
||||||
|
tableFy.setDataMapping(dataValue.getType().getJavaType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
log.info("字段数据信息:{}", tableFieList);
|
||||||
|
}
|
||||||
|
return tableFieList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue