<?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.iotechn.unimall.data.mapper.tools.gen.GenTableColumnMapper">

<!--	<resultMap type="GenTableColumn" id="GenTableColumnResult">-->
<!--		<id property="columnId" column="column_id" />-->
<!--		<result property="tableId" column="table_id" />-->
<!--		<result property="columnName" column="column_name" />-->
<!--		<result property="columnComment" column="column_comment" />-->
<!--		<result property="columnType" column="column_type" />-->
<!--		<result property="javaType" column="java_type" />-->
<!--		<result property="javaField" column="java_field" />-->
<!--		<result property="isPk" column="is_pk" />-->
<!--		<result property="isIncrement" column="is_increment" />-->
<!--		<result property="isRequired" column="is_required" />-->
<!--		<result property="isInsert" column="is_insert" />-->
<!--		<result property="isEdit" column="is_edit" />-->
<!--		<result property="isList" column="is_list" />-->
<!--		<result property="isQuery" column="is_query" />-->
<!--		<result property="queryType" column="query_type" />-->
<!--		<result property="htmlType" column="html_type" />-->
<!--		<result property="dictType" column="dict_type" />-->
<!--		<result property="sort" column="sort" />-->
<!--		<result property="createBy" column="create_by" />-->
<!--		<result property="createTime" column="create_time" />-->
<!--		<result property="updateBy" column="update_by" />-->
<!--		<result property="updateTime" column="update_time" />-->
<!--	</resultMap>-->
	<sql id="selectDictTypeVo">
		SELECT
		table_id AS tableId,
		`table_name` AS tableName,
		table_comment AS tableComment,
		class_name AS className,
		tpl_category AS tplCategory,
		package_name AS packageName,
		module_name AS moduleName,
		business_name AS businessName,
		function_name AS functionName,
		function_author AS functionAuthor,
		create_by AS createBy,
		create_time AS createTime,
		update_by AS updateBy,
		update_time AS updateTime,
		`options`
		FROM
		sys_gen_table
	</sql>
	<select id="selectDbTableColumnsByName" parameterType="String" resultType="com.iotechn.unimall.data.domain.tools.gen.GenTableColumn">
		select column_name as columnName, (case when (is_nullable = 'no' <![CDATA[ && ]]>
		column_key != 'PRI') then '1' else null end) as isRequired, (case
		when column_key = 'PRI' then '1' else '0' end) as isPk,
		ordinal_position as sort, column_comment as columnComment, (case when extra =
		'auto_increment' then '1' else '0' end) as isIncrement, column_type as columnType
		from information_schema.columns where table_schema = (select
		database()) and table_name = (#{tableName})
		order by ordinal_position
	</select>

</mapper>