获取数据库名:

<select id="getDataBaseName" resultType="java.lang.String">
select database()
</select>

获取表:

<select id="getTables" resultType="java.util.HashMap">
select
table_name tableName,
table_comment description
from information_schema.tables
where table_schema = #{dbName}
</select>

获取列:

<select id="getColumns" resultType="java.util.HashMap">
select column_name columnName,column_comment description
from information_schema.columns
where table_schema=#{dbName} and table_name= #{tableName}
</select>

获取外键:

<select id="getForeign" resultType="org.jeecg.modules.gz.flowable.vo.ForeignVo">
select column_name,referenced_table_name,referenced_column_name
from information_schema.key_column_usage
where constraint_schema=#{dbName} and table_name=#{tableName} and referenced_column_name !='null'
</select>