idea 插件 ToolBox

 


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 到剪切板

1
2
3
4
5
6
7
8
9
10
11
12
/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 语句

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
 * 测试库
 * @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 数据

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
  "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等。

1
2
3
4
5
6
7
8
9
10
"classDesc"; 使用范围:入参或者返回的实体类
"methodName"; 使用范围:方法上
"methodDesc"; 使用范围:方法上
"rtnActualCls"; 使用范围:方法上,重新指定类型
"fieldName"; 使用范围:入参和实体类中
"fieldDesc"; 使用范围:入参和实体类中
"fieldRequired"; 使用范围:入参和实体类中
"fieldDefValue"; 使用范围:入参和实体类中
"fieldExclude"; 使用范围:入参和实体类中
"fieldActualCls"; 使用范围:入参和实体类中,重新指定类型

注释使用示例图

文档生成路径配置图

 

 

 接口文档页面展示图

 

 

 


1
使用范围:方法上
posted @   wade&luffy  阅读(2401)  评论(3编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 字符编码:从基础到乱码解决
点击右上角即可分享
微信分享提示

目录导航