Commit 4e75b7b0 authored by wenmo's avatar wenmo

元数据表信息和字段

parent 6bd35351
......@@ -21,13 +21,15 @@ public class Column implements Serializable {
private String type;
private String comment;
private boolean keyFlag;
/**
* 主键是否为自增类型
*/
private boolean keyIdentityFlag;
private String fill;
private String isNotNull;
private boolean autoIncrement;
private String defaultValue;
private boolean isNullable;
private String javaType;
private String columnFamily;
private Integer position;
private Integer precision;
private Integer scale;
private String characterSet;
private String collation;
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import lombok.Setter;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
......@@ -26,10 +27,9 @@ public class Table implements Serializable, Comparable<Table> {
private String type;
private String engine;
private String options;
private String collation;
private Long rows;
private LocalDateTime createTime;
private LocalDateTime updateTime;
private Date createTime;
private Date updateTime;
private List<Column> columns;
public Table() {
......
......@@ -7,6 +7,7 @@ import com.alibaba.druid.sql.parser.SQLStatementParser;
import com.alibaba.druid.sql.parser.Token;
import com.dlink.assertion.Asserts;
import com.dlink.constant.CommonConstant;
import com.dlink.metadata.query.IDBQuery;
import com.dlink.metadata.result.JdbcSelectResult;
import com.dlink.model.Column;
import com.dlink.model.Schema;
......@@ -118,18 +119,25 @@ public abstract class AbstractJdbcDriver extends AbstractDriver {
List<Table> tableList = new ArrayList<>();
PreparedStatement preparedStatement = null;
ResultSet results = null;
String sql = getDBQuery().tablesSql(schemaName);
IDBQuery dbQuery = getDBQuery();
String sql = dbQuery.tablesSql(schemaName);
try {
preparedStatement = conn.prepareStatement(sql);
results = preparedStatement.executeQuery();
while (results.next()) {
String tableName = results.getString(getDBQuery().tableName());
String tableName = results.getString(dbQuery.tableName());
if (Asserts.isNotNullString(tableName)) {
Table tableInfo = new Table();
tableInfo.setName(tableName);
String tableComment = results.getString(getDBQuery().tableComment());
tableInfo.setComment(tableComment);
tableInfo.setComment(results.getString(dbQuery.tableComment()));
tableInfo.setSchema(schemaName);
tableInfo.setType(results.getString(dbQuery.tableType()));
tableInfo.setCatalog(results.getString(dbQuery.catalogName()));
tableInfo.setEngine(results.getString(dbQuery.engine()));
tableInfo.setOptions(results.getString(dbQuery.options()));
tableInfo.setRows(results.getLong(dbQuery.rows()));
tableInfo.setCreateTime(results.getDate(dbQuery.createTime()));
tableInfo.setUpdateTime(results.getDate(dbQuery.updateTime()));
tableList.add(tableInfo);
}
}
......@@ -146,27 +154,28 @@ public abstract class AbstractJdbcDriver extends AbstractDriver {
List<Column> columns = new ArrayList<>();
PreparedStatement preparedStatement = null;
ResultSet results = null;
String tableFieldsSql = getDBQuery().columnsSql(schemaName, tableName);
IDBQuery dbQuery = getDBQuery();
String tableFieldsSql = dbQuery.columnsSql(schemaName, tableName);
tableFieldsSql = String.format(tableFieldsSql, tableName);
try {
preparedStatement = conn.prepareStatement(tableFieldsSql);
results = preparedStatement.executeQuery();
while (results.next()) {
Column field = new Column();
String columnName = results.getString(getDBQuery().columnName());
boolean isId;
String key = results.getString(getDBQuery().columnKey());
isId = Asserts.isNotNullString(key) && "PRI".equals(key.toUpperCase());
if (isId) {
field.setKeyFlag(true);
} else {
field.setKeyFlag(false);
}
String columnName = results.getString(dbQuery.columnName());
String key = results.getString(dbQuery.columnKey());
field.setKeyFlag(Asserts.isNotNullString(key) && Asserts.isEqualsIgnoreCase("PRI",key));
field.setName(columnName);
field.setType(results.getString(getDBQuery().columnType()));
field.setType(results.getString(dbQuery.columnType()));
field.setJavaType(getTypeConvert().convert(field.getType()).getType());
field.setComment(results.getString(getDBQuery().columnComment()));
field.setIsNotNull(results.getString(getDBQuery().isNotNull()));
field.setComment(results.getString(dbQuery.columnComment()));
field.setNullable(Asserts.isEqualsIgnoreCase(results.getString(dbQuery.isNullable()),"YES"));
field.setCharacterSet(results.getString(dbQuery.characterSet()));
field.setCollation(results.getString(dbQuery.collation()));
field.setPosition(results.getInt(dbQuery.columnPosition()));
field.setPrecision(results.getInt(dbQuery.precision()));
field.setScale(results.getInt(dbQuery.scale()));
field.setAutoIncrement(Asserts.isEqualsIgnoreCase(results.getString(dbQuery.autoIncrement()),"auto_increment"));
columns.add(field);
}
} catch (SQLException e) {
......
......@@ -55,28 +55,78 @@ public abstract class AbstractDBQuery implements IDBQuery {
return "OPTIONS";
}
@Override
public String rows() {
return "ROWS";
}
@Override
public String createTime() {
return "CREATE_TIME";
}
@Override
public String updateTime() {
return "UPDATE_TIME";
}
@Override
public String columnName() {
return "FIELD";
return "COLUMN_NAME";
}
@Override
public String columnPosition() {
return "ORDINAL_POSITION";
}
@Override
public String columnType() {
return "TYPE";
return "DATA_TYPE";
}
@Override
public String columnComment() {
return "COMMENT";
return "COLUMN_COMMENT";
}
@Override
public String columnKey() {
return "KEY";
return "COLUMN_KEY";
}
@Override
public String autoIncrement() {
return "AUTO_INCREMENT";
}
@Override
public String defaultValue() {
return "COLUMN_DEFAULT";
}
@Override
public String isNullable() {
return "IS_NULLABLE";
}
@Override
public String precision() {
return "NUMERIC_PRECISION";
}
@Override
public String scale() {
return "NUMERIC_SCALE";
}
@Override
public String characterSet() {
return "CHARACTER_SET_NAME";
}
@Override
public String isNotNull() {
return "NULL";
public String collation() {
return "COLLATION_NAME";
}
}
......@@ -50,10 +50,26 @@ public interface IDBQuery {
* 表配置
*/
String options();
/**
* 表记录数
*/
String rows();
/**
* 创建时间
*/
String createTime();
/**
* 更新时间
*/
String updateTime();
/**
* 字段名称
*/
String columnName();
/**
* 字段序号
*/
String columnPosition();
/**
* 字段类型
*/
......@@ -67,21 +83,43 @@ public interface IDBQuery {
*/
String columnKey();
/**
* 判断主键是否为identity,目前仅对mysql进行检查
*
* @param results ResultSet
* @return 主键是否为identity
* @throws SQLException ignore
* 主键自增
*/
boolean isKeyIdentity(ResultSet results) throws SQLException;
String autoIncrement();
/**
* 判断字段是否不为null,目前仅对mysql进行检查
*
* @return 主键是否不为bull
* 默认值
*/
String defaultValue();
/**
* @return 是否允许为 NULL
*/
String isNotNull();
String isNullable();
/**
* @return 精度
*/
String precision();
/**
* @return 小数范围
*/
String scale();
/**
* @return 字符集名称
*/
String characterSet();
/**
* @return 排序规则
*/
String collation();
/**
* 自定义字段名称
*/
String[] columnCustom();
/**
* 判断主键是否为identity,目前仅对mysql进行检查
*
* @param results ResultSet
* @return 主键是否为identity
* @throws SQLException ignore
*/
boolean isKeyIdentity(ResultSet results) throws SQLException;
}
......@@ -54,7 +54,7 @@ public class MySqlDriver extends AbstractJdbcDriver {
sb.append(",");
}
sb.append("`"+columns.get(i).getName() + "` " + getTypeConvert().convertToDB(columns.get(i)));
if("YES".equals(columns.get(i).getIsNotNull())){
if(columns.get(i).isNullable()){
sb.append(" NOT NULL");
}else{
sb.append(" NULL");
......
package com.dlink.metadata.query;
import com.dlink.assertion.Asserts;
import java.sql.ResultSet;
import java.sql.SQLException;
......@@ -21,13 +19,18 @@ public class MySqlQuery extends AbstractDBQuery {
@Override
public String tablesSql(String schemaName) {
return "select TABLE_NAME AS `NAME`,TABLE_SCHEMA AS `Database`,TABLE_COMMENT AS COMMENT,TABLE_CATALOG AS `CATALOG`" +
",TABLE_TYPE AS `TYPE`,ENGINE AS `ENGINE`,CREATE_OPTIONS AS `OPTIONS` from information_schema.tables" +
" where TABLE_SCHEMA = '"+schemaName+"'";
",TABLE_TYPE AS `TYPE`,ENGINE AS `ENGINE`,CREATE_OPTIONS AS `OPTIONS`,TABLE_ROWS AS `ROWS`" +
",CREATE_TIME,UPDATE_TIME from information_schema.tables" +
" where TABLE_SCHEMA = '" + schemaName + "'";
}
@Override
public String columnsSql(String schemaName,String tableName) {
return "show full columns from `"+tableName+"`";
public String columnsSql(String schemaName, String tableName) {
return "select COLUMN_NAME,DATA_TYPE,COLUMN_COMMENT,COLUMN_KEY,EXTRA AS AUTO_INCREMENT" +
",COLUMN_DEFAULT,IS_NULLABLE,NUMERIC_PRECISION,NUMERIC_SCALE,CHARACTER_SET_NAME" +
",COLLATION_NAME,ORDINAL_POSITION from INFORMATION_SCHEMA.COLUMNS " +
"where TABLE_SCHEMA = '" + schemaName + "' and TABLE_NAME = '" + tableName + "' " +
"order by ORDINAL_POSITION";
}
@Override
......
......@@ -55,7 +55,7 @@ public class OracleDriver extends AbstractJdbcDriver {
sb.append(",");
}
sb.append(columns.get(i).getName() + " " + getTypeConvert().convertToDB(columns.get(i).getType()));
if("YES".equals(columns.get(i).getIsNotNull())){
if(columns.get(i).isNullable()){
sb.append(" NOT NULL");
}
}
......
......@@ -79,7 +79,7 @@ public class OracleQuery extends AbstractDBQuery {
}
@Override
public String isNotNull() {
public String isNullable() {
return "NULLABLE";
}
}
import {
message, Button,Tree, Empty, Select,Tag,
Tabs, Button,Tree, Empty, Select,Tag,
Tooltip
} from "antd";
import {StateType} from "@/pages/FlinkSqlStudio/model";
......@@ -7,10 +7,10 @@ import {connect} from "umi";
import {useState} from "react";
import styles from "./index.less";
import {
ReloadOutlined,
TableOutlined,
DatabaseOutlined,
DownOutlined,
TableOutlined, FireOutlined
OrderedListOutlined, FireOutlined
} from '@ant-design/icons';
import React from "react";
import {showMetaDataTable} from "@/components/Studio/StudioEvent/DDL";
......@@ -18,24 +18,25 @@ import { Scrollbars } from 'react-custom-scrollbars';
import {
ModalForm,
} from '@ant-design/pro-form';
import ProDescriptions from "@ant-design/pro-descriptions";
import StudioPreview from "@/components/Studio/StudioConsole/StudioPreview";
import Columns from "@/pages/DataBase/Columns";
import Tables from "@/pages/DataBase/Tables";
import {TreeDataNode} from "@/components/Studio/StudioTree/Function";
const { DirectoryTree } = Tree;
const {Option} = Select;
const { TabPane } = Tabs;
const StudioMetaData = (props: any) => {
const {database,toolHeight, dispatch} = props;
const [databaseId, setDataBaseId] = useState<number>();
const [databaseId, setDatabaseId] = useState<number>();
const [treeData, setTreeData] = useState<[]>([]);
const [modalVisit, setModalVisit] = useState(false);
const [row, setRow] = useState<TreeDataNode>();
const onRefreshTreeData = ()=>{
const onRefreshTreeData = (databaseId: number)=>{
if(!databaseId)return;
setDatabaseId(databaseId);
const res = showMetaDataTable(databaseId);
res.then((result) => {
let tables = result.datas;
......@@ -58,23 +59,18 @@ const StudioMetaData = (props: any) => {
};
const onChangeDataBase = (value: number)=>{
setDataBaseId(value);
onRefreshTreeData();
onRefreshTreeData(value);
};
const getDataBaseOptions = ()=>{
let itemList = [];
for (let item of database) {
let tag = (<><Tag color={item.enabled ? "processing" : "error"}>{item.type}</Tag>{item.alias}</>);
itemList.push(<Option value={item.id} label={tag}>
{tag}
</Option>)
}
return itemList;
return <>{database.map(({ id, alias, type, enabled }) => (
<Option value={id} label={<><Tag color={enabled ? "processing" : "error"}>{type}</Tag>{alias}</>}>
<Tag color={enabled ? "processing" : "error"}>{type}</Tag>{alias}
</Option>
))}</>
};
const openColumnInfo = (e: React.MouseEvent, node: TreeDataNode) => {
console.log(node);
if(node.isLeaf){
setRow(node);
setModalVisit(true);
......@@ -91,13 +87,6 @@ const StudioMetaData = (props: any) => {
>
{getDataBaseOptions()}
</Select>
<Tooltip title="刷新元数据">
<Button
type="text"
icon={<ReloadOutlined/>}
onClick={onRefreshTreeData}
/>
</Tooltip>
<Scrollbars style={{height: (toolHeight - 32)}}>
{treeData.length>0?(
<DirectoryTree
......@@ -110,15 +99,18 @@ const StudioMetaData = (props: any) => {
/>):(<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />)}
</Scrollbars>
<ModalForm
// title="新建表单"
title={ (row?(row.key)+'的':'')+'字段信息'}
title={row?.key}
visible={modalVisit}
width={1000}
onFinish={async () => {
// setRow(undefined);
// setModalVisit(false);
}}
modalProps={{
maskClosable:false
maskClosable:false,
bodyStyle:{
padding: '5px'
}
}}
onVisibleChange={setModalVisit}
submitter={{
......@@ -128,10 +120,33 @@ const StudioMetaData = (props: any) => {
},
},
}}
>
{row?
(<Columns dbId={databaseId} schema={row.schema} table={row.table}/>) : (<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />)}
</ModalForm>
<Tabs defaultActiveKey="2">
<TabPane
tab={
<span>
<TableOutlined />
表信息
</span>
}
key="tableInfo"
>
{row?<Tables table={row}/>:<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />}
</TabPane>
<TabPane
tab={
<span>
<OrderedListOutlined />
字段信息
</span>
}
key="columnInfo"
>
{row? <Columns dbId={databaseId} schema={row.schema} table={row.table}/> : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />}
</TabPane>
</Tabs>
</ModalForm>
</>
);
};
......
......@@ -412,8 +412,6 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
setTaskFormValues({});
openByKey(datas.id);
showEnv(dispatch);
// getTreeData();
// onSelect([],openByKey(datas.id));
}
}}
onCancel={() => {
......
......@@ -124,14 +124,11 @@ export const SqlSvg = () => (
</svg>
);
export const MysqlSvg = () => (
<svg t="1640784392625" className="icon" viewBox="0 0 1536 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
p-id="1930" width="24px" height="24px">
<svg t="1641038977488" className="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
p-id="3761" width="24px" height="24px">
<path
d="M1049.682334 103.921981a71.661153 71.661153 0 0 0-17.556983 2.098648v0.818984h0.870171a141.070099 141.070099 0 0 0 13.717992 17.096304c3.429498 6.705436 6.398317 13.410873 9.879002 20.116309l0.870171-0.818984a23.443434 23.443434 0 0 0 8.957644-20.935294c-2.559327-3.020006-2.917633-5.937638-5.118653-8.855271-2.559327-4.197296-8.036286-6.295944-11.516971-9.571883zM369.208498 932.785589h-59.376384Q307.119228 793.967698 292.633437 655.71286h-0.511865l-90.293053 277.072729h-45.09534l-89.576441-277.072729H66.542499q-10.237308 138.203652-12.438328 277.072729H0q5.118654-185.295267 26.207507-347.454219H99.813749l85.379145 255.318451h0.511866l86.146943-255.216078h70.125557q21.856652 173.010498 27.282425 347.454219z m256.956421-256.290995a775.527236 775.527236 0 0 1-95.462894 280.195109A127.096174 127.096174 0 0 1 429.455053 1024a101.298159 101.298159 0 0 1-36.240069-8.650525v-30.967855a177.412541 177.412541 0 0 0 24.723098 1.586782 60.400115 60.400115 0 0 0 41.358723-13.973925 50.162807 50.162807 0 0 0 18.939019-37.929224 246.770299 246.770299 0 0 0-14.741723-59.325198l-64.853344-198.143088h58.199094l46.477377 148.44096a195.788508 195.788508 0 0 1 13.15494 70.535049 944.852304 944.852304 0 0 0 53.387559-218.976009h56.305192z m859.933837-207.561411a202.033265 202.033265 0 0 0-83.024565 11.721717c-6.398317 2.50814-16.635625 2.50814-17.505795 10.544427 3.480685 3.327125 3.99255 8.804085 7.012555 13.410873a98.636459 98.636459 0 0 0 22.163771 25.593268c8.957644 6.858996 17.915288 13.564433 27.282425 19.450885 16.635625 10.237308 35.472271 16.021386 51.800776 26.156321 9.367136 5.886452 18.785459 13.410873 28.152596 19.706817 4.709161 3.122379 7.677981 8.804085 13.717992 10.800359v-1.382036c-2.968819-3.787804-3.83899-9.213577-6.756623-13.410873-4.248483-4.197296-8.548152-8.036286-12.796634-12.13121a204.746152 204.746152 0 0 0-44.429915-42.484826c-13.666806-9.213577-43.662117-21.959025-49.292636-37.366173l-0.870171-0.818984a179.152883 179.152883 0 0 0 29.534632-6.705437c14.48579-3.787804 27.79429-2.917633 42.843132-6.705436a307.631093 307.631093 0 0 0 20.474616-5.886452v-3.787804c-7.677981-7.524421-13.410873-17.761729-21.344787-24.774284a566.737348 566.737348 0 0 0-70.637422-51.698404c-13.462059-8.394592-30.711923-13.820365-44.634661-20.935294-5.118654-2.50814-13.666806-3.83899-16.635625-8.036286a158.166402 158.166402 0 0 1-17.556983-32.349892q-18.836646-35.830577-34.960405-73.04319a438.259138 438.259138 0 0 0-21.754279-47.910599A427.458778 427.458778 0 0 0 1120.985181 60.003931 212.219386 212.219386 0 0 0 1066.215585 42.754068c-10.6468-0.511865-21.344786-1.279663-31.991586-1.689156a150.590795 150.590795 0 0 1-19.80919-14.741723c-24.415979-15.100029-87.37542-47.75704-105.188336-4.504415-11.619344 27.231238 17.045117 54.104171 26.975306 67.924536a195.788508 195.788508 0 0 1 21.754279 31.428534c2.968819 7.268488 3.83899 14.844096 6.807809 22.368517a507.156218 507.156218 0 0 0 22.163771 56.305192 191.949517 191.949517 0 0 0 15.867827 25.951574c3.429498 4.606788 9.367136 6.705436 10.6468 14.229858a120.134805 120.134805 0 0 0-9.827816 31.428534 183.145433 183.145433 0 0 0 12.387143 141.377218c6.80781 10.237308 23.136315 33.527182 44.94178 24.620725 19.194952-7.524421 14.997656-31.428534 20.474615-52.415015 1.279663-5.118654 0.409492-8.394592 3.071192-11.721717v0.921357c5.988825 11.82409 12.028836 23.033942 17.556983 34.858033a238.529267 238.529267 0 0 0 55.43502 56.305191c10.237308 7.524421 18.324781 20.474615 31.121416 25.234964v-1.279664h-0.563052a59.58113 59.58113 0 0 0-9.879002-8.394592 217.696346 217.696346 0 0 1-22.368517-25.13259 548.6685 548.6685 0 0 1-47.75704-76.472688c-7.063742-13.257313-12.950194-27.384798-18.580713-40.386178-2.559327-5.118654-2.559327-12.540702-6.80781-15.100029a154.788091 154.788091 0 0 0-20.474615 28.459715 235.458075 235.458075 0 0 0-12.028837 63.420121c-1.689156 0.409492-0.870171 0-1.689155 0.818984-13.666806-3.275938-18.427154-17.14749-23.443435-28.920394a178.845764 178.845764 0 0 1-3.83899-112.047331c2.968819-8.804085 15.765454-36.598375 10.6468-44.992967-2.712887-8.036286-11.107479-12.540702-15.765454-19.092579a152.126391 152.126391 0 0 1-15.355961-26.821746c-10.237308-23.443434-15.355961-49.395009-26.514627-72.940816a218.259398 218.259398 0 0 0-21.344786-32.247519 207.663784 207.663784 0 0 1-23.648181-32.503452c-2.149835-4.606788-5.118654-12.233583-1.689156-17.249863a7.012556 7.012556 0 0 1 5.988825-5.630519c5.630519-4.504415 21.395973 1.33085 26.975306 3.83899a223.122119 223.122119 0 0 1 42.382453 20.935294c5.988825 4.197296 12.438329 12.233583 20.11631 14.229858h8.957644c13.666806 3.020006 29.073954 0.818985 41.870588 4.606788a276.407305 276.407305 0 0 1 61.423845 28.920394 376.57936 376.57936 0 0 1 133.443305 143.629426c5.118654 9.623069 7.319675 18.427154 11.926463 28.459715 8.957644 20.781734 20.065123 41.717028 29.176327 61.730964a270.008988 270.008988 0 0 0 30.711923 56.305192c6.398317 8.804085 32.093959 13.410873 43.61093 18.017662 8.548152 3.787804 21.754279 7.217302 29.432259 11.721717 14.741723 8.855271 29.022767 18.939019 42.894319 28.562088 7.012556 4.760348 28.306155 15.355961 29.585819 23.80174z"
fill="#13748E" p-id="1931"></path>
<path
d="M1414.795909 931.096434h-168.40371v-353.903724h56.663497v310.395166h111.689026z m-357.537968-359.227124q138.203652 0 137.845347 175.723385a216.774988 216.774988 0 0 1-41.461096 144.192477 136.412124 136.412124 0 0 1-16.277319 15.9702l65.006903 31.991587-23.033942 39.77194-84.816093-49.39501a162.824377 162.824377 0 0 1-46.323817 6.295945 126.021256 126.021256 0 0 1-101.349345-39.311262 209.864806 209.864806 0 0 1-36.700748-136.923989 216.979734 216.979734 0 0 1 41.358723-143.680612 130.935164 130.935164 0 0 1 105.495454-44.685847z m-5.784079 43.508558q-81.284222 0-81.284222 133.750423a217.18448 217.18448 0 0 0 21.600719 111.074788 67.668603 67.668603 0 0 0 62.447576 32.401078c54.155357 0 81.284222-45.146526 81.284223-134.9789a216.365496 216.365496 0 0 0-21.600719-110.204617 68.180469 68.180469 0 0 0-62.447577-31.991586z m-165.742009 217.696345a94.080857 94.080857 0 0 1-33.015317 73.964548 129.911433 129.911433 0 0 1-88.655084 28.766834 177.975592 177.975592 0 0 1-100.68392-32.912944l15.355961-30.45599a171.270156 171.270156 0 0 0 76.114382 20.986481 79.953372 79.953372 0 0 0 50.060434-14.076298 48.217719 48.217719 0 0 0 19.194952-39.311261c0-21.14004-14.690536-39.055328-41.461096-54.104171-24.723098-13.666806-74.37404-42.075334-74.37404-42.075334a84.764907 84.764907 0 0 1-40.437364-75.346584 87.682539 87.682539 0 0 1 30.097684-69.357759 113.173435 113.173435 0 0 1 78.05947-26.617 160.725729 160.725729 0 0 1 89.576442 26.258694l-13.666806 30.711923a174.341348 174.341348 0 0 0-68.078096-14.741723 59.683503 59.683503 0 0 0-41.819401 13.206127 43.866863 43.866863 0 0 0-15.9702 33.527182c0 20.986481 14.997656 39.004142 42.638386 54.360104 25.183777 13.820365 75.909636 42.894319 75.909636 42.894318a83.229311 83.229311 0 0 1 41.461096 74.732346z"
fill="#F28D05" p-id="1932"></path>
d="M326.357333 333.781333c-12.501333 0-16.896-11.52-18.602666-15.829333a2749.653333 2749.653333 0 0 0-10.709334-17.834667l1.493334-5.973333-3.669334 2.261333c-14.549333-14.506667-8.746667-25.088-4.138666-30.208a24.192 24.192 0 0 1 18.56-8.021333c5.12 0 10.581333 1.408 15.658666 4.096 16 8.490667 25.130667 21.290667 25.6 35.925333-0.469333 10.666667-1.706667 29.824-18.773333 34.773334a20.181333 20.181333 0 0 1-5.418667 0.810666m559.616 565.12c-7.338667 0-12.8-4.266667-16.682666-7.338666-15.146667-11.264-30.122667-18.816-46.08-26.794667-16.469333-8.32-33.322667-16.725333-48.896-28.330667-17.322667-12.885333-36.821333-29.44-50.176-54.058666-2.176-4.010667-8.789333-16.213333-4.138667-27.946667 4.096-10.410667 14.208-14.677333 21.461333-17.066667 22.442667-7.253333 48.512-14.933333 76.458667-16.042666l-1.749333-1.322667c-32.597333-24.448-61.482667-46.122667-96.896-54.613333-48.256-11.434667-69.376-44.245333-83.669334-74.837334a1563.733333 1563.733333 0 0 1-26.496-60.842666c-18.346667-43.605333-37.12-88.32-63.658666-127.573334-42.88-63.402667-97.834667-112.64-163.413334-146.261333-18.090667-9.301333-42.368-19.968-69.248-19.968h-4.48c-21.76 0-40.32-7.125333-56.96-21.845333-13.696-12.074667-31.445333-18.858667-50.261333-26.069334l-8.533333-3.242666a25.258667 25.258667 0 0 0-9.088-2.133334c-4.053333 2.048-6.101333 4.352 0.298666 14.165334 9.173333 14.037333 19.456 28.586667 31.530667 44.458666 21.589333 28.416 32.938667 60.885333 40.362667 86.058667 10.496 35.584 21.930667 63.914667 43.776 86.570667 20.224 21.034667 9.770667 44.458667 2.901333 59.989333l-5.888 2.730667 3.925333 1.664c-18.688 43.733333-18.56 89.856 0.341334 149.461333 1.536 4.693333 4.096 9.642667 6.4 13.824l0.298666 0.554667c2.56-27.306667 5.717333-57.941333 27.306667-83.712 5.205333-8.277333 11.050667-17.834667 22.869333-17.834667 16.896 1.834667 19.968 15.786667 21.162667 21.12 21.674667 58.282667 53.504 108.885333 81.792 152.021333a13.44 13.44 0 0 1 1.152 12.330667 13.397333 13.397333 0 0 1-9.6 7.893333 37.930667 37.930667 0 0 1-7.296 0.768c-15.786667 0-25.642667-10.026667-54.528-41.728-8.576-9.429333-14.762667-20.394667-20.181333-30.037333l-4.181334-7.296c-0.426667 5.290667-0.981333 9.898667-2.176 14.464-6.570667 25.258667-23.552 40.96-44.245333 40.96-12.842667 0-25.6-6.058667-36.864-17.493333-25.344-25.642667-39.296-58.965333-44.032-104.746667-4.693333-45.653333 0.256-88.832 14.762667-128.512 3.968-10.922667 3.968-16.512-3.925334-26.112-26.282667-32.213333-38.912-71.808-49.578666-109.568-7.125333-25.258667-20.394667-45.738667-38.186667-68.693333-13.226667-16.981333-24.874667-32-30.592-51.754667-5.888-20.096-3.2-39.253333 7.466667-53.802667 10.496-14.293333 27.306667-22.186667 47.36-22.357333 42.496 0 75.946667 21.418667 104.064 41.386667l4.608 3.498666c5.205333 4.053333 7.808 5.845333 10.965333 5.845334 88.448 0 152.490667 50.048 210.517333 101.290666a478.037333 478.037333 0 0 1 129.109334 183.04c11.477333 29.013333 25.429333 57.898667 38.912 85.76 6.485333 13.482667 13.141333 27.221333 19.456 40.874667 3.370667 7.253333 8.192 11.648 16.597333 15.104 68.565333 28.16 123.733333 66.517333 168.618667 117.077333 6.4 7.210667 13.354667 16.853333 10.026666 27.733334-3.669333 11.946667-16.725333 15.146667-25.344 17.237333-11.562667 2.858667-23.466667 4.650667-34.986666 6.4-13.226667 1.962667-26.794667 4.010667-39.936 7.808 5.333333 4.778667 11.648 8.234667 17.322666 11.008 26.026667 12.885333 45.056 32.938667 63.402667 52.266667 5.845333 6.186667 10.24 10.88 14.677333 15.317333 16.725333 16.64 9.301333 28.8 6.570667 32.085333a18.432 18.432 0 0 1-14.506667 7.168"
fill="#1296db" p-id="3762"></path>
</svg>
);
export const OracleSvg = () => (
......
......@@ -49,9 +49,9 @@
}
/* --- list toolbar修改内偏移 --- end */
/* --- prodescription item宽度 --- start */
.ant-descriptions-item-content {
/*.ant-descriptions-item-content {
width: 100%;
}
}*/
/* --- prodescription item宽度 --- end */
/* --- table 宽度 --- start */
.ant-table-wrapper {
......
export type Column = {
name: string,
type: string,
comment: string,
keyFlag: boolean,
keyIdentityFlag: boolean,
fill: string,
isNotNull: string,
javaType: string,
columnFamily: string,
};
import React from "react";
import { Button, Tooltip } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { KeyOutlined,CheckSquareOutlined } from '@ant-design/icons';
import type { ProColumns } from '@ant-design/pro-table';
import ProTable, { TableDropdown } from '@ant-design/pro-table';
import { Column } from "./data";
import { Column } from "../data";
import {getData, queryData} from "@/components/Common/crud";
......@@ -13,19 +13,22 @@ const Columns = (props: any) => {
const {dbId,table,schema} = props;
const columns: ProColumns<Column>[] = [
{
title: '序号',
dataIndex: 'position',
sorter: (a, b) => a.position - b.position,
},
{
title: '列名',
dataIndex: 'name',
render: (_) => <a>{_}</a>,
/*formItemProps: {
lightProps: {
labelFormatter: (value) => `app-${value}`,
},
},*/
// sorter: (a, b) => a.name - b.name,
copyable: true,
},
{
title: '注释',
dataIndex: 'comment',
// ellipsis: true,
},
{
title: '类型',
......@@ -34,15 +37,42 @@ const Columns = (props: any) => {
{
title: '主键',
dataIndex: 'keyFlag',
render: (_, record) => (
<>
{record.keyFlag?<KeyOutlined style={{ color:'#FAA100'}} />:undefined}
</>
),
},{
title: '自增',
dataIndex: 'keyIdentityFlag',
dataIndex: 'autoIncrement',
render: (_, record) => (
<>
{record.autoIncrement?<CheckSquareOutlined style={{ color:'#1296db'}} />:undefined}
</>
),
},{
title: '非空',
dataIndex: 'nullable',
render: (_, record) => (
<>
{!record.nullable?<CheckSquareOutlined style={{ color:'#1296db'}} />:undefined}
</>
),
},{
title: '默认值',
dataIndex: 'fill',
dataIndex: 'defaultValue',
},{
title: '非空',
dataIndex: 'isNotNull',
title: '精度',
dataIndex: 'precision',
},{
title: '小数范围',
dataIndex: 'scale',
},{
title: '字符集',
dataIndex: 'characterSet',
},{
title: '排序规则',
dataIndex: 'collation',
},{
title: 'Java 类型',
dataIndex: 'javaType',
......@@ -92,15 +122,15 @@ const Columns = (props: any) => {
data: msg.datas,
success: msg.code===0,
};
}
}
}}
rowKey="name"
pagination={{
pageSize: 10,
}}
search={{
/*search={{
filterType: 'light',
}}
}}*/
search={false}
/*toolBarRender={() => [
<Button key="show">查看日志</Button>,
<Button type="primary" key="primary">
......
import { Descriptions, Badge } from 'antd';
const Tables = (props: any) => {
const {table} = props;
return (<Descriptions bordered>
<Descriptions.Item label="Name">{table.name}</Descriptions.Item>
<Descriptions.Item label="Schema">{table.schema}</Descriptions.Item>
<Descriptions.Item label="Catalog">{table.catalog}</Descriptions.Item>
<Descriptions.Item label="Rows">{table.rows}</Descriptions.Item>
<Descriptions.Item label="Type">{table.type}</Descriptions.Item>
<Descriptions.Item label="Engine">{table.engine}</Descriptions.Item>
<Descriptions.Item label="Options" span={3}>
{table.options}
</Descriptions.Item>
<Descriptions.Item label="Status"><Badge status="processing" text="Running" /></Descriptions.Item>
<Descriptions.Item label="CreateTime">{table.createTime}</Descriptions.Item>
<Descriptions.Item label="UpdateTime">{table.updateTime}</Descriptions.Item>
<Descriptions.Item label="Comment" span={3}>{table.comment}</Descriptions.Item>
</Descriptions>)
};
export default Tables;
......@@ -17,7 +17,6 @@ export type DataBaseItem = {
updateTime: Date,
};
export type DataBaseFormProps = {
name: string,
alias: string,
......@@ -32,3 +31,33 @@ export type DataBaseFormProps = {
dbVersion: string,
enabled: boolean,
}
export type Column = {
name: string,
type: string,
comment: string,
keyFlag: boolean,
autoIncrement: boolean,
defaultValue: string,
nullable: string,
javaType: string,
columnFamily: string,
position: number,
precision: number,
scale: number,
characterSet: string,
collation: string,
};
export type Table = {
name: string,
schema: string,
catalog: string,
comment: string,
type: string,
engine: string,
options: string,
rows: number,
createTime: string,
updateTime: string,
};
......@@ -515,7 +515,7 @@ export default (): React.ReactNode => {
<Link>新增 Mysql,Oracle,PostGreSql,ClickHouse,Doris,Java 方言及图标</Link>
</li>
<li>
<Link>新增 元数据查看信息</Link>
<Link>新增 元数据查看表和字段信息</Link>
</li>
</ul>
</Paragraph>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment