idea 插件 IdeaToolBox

Features

ps:使用中如果有什么问题,可以在下面进行评论,给出 demo 用例,谢谢。

驼峰和下划线之间切换 ctrl+shift+x

自动生成 java 类的 setter 赋值语句 和 builder 模式的赋值语句

快捷键:window(alt+insert) mac(ctrl+enter)

  • without value (没有值)
  • with value by default (默认值)
  • with value from other object (从其他对象get的值)

   

ps: 有人要问了,obj 是怎么出来的,在生成前先复制一个其他对象的声明到剪切板。

从 controller 方法上拷贝 restful url 到剪切板

/back/door/mybatis/generator?tableName=&author=&schema=&remove=&type=

@RequestMapping("/back/door/mybatis")
public class MybatisController {

    @RequestMapping("/generator")
    public void generator(@RequestParam("tableName") String tableName,
                          @RequestParam(value = "author", required = false) String author,
                          @RequestParam(value = "schema", required = false) String schema,
                          @RequestParam(value = "remove", required = false) String remove,
                          @RequestParam(value = "type", required = false) String type,
                          HttpServletResponse response) {}

从 java 类创建 mysql create table 语句

/**
 * 测试库
 * @mysqlTableName TB_TestLib
 * @mysqlKey primary key (`id`)
 * @mysqlKey index idx_userId (`userId`)
 * @mysqlExtra other desc
 */
public class TestLib{
	/**
	 * 主键id
	 */
	private Long id;
	/**
	 * 主播id
	 * @mysqlDefValue 22
	 */
	private Long userId;
	/**
	 * 创建时间
	 */
	private Date createTime;
	/**
	 * 修改时间
	 */
	private Date updateTime;
}
CREATE TABLE `TB_TestLib` (
	`id` bigint(20)  not null comment '主键id',
	`userId` bigint(20) default '22'  not null comment '主播id',
    `createTime` datetime default current_timestamp not null comment '创建时间',
    `updateTime` datetime default current_timestamp not null on update current_timestamp comment '修改时间',
	primary key (`id`),
	index idx_userId (`userId`)
) ENGINE=InnoDB default CHARSET=utf8mb4 COMMENT='测试库' /* other desc */ ;

从 mysql  表创建 domain 类

配置数据库信息

 配置类信息

 

 从 java 类创建一个 json 数据

 

{
  "total": 0,
  "currentRecordCount": 0,
  "pageParam": {
    "pageNo": 0,
    "pageSize": 0,
    "offset": 0,
    "limit": 0,
    "sortBy": "",
    "defaultPageNo": 0,
    "defaultOffset": 0,
    "defaultPageSize": 0,
    "maxTotal": 0
  },
  "maxPageNo": 0
}

 根据方法定义生成接口文档和默认页面

设置输出文档位置

对方法属性进行描述,不仅限于 rest method,任何方法都可以生成文档,譬如rpc等。

    "classDesc"; 使用范围:入参或者返回的实体类
    "methodName"; 使用范围:方法上
    "methodDesc"; 使用范围:方法上
    "rtnActualCls"; 使用范围:方法上,重新指定类型
    "fieldName"; 使用范围:入参和实体类中
    "fieldDesc"; 使用范围:入参和实体类中
    "fieldRequired"; 使用范围:入参和实体类中
    "fieldDefValue"; 使用范围:入参和实体类中
    "fieldExclude"; 使用范围:入参和实体类中
    "fieldActualCls"; 使用范围:入参和实体类中,重新指定类型

注释使用示例图

文档生成路径配置图

 接口文档页面展示图


使用范围:方法上
原文地址:https://www.cnblogs.com/wade-luffy/p/13408015.html