添加查询表结构的接口
parent
c460af8b40
commit
6f41f53152
|
@ -0,0 +1,31 @@
|
||||||
|
package com.muyu.source.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-08-29-19:57
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:字段名注释
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class TableInfoModel {
|
||||||
|
/**
|
||||||
|
* 表名或数据库名
|
||||||
|
*/
|
||||||
|
private String tableName;
|
||||||
|
/**
|
||||||
|
* 表备注
|
||||||
|
*/
|
||||||
|
private String tableRemark;
|
||||||
|
/**
|
||||||
|
* 数据量
|
||||||
|
*/
|
||||||
|
private Long dataNum;
|
||||||
|
}
|
|
@ -50,13 +50,7 @@ public class TableDataController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private TableDataService tableDataService;
|
private TableDataService tableDataService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ChildrenService childrenService;
|
|
||||||
@Autowired
|
|
||||||
private AssetDataSourceService assetDataSourceService;
|
|
||||||
@Autowired
|
|
||||||
private TableInfoService tableInfoService;
|
private TableInfoService tableInfoService;
|
||||||
@Autowired
|
|
||||||
private StructureService structureService;
|
|
||||||
/**
|
/**
|
||||||
* 根据childrenId查询表结构
|
* 根据childrenId查询表结构
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package com.muyu.source.controller;
|
package com.muyu.source.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.dtflys.forest.annotation.NotNull;
|
import com.dtflys.forest.annotation.NotNull;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.source.domain.Structure;
|
import com.muyu.source.domain.Structure;
|
||||||
import com.muyu.source.domain.TableInfo;
|
import com.muyu.source.domain.TableInfo;
|
||||||
|
import com.muyu.source.domain.model.TableInfoModel;
|
||||||
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;
|
||||||
|
@ -67,10 +69,16 @@ public class TableInfoController {
|
||||||
).toList();
|
).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/findStruceure/{id}")
|
/**
|
||||||
public Result<List<Structure>> findStruceure(@PathVariable("id") Integer id) {
|
* 查询数据库表结构中的表名,表注释,数据量
|
||||||
List<Structure> structureList = structureService.findStructurelistS(id);
|
* @return
|
||||||
return Result.success(structureList);
|
*/
|
||||||
|
@GetMapping("/selectColumn")
|
||||||
|
public Result<List<TableInfo>> selectColumn() {
|
||||||
|
List<TableInfo> list = tableInfoService.list(new LambdaQueryWrapper<>() {{
|
||||||
|
select(TableInfo::getTableName, TableInfo::getTableRemark, TableInfo::getDataNum);
|
||||||
|
}});
|
||||||
|
return Result.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,4 +65,6 @@ public class TableServiceImpl extends ServiceImpl<TableInfoMapper, TableInfo> im
|
||||||
}});
|
}});
|
||||||
return structureList;
|
return structureList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,4 +17,6 @@ public interface TableInfoService extends IService<TableInfo> {
|
||||||
List<TableInfoRep> findTablesList(Long id);
|
List<TableInfoRep> findTablesList(Long id);
|
||||||
|
|
||||||
List<Structure> selectTableInfoById(Integer id);
|
List<Structure> selectTableInfoById(Integer id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue