RuoYi/src/main/resources/mybatis/tool/GenMapper.xml

41 lines
1.8 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.ruoyi.project.tool.gen.mapper.GenMapper">
<resultMap type="TableInfo" id="TableInfoResult">
<id property="tableName" column="table_name" />
<result property="tableComment" column="table_comment" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<resultMap type="ColumnInfo" id="ColumnInfoResult">
<id property="columnName" column="column_name" />
<result property="dataType" column="data_type" />
<result property="columnComment" column="column_comment" />
</resultMap>
<select id="selectTableList" parameterType="TableInfo" resultMap="TableInfoResult">
select table_name, table_comment, create_time, update_time
from information_schema.tables
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
<if test="searchValue != null and searchValue != ''">
AND table_name like concat(concat('%', #{searchValue}), '%');
</if>
</select>
<select id="selectTableByName" parameterType="String" resultMap="TableInfoResult">
select table_name, table_comment, create_time, update_time
from information_schema.tables
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
and table_name = #{tableName}
</select>
<select id="selectTableColumnsByName" parameterType="String" resultMap="ColumnInfoResult">
select column_name, data_type, column_comment from information_schema.columns
where table_name = #{tableName} and table_schema = (select database()) order by ordinal_position
</select>
</mapper>