提交者
Gitee
!682 解决表字段comment过长问题
Merge pull request !682 from baozhigang/column-comment
正在显示
1 个修改的文件
包含
11 行增加
和
11 行删除
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 3 | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | 3 | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 4 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 4 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 5 | <mapper namespace="com.ruoyi.generator.mapper.GenTableColumnMapper"> | 5 | <mapper namespace="com.ruoyi.generator.mapper.GenTableColumnMapper"> |
| 6 | - | 6 | + |
| 7 | <resultMap type="GenTableColumn" id="GenTableColumnResult"> | 7 | <resultMap type="GenTableColumn" id="GenTableColumnResult"> |
| 8 | <id property="columnId" column="column_id" /> | 8 | <id property="columnId" column="column_id" /> |
| 9 | <result property="tableId" column="table_id" /> | 9 | <result property="tableId" column="table_id" /> |
| @@ -28,23 +28,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -28,23 +28,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 28 | <result property="updateBy" column="update_by" /> | 28 | <result property="updateBy" column="update_by" /> |
| 29 | <result property="updateTime" column="update_time" /> | 29 | <result property="updateTime" column="update_time" /> |
| 30 | </resultMap> | 30 | </resultMap> |
| 31 | - | 31 | + |
| 32 | <sql id="selectGenTableColumnVo"> | 32 | <sql id="selectGenTableColumnVo"> |
| 33 | select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column | 33 | select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column |
| 34 | </sql> | 34 | </sql> |
| 35 | - | 35 | + |
| 36 | <select id="selectGenTableColumnListByTableId" parameterType="Long" resultMap="GenTableColumnResult"> | 36 | <select id="selectGenTableColumnListByTableId" parameterType="Long" resultMap="GenTableColumnResult"> |
| 37 | <include refid="selectGenTableColumnVo"/> | 37 | <include refid="selectGenTableColumnVo"/> |
| 38 | where table_id = #{tableId} | 38 | where table_id = #{tableId} |
| 39 | order by sort | 39 | order by sort |
| 40 | </select> | 40 | </select> |
| 41 | - | 41 | + |
| 42 | <select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult"> | 42 | <select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult"> |
| 43 | 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, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type | 43 | 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, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type |
| 44 | from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName}) | 44 | from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName}) |
| 45 | order by ordinal_position | 45 | order by ordinal_position |
| 46 | </select> | 46 | </select> |
| 47 | - | 47 | + |
| 48 | <insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId"> | 48 | <insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId"> |
| 49 | insert into gen_table_column ( | 49 | insert into gen_table_column ( |
| 50 | <if test="tableId != null and tableId != ''">table_id,</if> | 50 | <if test="tableId != null and tableId != ''">table_id,</if> |
| @@ -69,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -69,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 69 | )values( | 69 | )values( |
| 70 | <if test="tableId != null and tableId != ''">#{tableId},</if> | 70 | <if test="tableId != null and tableId != ''">#{tableId},</if> |
| 71 | <if test="columnName != null and columnName != ''">#{columnName},</if> | 71 | <if test="columnName != null and columnName != ''">#{columnName},</if> |
| 72 | - <if test="columnComment != null and columnComment != ''">#{columnComment},</if> | 72 | + <if test="columnComment != null and columnComment != ''">(select SUBSTRING_INDEX(#{columnComment}, ' ', 1)),</if> |
| 73 | <if test="columnType != null and columnType != ''">#{columnType},</if> | 73 | <if test="columnType != null and columnType != ''">#{columnType},</if> |
| 74 | <if test="javaType != null and javaType != ''">#{javaType},</if> | 74 | <if test="javaType != null and javaType != ''">#{javaType},</if> |
| 75 | <if test="javaField != null and javaField != ''">#{javaField},</if> | 75 | <if test="javaField != null and javaField != ''">#{javaField},</if> |
| @@ -88,11 +88,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -88,11 +88,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 88 | sysdate() | 88 | sysdate() |
| 89 | ) | 89 | ) |
| 90 | </insert> | 90 | </insert> |
| 91 | - | 91 | + |
| 92 | <update id="updateGenTableColumn" parameterType="GenTableColumn"> | 92 | <update id="updateGenTableColumn" parameterType="GenTableColumn"> |
| 93 | update gen_table_column | 93 | update gen_table_column |
| 94 | <set> | 94 | <set> |
| 95 | - <if test="columnComment != null">column_comment = #{columnComment},</if> | 95 | + <if test="columnComment != null">column_comment = (select SUBSTRING_INDEX(#{columnComment}, ' ', 1)),</if> |
| 96 | <if test="javaType != null">java_type = #{javaType},</if> | 96 | <if test="javaType != null">java_type = #{javaType},</if> |
| 97 | <if test="javaField != null">java_field = #{javaField},</if> | 97 | <if test="javaField != null">java_field = #{javaField},</if> |
| 98 | <if test="isInsert != null">is_insert = #{isInsert},</if> | 98 | <if test="isInsert != null">is_insert = #{isInsert},</if> |
| @@ -111,14 +111,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | @@ -111,14 +111,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 111 | </update> | 111 | </update> |
| 112 | 112 | ||
| 113 | <delete id="deleteGenTableColumnByIds" parameterType="Long"> | 113 | <delete id="deleteGenTableColumnByIds" parameterType="Long"> |
| 114 | - delete from gen_table_column where table_id in | 114 | + delete from gen_table_column where table_id in |
| 115 | <foreach collection="array" item="tableId" open="(" separator="," close=")"> | 115 | <foreach collection="array" item="tableId" open="(" separator="," close=")"> |
| 116 | #{tableId} | 116 | #{tableId} |
| 117 | </foreach> | 117 | </foreach> |
| 118 | </delete> | 118 | </delete> |
| 119 | - | 119 | + |
| 120 | <delete id="deleteGenTableColumns"> | 120 | <delete id="deleteGenTableColumns"> |
| 121 | - delete from gen_table_column where column_id in | 121 | + delete from gen_table_column where column_id in |
| 122 | <foreach collection="list" item="item" open="(" separator="," close=")"> | 122 | <foreach collection="list" item="item" open="(" separator="," close=")"> |
| 123 | #{item.columnId} | 123 | #{item.columnId} |
| 124 | </foreach> | 124 | </foreach> |
-
请 注册 或 登录 后发表评论