<?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.ly.boilingwater.modules.gen.dao.SysTableDao">
<sql id="selectSql">
SELECT a.table_name as table_name,
a.table_comment as table_comment,
b.COLUMN_NAME as COLUMN_NAME,
b.column_comment as column_comment,
b.column_type as column_type,
b.column_key as column_key
FROM information_schema.TABLES a
LEFT JOIN information_schema.COLUMNS b ON a.table_name = b.TABLE_NAME
WHERE a.table_schema = 'boiling_water'
<if test="tableName != null and tableName.trim() != ''">
and a.table_name = #{tableName}
</if>
ORDER BY a.table_name;
</sql>
<select id="queryALl" resultMap="tableResult">
<include refid="selectSql"></include>
</select>
<resultMap id="tableResult" type="com.ly.boilingwater.modules.gen.entity.SysTableEntity">
<result property="tableName" column="table_name"/>
<result property="tableComment" column="table_comment"/>
<collection property="sysColumnEntityList" ofType="com.ly.boilingwater.modules.gen.entity.SysColumnEntity">
<result property="columnName" column="COLUMN_NAME"/>
<result property="columnComment" column="column_comment"/>
<result property="columnType" column="column_type"/>
<result property="columnKey" column="column_key"/>
</collection>
</resultMap>
</mapper>
Mybatis一对多映射
最新推荐文章于 2025-05-05 16:33:22 发布