127 lines
5.6 KiB
XML
127 lines
5.6 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.xiaomayi.generator.mapper.GeneratorMapper">
|
|
|
|
<!-- 1、获取数据库表(MySQL版本) -->
|
|
<select id="getTableList" resultType="com.xiaomayi.generator.vo.generator.DbTableListVO">
|
|
SELECT
|
|
table_name,
|
|
table_comment,
|
|
ENGINE,
|
|
table_rows,
|
|
data_length,
|
|
auto_increment,
|
|
table_collation,
|
|
create_time,
|
|
update_time
|
|
FROM
|
|
information_schema.tables
|
|
WHERE
|
|
table_schema = (
|
|
SELECT DATABASE
|
|
())
|
|
AND table_name NOT LIKE 'gen_%'
|
|
AND table_name NOT LIKE 'qrtz_%'
|
|
AND table_name NOT LIKE 'oauth2_%'
|
|
AND table_name NOT LIKE 'undo_%'
|
|
<if test="param.tableName != null and param.tableName != ''">
|
|
AND lower(table_name) like lower(concat('%', #{param.tableName}, '%'))
|
|
</if>
|
|
<if test="param.tableComment != null and param.tableComment != ''">
|
|
AND lower(table_comment) like lower(concat('%', #{param.tableComment}, '%'))
|
|
</if>
|
|
</select>
|
|
|
|
<!-- <!– 2、获取数据库表(PostgreSQL版本) –>-->
|
|
<!-- <select id="getTableList" resultType="com.xiaomayi.generator.vo.generator.DbTableListVO">-->
|
|
<!-- SELECT C-->
|
|
<!-- .relname AS TABLE_NAME,-- 表名称-->
|
|
<!-- obj_description ( C.OID, 'pg_class' ) AS table_comment,-- 表描述-->
|
|
<!-- st.n_live_tup AS table_rows,-- 行数-->
|
|
<!-- pg_size_pretty ( pg_total_relation_size ( C.OID ) ) AS data_length -- 表总大小-->
|
|
|
|
<!-- FROM-->
|
|
<!-- pg_class-->
|
|
<!-- C LEFT JOIN pg_namespace n ON n.OID = C.relnamespace-->
|
|
<!-- LEFT JOIN pg_stat_user_tables st ON st.relid = C.OID-->
|
|
<!-- WHERE-->
|
|
<!-- C.relkind = 'r' -- 只选择普通表-->
|
|
|
|
<!-- AND n.nspname NOT IN ( 'pg_catalog', 'information_schema' ) -- 排除系统表-->
|
|
|
|
<!-- AND C.relname NOT LIKE'gen_%'-->
|
|
<!-- AND C.relname NOT LIKE'qrtz_%'-->
|
|
<!-- AND C.relname NOT LIKE'oauth2_%'-->
|
|
<!-- AND C.relname NOT LIKE'undo_%'-->
|
|
<!-- <if test="param.tableName != null and param.tableName != ''">-->
|
|
<!-- AND lower(table_name) like lower(concat('%', #{param.tableName}, '%'))-->
|
|
<!-- </if>-->
|
|
<!-- <if test="param.tableComment != null and param.tableComment != ''">-->
|
|
<!-- AND lower(table_comment) like lower(concat('%', #{param.tableComment}, '%'))-->
|
|
<!-- </if>-->
|
|
<!-- </select>-->
|
|
|
|
<!-- <!– 3、获取数据库表(SqlServer版本) –>-->
|
|
<!-- <select id="getTableList" resultType="com.xiaomayi.generator.vo.generator.DbTableListVO">-->
|
|
<!-- SELECT-->
|
|
<!-- t.name AS table_name,-->
|
|
<!-- ep.value AS table_comment,-->
|
|
<!-- s.name AS ENGINE,-->
|
|
<!-- p.rows AS table_rows,-->
|
|
<!-- SUM(a.total_pages) * 8 AS data_length,-->
|
|
<!-- t.create_date AS create_time,-->
|
|
<!-- t.modify_date AS update_time-->
|
|
<!-- FROM-->
|
|
<!-- sys.tables t-->
|
|
<!-- INNER JOIN-->
|
|
<!-- sys.indexes i ON t.object_id = i.object_id-->
|
|
<!-- INNER JOIN-->
|
|
<!-- sys.partitions p ON i.object_id = p.object_id AND i.index_id = p.index_id-->
|
|
<!-- INNER JOIN-->
|
|
<!-- sys.allocation_units a ON p.partition_id = a.container_id-->
|
|
<!-- LEFT JOIN-->
|
|
<!-- sys.extended_properties ep ON t.object_id = ep.major_id AND ep.minor_id = 0 AND ep.name = 'MS_Description'-->
|
|
<!-- INNER JOIN-->
|
|
<!-- sys.schemas s ON t.schema_id = s.schema_id-->
|
|
<!-- WHERE-->
|
|
<!-- i.index_id <= 1-->
|
|
<!-- AND t.name NOT LIKE 'gen_%'-->
|
|
<!-- AND t.name NOT LIKE 'qrtz_%'-->
|
|
<!-- AND t.name NOT LIKE 'oauth2_%'-->
|
|
<!-- AND t.name NOT LIKE 'undo_%'-->
|
|
<!-- <if test="param.tableName != null and param.tableName != ''">-->
|
|
<!-- AND lower(t.name) like lower(concat('%', #{param.tableName}, '%'))-->
|
|
<!-- </if>-->
|
|
<!-- <if test="param.tableComment != null and param.tableComment != ''">-->
|
|
<!-- AND lower(t.name) like lower(concat('%', #{param.tableComment}, '%'))-->
|
|
<!-- </if>-->
|
|
<!-- GROUP BY-->
|
|
<!-- t.name, s.name, p.rows, t.create_date, t.modify_date, ep.value-->
|
|
<!-- ORDER BY-->
|
|
<!-- t.name;-->
|
|
<!-- </select>-->
|
|
|
|
<!-- 4、获取数据库表(Sqlite版本)
|
|
特别说明:由于Sqlite特性以及参数不完整,此处仅用于展示,如需使用代码生成器功能请使用MySQL、PostgreSQL、SqlServer等其他数据库
|
|
-->
|
|
<!-- <select id="getTableList" resultType="com.xiaomayi.generator.vo.generator.DbTableListVO">-->
|
|
<!-- SELECT-->
|
|
<!-- name AS table_name-->
|
|
<!-- FROM-->
|
|
<!-- sqlite_master-->
|
|
<!-- WHERE-->
|
|
<!-- type = 'table'-->
|
|
<!-- AND name NOT LIKE 'sqlite_%'-->
|
|
<!-- AND name NOT LIKE 'gen_%'-->
|
|
<!-- AND name NOT LIKE 'qrtz_%'-->
|
|
<!-- AND name NOT LIKE 'oauth2_%'-->
|
|
<!-- AND name NOT LIKE 'undo_%'-->
|
|
<!-- <if test="param.tableName != null and param.tableName != ''">-->
|
|
<!-- AND lower(name) like lower(concat('%', #{param.tableName}, '%'))-->
|
|
<!-- </if>-->
|
|
<!-- <if test="param.tableComment != null and param.tableComment != ''">-->
|
|
<!-- AND lower(name) like lower(concat('%', #{param.tableComment}, '%'))-->
|
|
<!-- </if>-->
|
|
<!-- </select>-->
|
|
|
|
</mapper> |