查表信息
SELECT
TABLE_NAME AS tableName,
TABLE_COMMENT AS tableComment
FROM
INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = (SELECT DATABASE())
AND TABLE_NAME = #{tableName}
查表结构
SELECT
COLUMNS.COLUMN_NAME AS fieldName,
COLUMNS.COLUMN_COMMENT AS fieldComment
FROM
information_schema.COLUMNS
WHERE
table_schema =(SELECT DATABASE())
AND table_name = #{tableName}
AND COLUMNS.COLUMN_NAME not in ('id', 'version', 'del_flag')
ORDER BY
COLUMNS.COLUMN_NAME
网友评论