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,8 +29,10 @@ public class GenConstants | ||
| 29 | public static final String PARENT_MENU_NAME = "parentMenuName"; | 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 | public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" }; | 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,13 +40,14 @@ public class GenUtils | ||
| 40 | column.setCreateBy(table.getCreateBy()); | 40 | column.setCreateBy(table.getCreateBy()); |
| 41 | // 设置java字段名 | 41 | // 设置java字段名 |
| 42 | column.setJavaField(StringUtils.toCamelCase(columnName)); | 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 | // 字符串长度超过500设置为文本域 | 48 | // 字符串长度超过500设置为文本域 |
| 48 | Integer columnLength = getColumnLength(column.getColumnType()); | 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 | column.setHtmlType(htmlType); | 51 | column.setHtmlType(htmlType); |
| 51 | } | 52 | } |
| 52 | else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) | 53 | else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) |
ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
| @@ -131,7 +131,7 @@ | @@ -131,7 +131,7 @@ | ||
| 131 | <if test="parentId != null">parent_id = #{parentId},</if> | 131 | <if test="parentId != null">parent_id = #{parentId},</if> |
| 132 | <if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if> | 132 | <if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if> |
| 133 | <if test="path != null and path != ''">path = #{path},</if> | 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 | <if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if> | 135 | <if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if> |
| 136 | <if test="isCache != null and isCache != ''">is_cache = #{isCache},</if> | 136 | <if test="isCache != null and isCache != ''">is_cache = #{isCache},</if> |
| 137 | <if test="menuType != null and menuType != ''">menu_type = #{menuType},</if> | 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,8 +141,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||
| 141 | <if test="deptId != null and deptId != 0">dept_id = #{deptId},</if> | 141 | <if test="deptId != null and deptId != 0">dept_id = #{deptId},</if> |
| 142 | <if test="userName != null and userName != ''">user_name = #{userName},</if> | 142 | <if test="userName != null and userName != ''">user_name = #{userName},</if> |
| 143 | <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if> | 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 | <if test="sex != null and sex != ''">sex = #{sex},</if> | 146 | <if test="sex != null and sex != ''">sex = #{sex},</if> |
| 147 | <if test="avatar != null and avatar != ''">avatar = #{avatar},</if> | 147 | <if test="avatar != null and avatar != ''">avatar = #{avatar},</if> |
| 148 | <if test="password != null and password != ''">password = #{password},</if> | 148 | <if test="password != null and password != ''">password = #{password},</if> |