23 lines
1.2 KiB
XML
23 lines
1.2 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.qiaoba.module.generator.mapper.GeneratorTableColumnMapper">
|
||
|
|
||
|
<resultMap type="com.qiaoba.module.generator.entity.vo.TableColumnVo" id="DbTableColumnVoResult">
|
||
|
<result property="columnName" column="column_name"/>
|
||
|
<result property="columnComment" column="column_comment"/>
|
||
|
<result property="columnType" column="column_type"/>
|
||
|
<result property="isRequired" column="is_required"/>
|
||
|
<result property="isPk" column="is_pk"/>
|
||
|
<result property="sort" column="sort"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<select id="selectListByTableName" resultMap="DbTableColumnVoResult">
|
||
|
select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, column_type
|
||
|
from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
|
||
|
order by ordinal_position
|
||
|
</select>
|
||
|
|
||
|
</mapper>
|