说明
- 一款国产的代码生成插件,使用文档:https://gitee.com/makejava/EasyCode/wikis/pages
-
MySQL优化建议:优先选择符合需求的最小数据类型,比如:非负数就使用UNSIGNED、存储IP地址使用INT UNSIGNED - 在使用
EasyCode生成entity对象时,根据MySQL的优化建议需要做类型映射
使用
- 在
idea中安装插件Easy Code -
Easy Code路径:Preferences | Other Settings | Easy Code(不同idea版本会有所不同) - 在
Type Mapper中添加类型映射:
| columnType | javaType |
|---|---|
| tinyint((\d+))? | java.lang.Byte |
| tinyint((\d+))? unsigned | java.lang.Short |
| smallint((\d+))? | java.lang.Short |
| smallint((\d+))? unsigned | java.lang.Integer |
| mediumint((\d+))? | java.lang.Integer |
| mediumint((\d+))? unsigned | java.lang.Integer |
| int((\d+))? unsigned | java.lang.Long |
| bigint((\d+))? unsigned | java.math.BigInteger |
- 在
Template Setting中配置模板代码 - 在
idea的右边栏Database中右击数据库表选择EasyCode | Generate Code生成代码








网友评论