Skip to content

Commit ad62305

Browse files
committed
Add generate entity document
1 parent c2d1d74 commit ad62305

File tree

5 files changed

+54
-14
lines changed

5 files changed

+54
-14
lines changed

document/config.mts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ export default defineAdditionalConfig({
2929
{ text: "DTO Lanauge", link: "dto-language" },
3030
],
3131
},
32+
{
33+
text: "Reference",
34+
base: "/reference/",
35+
link: "feature-inspection",
36+
}
3237
],
3338
},
3439
"/reference/": {

document/en/reference/feature-generate-entity.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,35 @@ JimmerBuddy can generate entity classes from the databases or ddl files.
88
2. Switch to `Database` tab.
99
3. Click `+` button to add a database or ddl file.
1010

11-
![20250524204214](https://s2.loli.net/2025/05/24/p6r1P3MADVmzhkJ.png)
11+
![20250525161526](https://s2.loli.net/2025/05/25/6LqW4NlZKJhR9uM.png)
1212

1313
4. Input some information about the database or ddl file.
1414

15-
![20250524204250](https://s2.loli.net/2025/05/24/zeITHF8rkLGWx3t.png)
16-
![20250524204416](https://s2.loli.net/2025/05/24/RGaKgpvNbJu1MdE.png)
15+
![20250525162253](https://s2.loli.net/2025/05/25/C1REKkceOMHq2AP.png)
1716

1817
5. Click `OK` button to save the configuration.
1918

20-
![20250524204456](https://s2.loli.net/2025/05/24/1MEC3GrcBz4P6Vn.png)
19+
![20250525162311](https://s2.loli.net/2025/05/25/N64wXcrDvsyY3qP.png)
2120

2221
6. Select the database or ddl file then right click it.
2322
7. Select `Generate` from the context menu.
23+
8. In the popup dialog, input the relative path and package name.
2424

25-
![](https://s2.loli.net/2025/05/24/1z3CVWorRKgq9hS.png)
25+
![20250525162405](https://s2.loli.net/2025/05/25/Bl3cTdeaEtIC49s.png)
2626

27-
8. Click `OK` button to generate the entity classes.
27+
9. Click `OK` button to generate the entity classes.
28+
29+
![20250525162454](https://s2.loli.net/2025/05/25/v85Khz2HL7Y6FQE.png)
30+
31+
## Configuration Entity Comments
32+
33+
Go to the `File and Code Templates` settings page and select `Jimmer`.
34+
35+
![20250525162739](https://s2.loli.net/2025/05/25/c6bPYIXEo9wvutA.png)
36+
37+
## Notes
38+
39+
- The generated entity classes will overwrite the existing ones with the same name.
40+
- Tables without a primary key will not be generated.
41+
- The `BaseEntity` will only be generated if the public fields are present in all tables.
42+
- Join tables will only be treated as such if they have no primary key and only two fields.

document/zh/config.mts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ export default defineAdditionalConfig({
2929
{ text: "DTO语言", link: "dto-language" },
3030
],
3131
},
32+
{
33+
text: "参考",
34+
base: "/zh/reference/",
35+
link: "feature-inspection",
36+
}
3237
],
3338
},
3439
"/zh/reference/": {

document/zh/reference/feature-generate-entity.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,37 @@ JimmerBuddy 可以从数据库或 ddl 文件生成实体类。
66

77
1. 打开 JimmerBuddy 工具窗口。
88
2. 切换到 `Database` 选项卡。
9-
3. 点击 `+` 按钮添加数据库或 ddl 文件。
109

11-
![20250524204214](https://s2.loli.net/2025/05/24/p6r1P3MADVmzhkJ.png)
10+
![20250525161526](https://s2.loli.net/2025/05/25/6LqW4NlZKJhR9uM.png)
1211

12+
3. 点击 `+` 按钮添加数据库或 ddl 文件。
1313
4. 输入一些关于数据库或 ddl 文件的信息。
1414

15-
![20250524204250](https://s2.loli.net/2025/05/24/zeITHF8rkLGWx3t.png)
16-
![20250524204416](https://s2.loli.net/2025/05/24/RGaKgpvNbJu1MdE.png)
15+
![20250525162253](https://s2.loli.net/2025/05/25/C1REKkceOMHq2AP.png)
1716

1817
5. 点击 `OK` 按钮保存配置。
1918

20-
![20250524204456](https://s2.loli.net/2025/05/24/1MEC3GrcBz4P6Vn.png)
19+
![20250525162311](https://s2.loli.net/2025/05/25/N64wXcrDvsyY3qP.png)
2120

2221
6. 选择数据库或 ddl 文件,然后右键单击它。
2322
7. 从上下文菜单中选择 `Generate`
23+
8. 在弹出的对话框中,输入相对路径和包名。
24+
25+
![20250525162405](https://s2.loli.net/2025/05/25/Bl3cTdeaEtIC49s.png)
26+
27+
9. 点击 `OK` 按钮生成实体类。
28+
29+
![20250525162454](https://s2.loli.net/2025/05/25/v85Khz2HL7Y6FQE.png)
30+
31+
## 配置实体注释
32+
33+
进入到 `File and Code Templates` 设置页面,选择 `Jimmer`
34+
35+
![20250525162739](https://s2.loli.net/2025/05/25/c6bPYIXEo9wvutA.png)
2436

25-
![](https://s2.loli.net/2025/05/24/1z3CVWorRKgq9hS.png)
37+
## 注意事项
2638

27-
8. 点击 `OK` 按钮生成实体类。
39+
- 生成的实体类会覆盖同名的实体类。
40+
- 没有主键的表不会生成。
41+
- `BaseEntity`实体只有当公共字段在所有表中都有时才会生成。
42+
- 中间表只有没有主键并只有两个字段时才会被当成中间表处理。
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# 项目向导
22

3-
Go to `New Project` and select `Jimmer`.
3+
转到`New Project`并选择`Jimmer`
44

55
![20250524205732](https://s2.loli.net/2025/05/24/YigsuCNjEb7rU6Q.png)

0 commit comments

Comments
 (0)