EntityGenerateDao.xml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.inkasso.factoring.code.dao.EntityGenerateDao">
  4. <!-- 获取数据源 -->
  5. <select id="getDataSources" resultType="java.lang.String">
  6. show databases
  7. </select>
  8. <!-- 根据数据源获取所有的表 -->
  9. <select id="getTablesByDataSource" resultType="java.lang.String">
  10. select
  11. table_name tableName
  12. from
  13. information_schema.TABLES
  14. where
  15. table_schema = #{dataSource}
  16. </select>
  17. <!-- 根据数据源获取所有的表 -->
  18. <select id="getColumnsByTableAndDataSource" resultType="com.inkasso.factoring.code.domain.TableColumn">
  19. SELECT
  20. column_name columnName,
  21. data_type dataType,
  22. (CASE is_nullable WHEN 'NO' THEN TRUE ELSE FALSE END) required,
  23. CHARACTER_MAXIMUM_LENGTH length,
  24. column_comment label
  25. FROM
  26. information_schema.COLUMNS
  27. WHERE
  28. table_name = #{tableName}
  29. AND table_schema = #{dataSource}
  30. ORDER BY
  31. ordinal_position
  32. </select>
  33. </mapper>