Commit 0e338839d79dcfd6d6c9958f9fe053693703e090
Merge branch 'master' of https://gitee.com/y_project/RuoYi-Vue
Showing
4 changed files
with
11 additions
and
8 deletions
ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java
| ... | ... | @@ -29,8 +29,10 @@ public class GenConstants |
| 29 | 29 | public static final String PARENT_MENU_NAME = "parentMenuName"; |
| 30 | 30 | |
| 31 | 31 | /** 数据库字符串类型 */ |
| 32 | - public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2", "tinytext", "text", | |
| 33 | - "mediumtext", "longtext" }; | |
| 32 | + public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" }; | |
| 33 | + | |
| 34 | + /** 数据库文本类型 */ | |
| 35 | + public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" }; | |
| 34 | 36 | |
| 35 | 37 | /** 数据库时间类型 */ |
| 36 | 38 | public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" }; | ... | ... |
ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java
| ... | ... | @@ -40,13 +40,14 @@ public class GenUtils |
| 40 | 40 | column.setCreateBy(table.getCreateBy()); |
| 41 | 41 | // 设置java字段名 |
| 42 | 42 | column.setJavaField(StringUtils.toCamelCase(columnName)); |
| 43 | + // 设置默认类型 | |
| 44 | + column.setJavaType(GenConstants.TYPE_STRING); | |
| 43 | 45 | |
| 44 | - if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType)) | |
| 46 | + if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) | |
| 45 | 47 | { |
| 46 | - column.setJavaType(GenConstants.TYPE_STRING); | |
| 47 | 48 | // 字符串长度超过500设置为文本域 |
| 48 | 49 | Integer columnLength = getColumnLength(column.getColumnType()); |
| 49 | - String htmlType = columnLength >= 500 ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT; | |
| 50 | + String htmlType = columnLength >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT; | |
| 50 | 51 | column.setHtmlType(htmlType); |
| 51 | 52 | } |
| 52 | 53 | else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) | ... | ... |
ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
| ... | ... | @@ -131,7 +131,7 @@ |
| 131 | 131 | <if test="parentId != null">parent_id = #{parentId},</if> |
| 132 | 132 | <if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if> |
| 133 | 133 | <if test="path != null and path != ''">path = #{path},</if> |
| 134 | - <if test="component != null and component != ''">component = #{component},</if> | |
| 134 | + <if test="component != null">component = #{component},</if> | |
| 135 | 135 | <if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if> |
| 136 | 136 | <if test="isCache != null and isCache != ''">is_cache = #{isCache},</if> |
| 137 | 137 | <if test="menuType != null and menuType != ''">menu_type = #{menuType},</if> | ... | ... |
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
| ... | ... | @@ -141,8 +141,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 141 | 141 | <if test="deptId != null and deptId != 0">dept_id = #{deptId},</if> |
| 142 | 142 | <if test="userName != null and userName != ''">user_name = #{userName},</if> |
| 143 | 143 | <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if> |
| 144 | - <if test="email != null and email != ''">email = #{email},</if> | |
| 145 | - <if test="phonenumber != null and phonenumber != ''">phonenumber = #{phonenumber},</if> | |
| 144 | + <if test="email != null ">email = #{email},</if> | |
| 145 | + <if test="phonenumber != null ">phonenumber = #{phonenumber},</if> | |
| 146 | 146 | <if test="sex != null and sex != ''">sex = #{sex},</if> |
| 147 | 147 | <if test="avatar != null and avatar != ''">avatar = #{avatar},</if> |
| 148 | 148 | <if test="password != null and password != ''">password = #{password},</if> | ... | ... |