| | |
| | | </resultMap> |
| | | |
| | | <select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult"> |
| | | <if test="@org.ruoyi.common.mybatis.helper.DataBaseHelper@isMySql()"> |
| | | <if test="@org.ruoyi.helper.DataBaseHelper@isMySql()"> |
| | | 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, |
| | |
| | | from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName}) |
| | | order by ordinal_position |
| | | </if> |
| | | <if test="@org.ruoyi.common.mybatis.helper.DataBaseHelper@isOracle()"> |
| | | <if test="@org.ruoyi.helper.DataBaseHelper@isOracle()"> |
| | | select lower(temp.column_name) as column_name, |
| | | (case when (temp.nullable = 'N' and temp.constraint_type != 'P') then '1' else null end) as is_required, |
| | | (case when temp.constraint_type = 'P' then '1' else '0' end) as is_pk, |
| | |
| | | WHERE temp.row_flg = 1 |
| | | ORDER BY temp.column_id |
| | | </if> |
| | | <if test="@org.ruoyi.common.mybatis.helper.DataBaseHelper@isPostgerSql()"> |
| | | <if test="@org.ruoyi.helper.DataBaseHelper@isPostgerSql()"> |
| | | SELECT column_name, is_required, is_pk, sort, column_comment, is_increment, column_type |
| | | FROM ( |
| | | SELECT c.relname AS table_name, |
| | |
| | | WHERE table_name = (#{tableName}) |
| | | AND column_type <![CDATA[ <> ]]> '-' |
| | | </if> |
| | | <if test="@org.ruoyi.common.mybatis.helper.DataBaseHelper@isSqlServer()"> |
| | | <if test="@org.ruoyi.helper.DataBaseHelper@isSqlServer()"> |
| | | SELECT |
| | | cast(A.NAME as nvarchar) as column_name, |
| | | cast(B.NAME as nvarchar) + (case when B.NAME = 'numeric' then '(' + cast(A.prec as nvarchar) + ',' + cast(A.scale as nvarchar) + ')' else '' end) as column_type, |