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

mappings.TableInfoMapper.xml Maven / Gradle / Ivy

The 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.seezoon.code.gen.dao.TableInfoDao" >
  <select id="findTable" parameterType="String" resultType="com.seezoon.code.gen.dto.DbTable">
  	select table_name name, table_comment comment from information_schema.tables 
			where table_schema = (select database()) 
			and table_name = upper(#{tableName})
		order by create_time desc
  </select>
  <select id="findPkType" parameterType="String" resultType="com.seezoon.code.gen.dto.DbPk">
  select
	t.data_type dataType,t.column_name columnName
	from
	information_schema.`columns` t 
	where table_name = upper(#{tableName}) and t.table_schema = (select database()) and t.column_key = 'PRI'
	order by t.ordinal_position asc 
  </select>
  <select id="findColumnByTableName" parameterType="String" resultType="com.seezoon.code.gen.dto.DbTableColumn">
	select
	lower(t.column_name) name,
	if(t.is_nullable = 'yes' , '1' , '0') nullable,
	(t.ordinal_position * 10) sort ,
	t.column_comment comment ,
	t.data_type dataType ,
	t.character_maximum_length maxlength,
	t.column_type columnType,
	t.column_key columnKey,
	t.extra extra
	from
	information_schema.`columns` t 
	where table_name = upper(#{tableName}) and t.table_schema = (select database())
	order by t.ordinal_position asc
  </select>

</mapper>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy