This plugin helps you to generate specific template code by create table statement or database .
Preferences -> Plugins -> Browse repositories -> [search] CodeGen
shift + command + g
OR Tools -> CodeGen
Preferences -> Tools -> CodeGen
- Generation type(Text/Database)
- In-house variables and (handlebars) helpers
- Predefined variables
- Custom template groups
- Data sources manager
{{$.Year}} current year
{{$.Month}} current month
{{$.Day}} current day of the month
{{$.Hour}} current hour
{{$.Minute}} current minute
{{$.Second}} current second
{{$.Date}} current system date
{{$.Now}} current system time
{{$.serialVersionUID}} current model serialVersionUID
{{$.Project}} the name of the current project
{{$.Module1} the name of the current selected module
{{$.Package1} the name of the current selected package
- 首尾拼接字符
{{Join 'ABC' '#' '%'}} => #ABC%
- 首字母小写
{{LowerCase 'ABC'}} => aBC
- 首字母大写
{{LowerCase 'abc'}} => Abc
- 驼峰分割
{{Split 'ABcD' '_'}} => A_bc_d
* 组合用法
{{Split (Join (LowerCase 'AbcDefGhi') '$' '%') '_'}} => $abc_def_ghi%
- markdown
| id | BIGINT(20) | ID |
| pid | BIGINT(20) | 父级ID |
| name | VARCHAR(64) | 名称 |
| level | INT(11) | 级别 |
| pinyin | VARCHAR(100) | 拼音 |
| english_name | VARCHAR(100) | 英文名 |
| unicode_code | VARCHAR(200) | ASCII码 |
| checker_name | VARCHAR(64) | 审核用户名称 |
| order_no | INT(11) | 排序号 |
- sqlScript
CREATE TABLE `t_addresses` (
`id` BIGINT(20) NOT NULL,
`pid` BIGINT(20) DEFAULT NULL COMMENT '父级ID',
`name` VARCHAR(50) DEFAULT NULL COMMENT '名称',
`level` INT(11) DEFAULT NULL COMMENT '级别',
`pinyin` VARCHAR(100) DEFAULT NULL COMMENT '拼音',
`english_name` VARCHAR(100) DEFAULT NULL COMMENT '英文名',
`unicode_code` VARCHAR(200) DEFAULT NULL COMMENT 'ASCII码',
`order_no` INT(11) DEFAULT NULL COMMENT '排序号',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started.html
How to setup
- Clone the project, and open with IDEA (Community).
- Modify module type in
.idea/CodeGen.iml
fromJAVA_MODULE
toPLUGIN_MODULE
. - Change the project's module compile output path to
/XXX/XXX/CodeGen/out
inProject Structure -> Modules -> CodeGen -> paths
. You can also modify the Plugin Deploymentplugin.xml path
. Install lombok plugin. In Preferences -> Build -> Annotation Processors.(lombok has been removed.)Enable annotation processing.Modify Production sources directory to outModify Test sources directory to out
- Run CodeGen and enjoy it.
Welcome to contribute
Copyright © 2017 MIT License