添加根据表id查询出表结构的数据
parent
1048ade900
commit
c460af8b40
|
@ -11,13 +11,12 @@ import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.source.domain.AssetDataSource;
|
import com.muyu.source.domain.AssetDataSource;
|
||||||
import com.muyu.source.domain.Children;
|
import com.muyu.source.domain.Children;
|
||||||
|
import com.muyu.source.domain.Structure;
|
||||||
import com.muyu.source.domain.TableData;
|
import com.muyu.source.domain.TableData;
|
||||||
import com.muyu.source.domain.rep.TableInfoRep;
|
import com.muyu.source.domain.rep.TableInfoRep;
|
||||||
import com.muyu.source.domain.rep.TableInfoResp;
|
import com.muyu.source.domain.rep.TableInfoResp;
|
||||||
import com.muyu.source.domain.rep.TableInfoTreeRep;
|
import com.muyu.source.domain.rep.TableInfoTreeRep;
|
||||||
import com.muyu.source.service.AssetDataSourceService;
|
import com.muyu.source.service.*;
|
||||||
import com.muyu.source.service.ChildrenService;
|
|
||||||
import com.muyu.source.service.TableDataService;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
@ -54,6 +53,10 @@ public class TableDataController extends BaseController {
|
||||||
private ChildrenService childrenService;
|
private ChildrenService childrenService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AssetDataSourceService assetDataSourceService;
|
private AssetDataSourceService assetDataSourceService;
|
||||||
|
@Autowired
|
||||||
|
private TableInfoService tableInfoService;
|
||||||
|
@Autowired
|
||||||
|
private StructureService structureService;
|
||||||
/**
|
/**
|
||||||
* 根据childrenId查询表结构
|
* 根据childrenId查询表结构
|
||||||
*
|
*
|
||||||
|
@ -66,6 +69,17 @@ public class TableDataController extends BaseController {
|
||||||
return success(tableDataService.getById(id));
|
return success(tableDataService.getById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据表的id查询表结构
|
||||||
|
* @param id id
|
||||||
|
* @return tableInfo
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectStructureById/{id}")
|
||||||
|
public Result<List<Structure>> selectStructureById(@PathVariable("id") Integer id) {
|
||||||
|
List<Structure> structureList =tableInfoService.selectTableInfoById(id);
|
||||||
|
return success(structureList);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询结构列表
|
* 查询结构列表
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -60,8 +60,6 @@ public class TableInfoController {
|
||||||
return Result.success(respList);
|
return Result.success(respList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static List<TableInfoResp> getChildren(TableInfo tableInfo, List<TableInfo> list) {
|
private static List<TableInfoResp> getChildren(TableInfo tableInfo, List<TableInfo> list) {
|
||||||
return list.stream().filter(tableInfo1 -> tableInfo1.getParentId().equals(tableInfo.getId())).map(
|
return list.stream().filter(tableInfo1 -> tableInfo1.getParentId().equals(tableInfo.getId())).map(
|
||||||
|
|
|
@ -3,8 +3,10 @@ package com.muyu.source.service.Impl;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
import com.muyu.source.domain.Structure;
|
||||||
import com.muyu.source.domain.TableInfo;
|
import com.muyu.source.domain.TableInfo;
|
||||||
import com.muyu.source.domain.rep.TableInfoRep;
|
import com.muyu.source.domain.rep.TableInfoRep;
|
||||||
|
import com.muyu.source.mapper.StructureMapper;
|
||||||
import com.muyu.source.mapper.TableInfoMapper;
|
import com.muyu.source.mapper.TableInfoMapper;
|
||||||
import com.muyu.source.service.TableInfoService;
|
import com.muyu.source.service.TableInfoService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -17,6 +19,8 @@ import java.util.List;
|
||||||
public class TableServiceImpl extends ServiceImpl<TableInfoMapper, TableInfo> implements TableInfoService {
|
public class TableServiceImpl extends ServiceImpl<TableInfoMapper, TableInfo> implements TableInfoService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private TableInfoMapper tableInfoMapper;
|
private TableInfoMapper tableInfoMapper;
|
||||||
|
@Autowired
|
||||||
|
private StructureMapper structureMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableInfo selectTableInfoByName(TableInfo tableInfoInsert) {
|
public TableInfo selectTableInfoByName(TableInfo tableInfoInsert) {
|
||||||
|
@ -53,4 +57,12 @@ public class TableServiceImpl extends ServiceImpl<TableInfoMapper, TableInfo> im
|
||||||
|
|
||||||
return tableInfoRepList;
|
return tableInfoRepList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Structure> selectTableInfoById(Integer id) {
|
||||||
|
List<Structure> structureList = structureMapper.selectList(new LambdaQueryWrapper<>(Structure.class) {{
|
||||||
|
eq(Structure::getTableId, id);
|
||||||
|
}});
|
||||||
|
return structureList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.muyu.source.service;
|
package com.muyu.source.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.source.domain.Structure;
|
||||||
import com.muyu.source.domain.TableInfo;
|
import com.muyu.source.domain.TableInfo;
|
||||||
import com.muyu.source.domain.rep.TableInfoRep;
|
import com.muyu.source.domain.rep.TableInfoRep;
|
||||||
|
|
||||||
|
@ -14,4 +15,6 @@ public interface TableInfoService extends IService<TableInfo> {
|
||||||
List<TableInfo> findSourceList();
|
List<TableInfo> findSourceList();
|
||||||
|
|
||||||
List<TableInfoRep> findTablesList(Long id);
|
List<TableInfoRep> findTablesList(Long id);
|
||||||
|
|
||||||
|
List<Structure> selectTableInfoById(Integer id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue