后台资产展示代码
parent
e194d73c1d
commit
80d6cf92ee
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.source.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.dtflys.forest.springboot.annotation.ForestScannerRegister;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
|
@ -8,11 +9,13 @@ import com.muyu.common.core.web.controller.BaseController;
|
|||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.source.domain.AssetDataSource;
|
||||
import com.muyu.source.domain.Children;
|
||||
import com.muyu.source.domain.TableData;
|
||||
import com.muyu.source.domain.rep.TableInfoRep;
|
||||
import com.muyu.source.domain.rep.TableInfoResp;
|
||||
import com.muyu.source.domain.rep.TableInfoTreeRep;
|
||||
import com.muyu.source.service.AssetDataSourceService;
|
||||
import com.muyu.source.service.ChildrenService;
|
||||
import com.muyu.source.service.TableDataService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
@ -49,6 +52,8 @@ public class TableDataController extends BaseController {
|
|||
private TableDataService tableDataService;
|
||||
@Autowired
|
||||
private ChildrenService childrenService;
|
||||
@Autowired
|
||||
private AssetDataSourceService assetDataSourceService;
|
||||
/**
|
||||
* 根据childrenId查询表结构
|
||||
*
|
||||
|
@ -155,12 +160,20 @@ public class TableDataController extends BaseController {
|
|||
@GetMapping("/findTableInfo")
|
||||
@Operation(summary = "查询表结构树", description = "查询表结构树")
|
||||
public Result<List<TableInfoTreeRep>> findTableInfo() {
|
||||
List<Children> childrenList =childrenService.findSourceList();
|
||||
// AssetDataSource dataSource = assetDataSourceService.getOne(new LambdaQueryWrapper<>() {{
|
||||
// eq(AssetDataSource::getType, "dataSource");
|
||||
// }});
|
||||
ArrayList<TableInfoTreeRep> tableInfoTreeReps = new ArrayList<>();
|
||||
List<AssetDataSource> dataSource = assetDataSourceService.list(new LambdaQueryWrapper<>() {{
|
||||
eq(AssetDataSource::getType, "dataSource");
|
||||
}});
|
||||
for (AssetDataSource assetDataSource : dataSource) {
|
||||
List<Children> childrenList =childrenService.findSourceList(assetDataSource.getId());
|
||||
|
||||
for (Children children : childrenList) {
|
||||
TableInfoTreeRep tableInfoTreeRep = new TableInfoTreeRep();
|
||||
tableInfoTreeRep.setChildren(children);
|
||||
List<TableInfoRep> tableInfoRepList =childrenService.findTablesList(children.getId());
|
||||
List<TableInfoRep> tableInfoRepList =childrenService.findTablesList(children.getAssetId());
|
||||
tableInfoTreeRep.setTableInfoRepList(tableInfoRepList);
|
||||
for(TableInfoRep tableInfoRep:tableInfoRepList){
|
||||
List<TableData> tableDataList =tableDataService.findTableDataList(tableInfoRep.getId());
|
||||
|
@ -168,6 +181,7 @@ public class TableDataController extends BaseController {
|
|||
}
|
||||
tableInfoTreeReps.add(tableInfoTreeRep);
|
||||
}
|
||||
}
|
||||
return Result.success(tableInfoTreeReps);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@ import java.util.List;
|
|||
public interface ChildrenService extends IService<Children> {
|
||||
|
||||
|
||||
List<Children> findSourceList();
|
||||
|
||||
List<TableInfoRep> findTablesList(Long id);
|
||||
|
||||
|
||||
List<Children> findSourceList(Long id);
|
||||
}
|
||||
|
|
|
@ -25,13 +25,14 @@ public class ChildrenServiceImpl extends ServiceImpl<ChildrenMapper, Children> i
|
|||
|
||||
@Autowired
|
||||
private ChildrenMapper childrenMapper;
|
||||
|
||||
@Override
|
||||
public List<Children> findSourceList() {
|
||||
return childrenMapper.selectList(new LambdaQueryWrapper<>(Children.class)
|
||||
.eq(Children::getAssetId, 0));
|
||||
public List<Children> findSourceList(Long id) {
|
||||
return childrenMapper.selectList(new LambdaQueryWrapper<>(Children.class){{
|
||||
eq(Children::getAssetId,id);
|
||||
}});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<TableInfoRep> findTablesList(Long id) {
|
||||
List<Children> childrenList = childrenMapper.selectList(new LambdaQueryWrapper<>(Children.class)
|
||||
|
@ -43,4 +44,8 @@ public class ChildrenServiceImpl extends ServiceImpl<ChildrenMapper, Children> i
|
|||
}
|
||||
return tableInfoRepList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue