字典类型展示

master
冷调 2024-08-26 14:23:27 +08:00
parent 8c7a048f90
commit 2495bb4792
2 changed files with 22 additions and 3 deletions

View File

@ -10,6 +10,8 @@ import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author Lenovo
* @ ToolIntelliJ IDEA
@ -20,7 +22,7 @@ import org.springframework.web.bind.annotation.*;
*/
@Log4j2
@RestController
@RequestMapping("/dict_data")
@RequestMapping("/dictData")
@Tag(name = "数据字典控制层", description = "进行数据字典管理,查看等相关操作")
public class DictDataController {
public DictDataController() {
@ -30,6 +32,16 @@ public class DictDataController {
@Autowired
private DictDataService dictDataService;
/**
*
* @return
*/
@GetMapping("/selectDictDataList")
public Result<List<DictData>> selectDictDataList() {
List<DictData> list = dictDataService.list();
return Result.success(list);
}
/**
*
*

View File

@ -137,19 +137,24 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
*/
@Override
public void synchronous(DataSource dataSource) {
// 获取指定ID的资产数据源对象
AssetDataSource dataSourceServiceOne = assetDataSourceService.getOne(new LambdaQueryWrapper<>() {{
eq(AssetDataSource::getId, dataSource.getId());
}});
//如果存在 删除
//如果存在则进行删除
if (StringUtils.isNotNull(dataSourceServiceOne)) {
// 根据资产数据源ID查询所有的表
List<Children> childrenList = childrenService.list(new LambdaQueryWrapper<>() {{
eq(Children::getAssetId, dataSourceServiceOne.getId());
}});
childrenList.forEach(children -> {
//删除表结构中表的所有数据
tableDataService.remove(new LambdaQueryWrapper<>() {{
eq(TableData::getChildrenId, children.getId());
}});
});
// 删除数据库结构中所有的数据
childrenService.remove(new LambdaQueryWrapper<>() {{
eq(Children::getAssetId, dataSourceServiceOne.getId());
}});
@ -163,9 +168,11 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
.systemName(dataSource.getSystemName())
.databaseName(dataSource.getDatabaseName())
.build();
//添加资产数据源结构 库
assetDataSourceService.save(build);
//添加资产数据源下的所有表结构 表
List<Children> childrenList = addChildren(build);
//循环遍历添加表结构的数据 字段
childrenList.forEach(children -> {
addTable(build, children.getName());
});