All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mybatis.mappers.MysqlDataBaseMapper.xml Maven / Gradle / Ivy

There is a newer version: 1.5.1
Show newest version
<?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.github.zhuyizhuo.generator.mybatis.database.mapper.MysqlDataBaseMapper">

    <select id="getTableNameListBySchema" resultType="dbTableInfo" parameterType="dataBaseInfo">
        SELECT
        upper(TABLE_SCHEMA) as tableSchema,
        upper(TABLE_NAME) as tableName,
        upper(TABLE_COMMENT) as tableComment
         FROM
            INFORMATION_SCHEMA.TABLES
        WHERE 1 = 1
        <if test="tableSchema != null and '' != tableSchema">
          AND TABLE_SCHEMA = #{tableSchema}
        </if>
        <if test="tableNames != null">
            AND TABLE_NAME IN
            <foreach collection="tableNames" index="index" item="tableName" open="(" separator="," close=")">
                #{tableName}
            </foreach>
        </if>
    </select>

    <select id="getColumnListByTableName" resultType="columnInfo" parameterType="dbTableInfo">
        SELECT
        upper(COLUMN_NAME) columnName,
        upper(COLUMN_COMMENT) columnComment,
        upper(DATA_TYPE) dataType
        FROM
          INFORMATION_SCHEMA.COLUMNS
        WHERE 1 = 1
        <if test="tableSchema != null and '' != tableSchema">
            AND TABLE_SCHEMA = #{tableSchema}
        </if>
        <if test="tableName != null and '' != tableName">
            AND TABLE_NAME = #{tableName}
        </if>
    </select>

</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy