添加根据表id查询出表结构的数据

master
冷调 2024-08-29 19:27:57 +08:00
parent 1048ade900
commit c460af8b40
4 changed files with 32 additions and 5 deletions

View File

@ -11,13 +11,12 @@ 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.Structure;
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 com.muyu.source.service.*;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
@ -54,6 +53,10 @@ public class TableDataController extends BaseController {
private ChildrenService childrenService;
@Autowired
private AssetDataSourceService assetDataSourceService;
@Autowired
private TableInfoService tableInfoService;
@Autowired
private StructureService structureService;
/**
* childrenId
*
@ -66,6 +69,17 @@ public class TableDataController extends BaseController {
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);
}
/**
*
*/

View File

@ -60,8 +60,6 @@ public class TableInfoController {
return Result.success(respList);
}
@NotNull
private static List<TableInfoResp> getChildren(TableInfo tableInfo, List<TableInfo> list) {
return list.stream().filter(tableInfo1 -> tableInfo1.getParentId().equals(tableInfo.getId())).map(

View File

@ -3,8 +3,10 @@ package com.muyu.source.service.Impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.rep.TableInfoRep;
import com.muyu.source.mapper.StructureMapper;
import com.muyu.source.mapper.TableInfoMapper;
import com.muyu.source.service.TableInfoService;
import org.springframework.beans.factory.annotation.Autowired;
@ -17,6 +19,8 @@ import java.util.List;
public class TableServiceImpl extends ServiceImpl<TableInfoMapper, TableInfo> implements TableInfoService {
@Autowired
private TableInfoMapper tableInfoMapper;
@Autowired
private StructureMapper structureMapper;
@Override
public TableInfo selectTableInfoByName(TableInfo tableInfoInsert) {
@ -53,4 +57,12 @@ public class TableServiceImpl extends ServiceImpl<TableInfoMapper, TableInfo> im
return tableInfoRepList;
}
@Override
public List<Structure> selectTableInfoById(Integer id) {
List<Structure> structureList = structureMapper.selectList(new LambdaQueryWrapper<>(Structure.class) {{
eq(Structure::getTableId, id);
}});
return structureList;
}
}

View File

@ -1,6 +1,7 @@
package com.muyu.source.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.source.domain.Structure;
import com.muyu.source.domain.TableInfo;
import com.muyu.source.domain.rep.TableInfoRep;
@ -14,4 +15,6 @@ public interface TableInfoService extends IService<TableInfo> {
List<TableInfo> findSourceList();
List<TableInfoRep> findTablesList(Long id);
List<Structure> selectTableInfoById(Integer id);
}