字典类型展示
parent
8c7a048f90
commit
2495bb4792
|
@ -10,6 +10,8 @@ import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Lenovo
|
* @author Lenovo
|
||||||
* @ Tool:IntelliJ IDEA
|
* @ Tool:IntelliJ IDEA
|
||||||
|
@ -20,7 +22,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
*/
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/dict_data")
|
@RequestMapping("/dictData")
|
||||||
@Tag(name = "数据字典控制层", description = "进行数据字典管理,查看等相关操作")
|
@Tag(name = "数据字典控制层", description = "进行数据字典管理,查看等相关操作")
|
||||||
public class DictDataController {
|
public class DictDataController {
|
||||||
public DictDataController() {
|
public DictDataController() {
|
||||||
|
@ -30,6 +32,16 @@ public class DictDataController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private DictDataService dictDataService;
|
private DictDataService dictDataService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字典数据
|
||||||
|
* @return 查询结果
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectDictDataList")
|
||||||
|
public Result<List<DictData>> selectDictDataList() {
|
||||||
|
List<DictData> list = dictDataService.list();
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加字典数据
|
* 添加字典数据
|
||||||
*
|
*
|
||||||
|
|
|
@ -137,19 +137,24 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void synchronous(DataSource dataSource) {
|
public void synchronous(DataSource dataSource) {
|
||||||
|
// 获取指定ID的资产数据源对象
|
||||||
AssetDataSource dataSourceServiceOne = assetDataSourceService.getOne(new LambdaQueryWrapper<>() {{
|
AssetDataSource dataSourceServiceOne = assetDataSourceService.getOne(new LambdaQueryWrapper<>() {{
|
||||||
eq(AssetDataSource::getId, dataSource.getId());
|
eq(AssetDataSource::getId, dataSource.getId());
|
||||||
}});
|
}});
|
||||||
//如果存在 删除
|
//如果存在则进行删除
|
||||||
if (StringUtils.isNotNull(dataSourceServiceOne)) {
|
if (StringUtils.isNotNull(dataSourceServiceOne)) {
|
||||||
|
// 根据资产数据源ID查询所有的表
|
||||||
List<Children> childrenList = childrenService.list(new LambdaQueryWrapper<>() {{
|
List<Children> childrenList = childrenService.list(new LambdaQueryWrapper<>() {{
|
||||||
eq(Children::getAssetId, dataSourceServiceOne.getId());
|
eq(Children::getAssetId, dataSourceServiceOne.getId());
|
||||||
}});
|
}});
|
||||||
|
|
||||||
childrenList.forEach(children -> {
|
childrenList.forEach(children -> {
|
||||||
|
//删除表结构中表的所有数据
|
||||||
tableDataService.remove(new LambdaQueryWrapper<>() {{
|
tableDataService.remove(new LambdaQueryWrapper<>() {{
|
||||||
eq(TableData::getChildrenId, children.getId());
|
eq(TableData::getChildrenId, children.getId());
|
||||||
}});
|
}});
|
||||||
});
|
});
|
||||||
|
// 删除数据库结构中所有的数据
|
||||||
childrenService.remove(new LambdaQueryWrapper<>() {{
|
childrenService.remove(new LambdaQueryWrapper<>() {{
|
||||||
eq(Children::getAssetId, dataSourceServiceOne.getId());
|
eq(Children::getAssetId, dataSourceServiceOne.getId());
|
||||||
}});
|
}});
|
||||||
|
@ -163,9 +168,11 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
|
||||||
.systemName(dataSource.getSystemName())
|
.systemName(dataSource.getSystemName())
|
||||||
.databaseName(dataSource.getDatabaseName())
|
.databaseName(dataSource.getDatabaseName())
|
||||||
.build();
|
.build();
|
||||||
|
//添加资产数据源结构 库
|
||||||
assetDataSourceService.save(build);
|
assetDataSourceService.save(build);
|
||||||
|
//添加资产数据源下的所有表结构 表
|
||||||
List<Children> childrenList = addChildren(build);
|
List<Children> childrenList = addChildren(build);
|
||||||
|
//循环遍历添加表结构的数据 字段
|
||||||
childrenList.forEach(children -> {
|
childrenList.forEach(children -> {
|
||||||
addTable(build, children.getName());
|
addTable(build, children.getName());
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue