ai-engineering-init 1.3.4 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/.claude/hooks/skill-forced-eval.js +2 -0
  2. package/.claude/settings.json +3 -3
  3. package/.claude/skills/add-skill/SKILL.md +79 -32
  4. package/.claude/skills/api-development/SKILL.md +83 -377
  5. package/.claude/skills/architecture-design/SKILL.md +138 -632
  6. package/.claude/skills/backend-annotations/SKILL.md +134 -506
  7. package/.claude/skills/banana-image/SKILL.md +10 -3
  8. package/.claude/skills/brainstorm/SKILL.md +103 -535
  9. package/.claude/skills/bug-detective/SKILL.md +147 -1097
  10. package/.claude/skills/bug-detective/references/error-patterns.md +242 -0
  11. package/.claude/skills/code-patterns/SKILL.md +116 -426
  12. package/.claude/skills/code-patterns/references/leniu-code-patterns.md +87 -0
  13. package/.claude/skills/crud-development/SKILL.md +64 -304
  14. package/.claude/skills/data-permission/SKILL.md +105 -412
  15. package/.claude/skills/data-permission/references/custom-data-scope.md +90 -0
  16. package/.claude/skills/file-oss-management/SKILL.md +106 -714
  17. package/.claude/skills/file-oss-management/references/entities.md +105 -0
  18. package/.claude/skills/file-oss-management/references/service-impl.md +104 -0
  19. package/.claude/skills/leniu-api-development/SKILL.md +142 -626
  20. package/.claude/skills/leniu-api-development/references/real-examples.md +273 -0
  21. package/.claude/skills/leniu-architecture-design/SKILL.md +176 -391
  22. package/.claude/skills/leniu-backend-annotations/SKILL.md +132 -519
  23. package/.claude/skills/leniu-brainstorm/SKILL.md +132 -541
  24. package/.claude/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
  25. package/.claude/skills/leniu-crud-development/SKILL.md +232 -938
  26. package/.claude/skills/leniu-crud-development/references/templates.md +597 -0
  27. package/.claude/skills/leniu-customization-location/SKILL.md +410 -0
  28. package/.claude/skills/leniu-data-permission/SKILL.md +70 -0
  29. package/.claude/skills/leniu-java-entity/SKILL.md +76 -590
  30. package/.claude/skills/leniu-java-entity/references/templates.md +237 -0
  31. package/.claude/skills/leniu-java-export/SKILL.md +94 -379
  32. package/.claude/skills/leniu-java-logging/SKILL.md +106 -709
  33. package/.claude/skills/leniu-java-logging/references/data-mask.md +46 -0
  34. package/.claude/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
  35. package/.claude/skills/leniu-java-mybatis/SKILL.md +73 -446
  36. package/.claude/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
  37. package/.claude/skills/leniu-report-customization/SKILL.md +111 -365
  38. package/.claude/skills/leniu-report-customization/references/table-fields.md +93 -0
  39. package/.claude/skills/leniu-report-standard-customization/SKILL.md +111 -334
  40. package/.claude/skills/leniu-report-standard-customization/references/analysis-module.md +64 -0
  41. package/.claude/skills/leniu-report-standard-customization/references/table-fields.md +113 -0
  42. package/.claude/skills/leniu-security-guard/SKILL.md +133 -347
  43. package/.claude/skills/mysql-debug/SKILL.md +364 -0
  44. package/.claude/skills/openspec-apply-change/SKILL.md +10 -1
  45. package/.claude/skills/openspec-archive-change/SKILL.md +9 -1
  46. package/.claude/skills/openspec-bulk-archive-change/SKILL.md +9 -1
  47. package/.claude/skills/openspec-continue-change/SKILL.md +9 -1
  48. package/.claude/skills/openspec-explore/SKILL.md +10 -1
  49. package/.claude/skills/openspec-ff-change/SKILL.md +9 -1
  50. package/.claude/skills/openspec-new-change/SKILL.md +9 -1
  51. package/.claude/skills/openspec-onboard/SKILL.md +15 -130
  52. package/.claude/skills/openspec-sync-specs/SKILL.md +9 -1
  53. package/.claude/skills/openspec-verify-change/SKILL.md +9 -1
  54. package/.claude/skills/performance-doctor/SKILL.md +110 -434
  55. package/.claude/skills/redis-cache/SKILL.md +89 -595
  56. package/.claude/skills/redis-cache/references/listeners.md +23 -0
  57. package/.claude/skills/scheduled-jobs/SKILL.md +88 -407
  58. package/.claude/skills/security-guard/SKILL.md +137 -532
  59. package/.claude/skills/security-guard/references/encrypt-config.md +103 -0
  60. package/.claude/skills/security-guard/references/sensitive-strategies.md +42 -0
  61. package/.claude/skills/sms-mail/SKILL.md +116 -574
  62. package/.claude/skills/sms-mail/references/mail-config.md +88 -0
  63. package/.claude/skills/sms-mail/references/sms-config.md +74 -0
  64. package/.claude/skills/social-login/SKILL.md +112 -514
  65. package/.claude/skills/social-login/references/provider-configs.md +118 -0
  66. package/.claude/skills/tenant-management/SKILL.md +129 -444
  67. package/.claude/skills/tenant-management/references/tenant-scenarios.md +91 -0
  68. package/.claude/skills/test-development/SKILL.md +86 -540
  69. package/.claude/skills/test-development/references/parameterized-examples.md +119 -0
  70. package/.claude/skills/utils-toolkit/SKILL.md +52 -305
  71. package/.claude/skills/utils-toolkit/references/redis-utils-api.md +56 -0
  72. package/.claude/skills/websocket-sse/SKILL.md +105 -550
  73. package/.claude/skills/workflow-engine/SKILL.md +147 -502
  74. package/.codex/skills/add-skill/SKILL.md +79 -32
  75. package/.codex/skills/api-development/SKILL.md +172 -599
  76. package/.codex/skills/architecture-design/SKILL.md +138 -504
  77. package/.codex/skills/backend-annotations/SKILL.md +134 -496
  78. package/.codex/skills/banana-image/SKILL.md +10 -3
  79. package/.codex/skills/brainstorm/SKILL.md +103 -535
  80. package/.codex/skills/bug-detective/SKILL.md +147 -1097
  81. package/.codex/skills/bug-detective/references/error-patterns.md +242 -0
  82. package/.codex/skills/code-patterns/SKILL.md +120 -282
  83. package/.codex/skills/code-patterns/references/leniu-code-patterns.md +87 -0
  84. package/.codex/skills/crud-development/SKILL.md +64 -292
  85. package/.codex/skills/data-permission/SKILL.md +108 -407
  86. package/.codex/skills/data-permission/references/custom-data-scope.md +90 -0
  87. package/.codex/skills/database-ops/SKILL.md +8 -154
  88. package/.codex/skills/error-handler/SKILL.md +10 -0
  89. package/.codex/skills/file-oss-management/SKILL.md +106 -714
  90. package/.codex/skills/file-oss-management/references/entities.md +105 -0
  91. package/.codex/skills/file-oss-management/references/service-impl.md +104 -0
  92. package/.codex/skills/git-workflow/SKILL.md +27 -5
  93. package/.codex/skills/leniu-api-development/SKILL.md +142 -626
  94. package/.codex/skills/leniu-api-development/references/real-examples.md +273 -0
  95. package/.codex/skills/leniu-architecture-design/SKILL.md +176 -391
  96. package/.codex/skills/leniu-backend-annotations/SKILL.md +132 -519
  97. package/.codex/skills/leniu-brainstorm/SKILL.md +132 -541
  98. package/.codex/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
  99. package/.codex/skills/leniu-crud-development/SKILL.md +232 -938
  100. package/.codex/skills/leniu-crud-development/references/templates.md +597 -0
  101. package/.codex/skills/leniu-customization-location/SKILL.md +410 -0
  102. package/.codex/skills/leniu-data-permission/SKILL.md +70 -0
  103. package/.codex/skills/leniu-java-code-style/SKILL.md +510 -0
  104. package/.codex/skills/leniu-java-entity/SKILL.md +76 -590
  105. package/.codex/skills/leniu-java-entity/references/templates.md +237 -0
  106. package/.codex/skills/leniu-java-export/SKILL.md +94 -379
  107. package/.codex/skills/leniu-java-logging/SKILL.md +106 -709
  108. package/.codex/skills/leniu-java-logging/references/data-mask.md +46 -0
  109. package/.codex/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
  110. package/.codex/skills/leniu-java-mybatis/SKILL.md +73 -446
  111. package/.codex/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
  112. package/.codex/skills/leniu-report-customization/SKILL.md +111 -365
  113. package/.codex/skills/leniu-report-customization/references/table-fields.md +93 -0
  114. package/.codex/skills/leniu-report-standard-customization/SKILL.md +111 -334
  115. package/.codex/skills/leniu-report-standard-customization/references/analysis-module.md +64 -0
  116. package/.codex/skills/leniu-report-standard-customization/references/table-fields.md +113 -0
  117. package/.codex/skills/leniu-security-guard/SKILL.md +133 -347
  118. package/.codex/skills/mysql-debug/SKILL.md +364 -0
  119. package/.codex/skills/openspec-apply-change/SKILL.md +10 -1
  120. package/.codex/skills/openspec-archive-change/SKILL.md +9 -1
  121. package/.codex/skills/openspec-bulk-archive-change/SKILL.md +9 -1
  122. package/.codex/skills/openspec-continue-change/SKILL.md +9 -1
  123. package/.codex/skills/openspec-explore/SKILL.md +10 -1
  124. package/.codex/skills/openspec-ff-change/SKILL.md +9 -1
  125. package/.codex/skills/openspec-new-change/SKILL.md +9 -1
  126. package/.codex/skills/openspec-onboard/SKILL.md +15 -130
  127. package/.codex/skills/openspec-sync-specs/SKILL.md +9 -1
  128. package/.codex/skills/openspec-verify-change/SKILL.md +9 -1
  129. package/.codex/skills/performance-doctor/SKILL.md +110 -434
  130. package/.codex/skills/project-navigator/SKILL.md +20 -1
  131. package/.codex/skills/redis-cache/SKILL.md +93 -589
  132. package/.codex/skills/redis-cache/references/listeners.md +23 -0
  133. package/.codex/skills/scheduled-jobs/SKILL.md +88 -407
  134. package/.codex/skills/security-guard/SKILL.md +141 -527
  135. package/.codex/skills/security-guard/references/encrypt-config.md +103 -0
  136. package/.codex/skills/security-guard/references/sensitive-strategies.md +42 -0
  137. package/.codex/skills/sms-mail/SKILL.md +116 -574
  138. package/.codex/skills/sms-mail/references/mail-config.md +88 -0
  139. package/.codex/skills/sms-mail/references/sms-config.md +74 -0
  140. package/.codex/skills/social-login/SKILL.md +112 -514
  141. package/.codex/skills/social-login/references/provider-configs.md +118 -0
  142. package/.codex/skills/store-pc/SKILL.md +258 -383
  143. package/.codex/skills/tenant-management/SKILL.md +129 -444
  144. package/.codex/skills/tenant-management/references/tenant-scenarios.md +91 -0
  145. package/.codex/skills/test-development/SKILL.md +86 -540
  146. package/.codex/skills/test-development/references/parameterized-examples.md +119 -0
  147. package/.codex/skills/ui-pc/SKILL.md +350 -387
  148. package/.codex/skills/utils-toolkit/SKILL.md +52 -283
  149. package/.codex/skills/utils-toolkit/references/redis-utils-api.md +56 -0
  150. package/.codex/skills/websocket-sse/SKILL.md +105 -550
  151. package/.codex/skills/workflow-engine/SKILL.md +147 -502
  152. package/.cursor/hooks.json +3 -3
  153. package/.cursor/skills/add-skill/SKILL.md +79 -32
  154. package/.cursor/skills/api-development/SKILL.md +83 -377
  155. package/.cursor/skills/architecture-design/SKILL.md +138 -632
  156. package/.cursor/skills/backend-annotations/SKILL.md +134 -506
  157. package/.cursor/skills/banana-image/SKILL.md +10 -3
  158. package/.cursor/skills/brainstorm/SKILL.md +103 -535
  159. package/.cursor/skills/bug-detective/SKILL.md +147 -1097
  160. package/.cursor/skills/bug-detective/references/error-patterns.md +242 -0
  161. package/.cursor/skills/code-patterns/SKILL.md +116 -426
  162. package/.cursor/skills/code-patterns/references/leniu-code-patterns.md +87 -0
  163. package/.cursor/skills/crud-development/SKILL.md +64 -304
  164. package/.cursor/skills/data-permission/SKILL.md +105 -412
  165. package/.cursor/skills/data-permission/references/custom-data-scope.md +90 -0
  166. package/.cursor/skills/file-oss-management/SKILL.md +106 -714
  167. package/.cursor/skills/file-oss-management/references/entities.md +105 -0
  168. package/.cursor/skills/file-oss-management/references/service-impl.md +104 -0
  169. package/.cursor/skills/git-workflow/SKILL.md +27 -5
  170. package/.cursor/skills/leniu-api-development/SKILL.md +142 -626
  171. package/.cursor/skills/leniu-api-development/references/real-examples.md +273 -0
  172. package/.cursor/skills/leniu-architecture-design/SKILL.md +176 -391
  173. package/.cursor/skills/leniu-backend-annotations/SKILL.md +132 -519
  174. package/.cursor/skills/leniu-brainstorm/SKILL.md +132 -541
  175. package/.cursor/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
  176. package/.cursor/skills/leniu-crud-development/SKILL.md +232 -938
  177. package/.cursor/skills/leniu-crud-development/references/templates.md +597 -0
  178. package/.cursor/skills/leniu-customization-location/SKILL.md +410 -0
  179. package/.cursor/skills/leniu-data-permission/SKILL.md +70 -0
  180. package/.cursor/skills/leniu-java-code-style/SKILL.md +510 -0
  181. package/.cursor/skills/leniu-java-entity/SKILL.md +76 -590
  182. package/.cursor/skills/leniu-java-entity/references/templates.md +237 -0
  183. package/.cursor/skills/leniu-java-export/SKILL.md +94 -379
  184. package/.cursor/skills/leniu-java-logging/SKILL.md +106 -709
  185. package/.cursor/skills/leniu-java-logging/references/data-mask.md +46 -0
  186. package/.cursor/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
  187. package/.cursor/skills/leniu-java-mybatis/SKILL.md +73 -446
  188. package/.cursor/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
  189. package/.cursor/skills/leniu-report-customization/SKILL.md +111 -365
  190. package/.cursor/skills/leniu-report-customization/references/table-fields.md +93 -0
  191. package/.cursor/skills/leniu-report-standard-customization/SKILL.md +111 -334
  192. package/.cursor/skills/leniu-report-standard-customization/references/analysis-module.md +64 -0
  193. package/.cursor/skills/leniu-report-standard-customization/references/table-fields.md +113 -0
  194. package/.cursor/skills/leniu-security-guard/SKILL.md +133 -347
  195. package/.cursor/skills/mysql-debug/SKILL.md +364 -0
  196. package/.cursor/skills/openspec-apply-change/SKILL.md +10 -1
  197. package/.cursor/skills/openspec-archive-change/SKILL.md +9 -1
  198. package/.cursor/skills/openspec-bulk-archive-change/SKILL.md +9 -1
  199. package/.cursor/skills/openspec-continue-change/SKILL.md +9 -1
  200. package/.cursor/skills/openspec-explore/SKILL.md +10 -1
  201. package/.cursor/skills/openspec-ff-change/SKILL.md +9 -1
  202. package/.cursor/skills/openspec-new-change/SKILL.md +9 -1
  203. package/.cursor/skills/openspec-onboard/SKILL.md +15 -130
  204. package/.cursor/skills/openspec-sync-specs/SKILL.md +9 -1
  205. package/.cursor/skills/openspec-verify-change/SKILL.md +9 -1
  206. package/.cursor/skills/performance-doctor/SKILL.md +110 -434
  207. package/.cursor/skills/redis-cache/SKILL.md +89 -595
  208. package/.cursor/skills/redis-cache/references/listeners.md +23 -0
  209. package/.cursor/skills/scheduled-jobs/SKILL.md +88 -407
  210. package/.cursor/skills/security-guard/SKILL.md +137 -532
  211. package/.cursor/skills/security-guard/references/encrypt-config.md +103 -0
  212. package/.cursor/skills/security-guard/references/sensitive-strategies.md +42 -0
  213. package/.cursor/skills/sms-mail/SKILL.md +116 -574
  214. package/.cursor/skills/sms-mail/references/mail-config.md +88 -0
  215. package/.cursor/skills/sms-mail/references/sms-config.md +74 -0
  216. package/.cursor/skills/social-login/SKILL.md +112 -514
  217. package/.cursor/skills/social-login/references/provider-configs.md +118 -0
  218. package/.cursor/skills/tenant-management/SKILL.md +129 -444
  219. package/.cursor/skills/tenant-management/references/tenant-scenarios.md +91 -0
  220. package/.cursor/skills/test-development/SKILL.md +86 -540
  221. package/.cursor/skills/test-development/references/parameterized-examples.md +119 -0
  222. package/.cursor/skills/utils-toolkit/SKILL.md +52 -305
  223. package/.cursor/skills/utils-toolkit/references/redis-utils-api.md +56 -0
  224. package/.cursor/skills/websocket-sse/SKILL.md +105 -550
  225. package/.cursor/skills/workflow-engine/SKILL.md +147 -502
  226. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: crud-development
3
3
  description: |
4
- 后端 CRUD 开发规范。基于 RuoYi-Vue-Plus 三层架构(Controller Service Mapper),无独立 DAO 层。
4
+ 后端 CRUD 开发规范。基于 RuoYi-Vue-Plus 三层架构(Controller -> Service -> Mapper),无独立 DAO 层。
5
5
 
6
6
  触发场景:
7
7
  - 新建业务模块的 CRUD 功能
@@ -12,34 +12,30 @@ description: |
12
12
  触发词:CRUD、增删改查、新建模块、Entity、BO、VO、Service、Mapper、Controller、分页查询、buildQueryWrapper、@AutoMapper、BaseMapperPlus、TenantEntity
13
13
 
14
14
  注意:
15
- - 本项目是三层架构,Service 直接注入 Mapper,无 DAO 层。
15
+ - 三层架构,Service 直接注入 Mapper,无 DAO 层。
16
16
  - 查询条件在 Service 层构建(buildQueryWrapper)。
17
17
  - 使用 @AutoMapper(单数)而非 @AutoMappers。
18
18
  - API 路径使用标准 RESTful 格式(/list、/{id})。
19
19
  ---
20
20
 
21
- # CRUD 全栈开发规范(RuoYi-Vue-Plus 三层架构版)
22
-
23
- > **⚠️ 重要声明**: 本项目是 **RuoYi-Vue-Plus 纯后端项目**,采用三层架构!
24
- > 不同于其他四层架构项目,本项目 **无独立 DAO 层**,Service 直接调用 Mapper。
21
+ # CRUD 开发规范(RuoYi-Vue-Plus 三层架构)
25
22
 
26
23
  ## 核心架构特征
27
24
 
28
- | 对比项 | 本项目 (RuoYi-Vue-Plus) |
29
- |--------|----------------------|
25
+ | | 规范 |
26
+ |----|------|
30
27
  | **包名前缀** | `org.dromara.*` |
31
- | **架构** | 三层:Controller Service Mapper |
32
- | **DAO 层** | ❌ 不存在,Service 直接注入 Mapper |
28
+ | **架构** | Controller -> Service -> Mapper(无 DAO 层) |
33
29
  | **查询构建** | Service 层 `buildQueryWrapper()` |
34
- | **Mapper 继承** | `BaseMapperPlus<Entity, VO>` |
30
+ | **Mapper** | 继承 `BaseMapperPlus<Entity, VO>` |
35
31
  | **对象转换** | `MapstructUtils.convert()` |
36
32
  | **Entity 基类** | `TenantEntity`(多租户) |
37
- | **BO 映射** | `@AutoMapper` 注解(单数) |
38
- | **API 路径** | 标准 RESTful:`/list`、`/{id}` |
33
+ | **BO 映射** | `@AutoMapper`(单数) |
34
+ | **API 路径** | RESTful:`/list`、`/{id}` |
39
35
 
40
36
  ---
41
37
 
42
- ## 1. Entity 实体类(继承 TenantEntity)
38
+ ## 1. Entity
43
39
 
44
40
  ```java
45
41
  package org.dromara.demo.domain;
@@ -50,97 +46,62 @@ import lombok.Data;
50
46
  import lombok.EqualsAndHashCode;
51
47
  import java.io.Serial;
52
48
 
53
- /**
54
- * XXX 对象
55
- *
56
- * @author Lion Li
57
- */
58
49
  @Data
59
50
  @EqualsAndHashCode(callSuper = true)
60
51
  @TableName("test_xxx")
61
- public class Xxx extends TenantEntity { // ✅ 继承 TenantEntity(多租户)
52
+ public class Xxx extends TenantEntity {
62
53
 
63
54
  @Serial
64
55
  private static final long serialVersionUID = 1L;
65
56
 
66
- /**
67
- * 主键 ID
68
- */
69
57
  @TableId(value = "id")
70
58
  private Long id;
71
59
 
72
- /**
73
- * 名称
74
- */
75
60
  private String xxxName;
76
61
 
77
- /**
78
- * 状态(0正常 1停用)
79
- */
80
62
  private String status;
81
63
 
82
- /**
83
- * 删除标志
84
- */
85
64
  @TableLogic
86
65
  private Long delFlag;
87
66
  }
88
67
  ```
89
68
 
90
- ---
91
-
92
- ## 2. BO 业务对象(@AutoMapper 映射)
69
+ ## 2. BO
93
70
 
94
71
  ```java
95
72
  package org.dromara.demo.domain.bo;
96
73
 
97
74
  import io.github.linpeilie.annotations.AutoMapper;
98
75
  import org.dromara.demo.domain.Xxx;
99
- import org.dromara.demo.domain.vo.XxxVo;
100
76
  import org.dromara.common.core.validate.AddGroup;
101
77
  import org.dromara.common.core.validate.EditGroup;
78
+ import org.dromara.common.mybatis.core.domain.BaseEntity;
102
79
  import lombok.Data;
103
80
  import lombok.EqualsAndHashCode;
104
- import org.dromara.common.mybatis.core.domain.BaseEntity;
105
81
  import jakarta.validation.constraints.*;
106
82
 
107
- /**
108
- * XXX 业务对象
109
- */
110
83
  @Data
111
84
  @EqualsAndHashCode(callSuper = true)
112
- @AutoMapper(target = Xxx.class, reverseConvertGenerate = false) // ✅ 映射到 Entity
85
+ @AutoMapper(target = Xxx.class, reverseConvertGenerate = false)
113
86
  public class XxxBo extends BaseEntity {
114
87
 
115
- /**
116
- * 主键 ID
117
- */
118
- @NotNull(message = "主键 ID 不能为空", groups = {EditGroup.class})
88
+ @NotNull(message = "主键不能为空", groups = {EditGroup.class})
119
89
  private Long id;
120
90
 
121
- /**
122
- * 名称
123
- */
124
91
  @NotBlank(message = "名称不能为空", groups = {AddGroup.class, EditGroup.class})
125
92
  private String xxxName;
126
93
 
127
- /**
128
- * 状态
129
- */
130
94
  private String status;
131
95
  }
132
96
  ```
133
97
 
134
- ---
135
-
136
- ## 3. VO 视图对象(@AutoMapper 映射)
98
+ ## 3. VO
137
99
 
138
100
  ```java
139
101
  package org.dromara.demo.domain.vo;
140
102
 
141
103
  import io.github.linpeilie.annotations.AutoMapper;
142
104
  import org.dromara.demo.domain.Xxx;
143
- import org.dromara.demo.domain.bo.XxxBo;
144
105
  import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
145
106
  import cn.idev.excel.annotation.ExcelProperty;
146
107
  import lombok.Data;
@@ -148,45 +109,28 @@ import java.io.Serial;
148
109
  import java.io.Serializable;
149
110
  import java.util.Date;
150
111
 
151
- /**
152
- * XXX 视图对象
153
- */
154
112
  @Data
155
113
  @ExcelIgnoreUnannotated
156
- @AutoMapper(target = Xxx.class) // ✅ VO 也使用 @AutoMapper
114
+ @AutoMapper(target = Xxx.class)
157
115
  public class XxxVo implements Serializable {
158
116
 
159
117
  @Serial
160
118
  private static final long serialVersionUID = 1L;
161
119
 
162
- /**
163
- * 主键 ID
164
- */
165
- @ExcelProperty(value = "主键 ID")
120
+ @ExcelProperty(value = "主键")
166
121
  private Long id;
167
122
 
168
- /**
169
- * 名称
170
- */
171
123
  @ExcelProperty(value = "名称")
172
124
  private String xxxName;
173
125
 
174
- /**
175
- * 状态
176
- */
177
126
  @ExcelProperty(value = "状态")
178
127
  private String status;
179
128
 
180
- /**
181
- * 创建时间
182
- */
183
129
  @ExcelProperty(value = "创建时间")
184
130
  private Date createTime;
185
131
  }
186
132
  ```
187
133
 
188
- ---
189
-
190
134
  ## 4. Service 接口
191
135
 
192
136
  ```java
@@ -199,46 +143,17 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
199
143
  import java.util.Collection;
200
144
  import java.util.List;
201
145
 
202
- /**
203
- * XXX 服务接口
204
- */
205
146
  public interface IXxxService {
206
-
207
- /**
208
- * 根据 ID 查询
209
- */
210
147
  XxxVo queryById(Long id);
211
-
212
- /**
213
- * 查询列表
214
- */
215
148
  List<XxxVo> queryList(XxxBo bo);
216
-
217
- /**
218
- * 分页查询
219
- */
220
149
  TableDataInfo<XxxVo> queryPageList(XxxBo bo, PageQuery pageQuery);
221
-
222
- /**
223
- * 新增
224
- */
225
150
  Boolean insertByBo(XxxBo bo);
226
-
227
- /**
228
- * 修改
229
- */
230
151
  Boolean updateByBo(XxxBo bo);
231
-
232
- /**
233
- * 删除
234
- */
235
152
  Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
236
153
  }
237
154
  ```
238
155
 
239
- ---
240
-
241
- ## 5. Service 实现类(⭐ 核心:三层架构,NO DAO 层)
156
+ ## 5. Service 实现(核心)
242
157
 
243
158
  ```java
244
159
  package org.dromara.demo.service.impl;
@@ -262,16 +177,11 @@ import java.util.Collection;
262
177
  import java.util.List;
263
178
  import java.util.Map;
264
179
 
265
- /**
266
- * XXX 服务实现
267
- *
268
- * @author Lion Li
269
- */
270
180
  @Service
271
181
  @RequiredArgsConstructor
272
182
  public class XxxServiceImpl implements IXxxService {
273
183
 
274
- private final XxxMapper baseMapper; // 直接注入 Mapper(NO DAO!)
184
+ private final XxxMapper baseMapper; // 直接注入 Mapper(无 DAO 层)
275
185
 
276
186
  @Override
277
187
  public XxxVo queryById(Long id) {
@@ -285,14 +195,14 @@ public class XxxServiceImpl implements IXxxService {
285
195
 
286
196
  @Override
287
197
  public TableDataInfo<XxxVo> queryPageList(XxxBo bo, PageQuery pageQuery) {
288
- LambdaQueryWrapper<Xxx> lqw = buildQueryWrapper(bo); // ✅ Service 层构建查询
198
+ LambdaQueryWrapper<Xxx> lqw = buildQueryWrapper(bo);
289
199
  Page<XxxVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
290
200
  return TableDataInfo.build(result);
291
201
  }
292
202
 
293
203
  @Override
294
204
  public Boolean insertByBo(XxxBo bo) {
295
- Xxx add = MapstructUtils.convert(bo, Xxx.class); // ✅ MapstructUtils 转换
205
+ Xxx add = MapstructUtils.convert(bo, Xxx.class);
296
206
  validEntityBeforeSave(add);
297
207
  return baseMapper.insert(add) > 0;
298
208
  }
@@ -315,42 +225,25 @@ public class XxxServiceImpl implements IXxxService {
315
225
  return baseMapper.deleteByIds(ids) > 0;
316
226
  }
317
227
 
318
- /**
319
- * 构建查询条件
320
- * ✅ Service 层直接构建(不是 DAO 层)
321
- */
322
228
  private LambdaQueryWrapper<Xxx> buildQueryWrapper(XxxBo bo) {
323
229
  Map<String, Object> params = bo.getParams();
324
230
  LambdaQueryWrapper<Xxx> lqw = Wrappers.lambdaQuery();
325
-
326
- // ✅ 精确匹配
327
231
  lqw.eq(bo.getId() != null, Xxx::getId, bo.getId());
328
232
  lqw.eq(StringUtils.isNotBlank(bo.getStatus()), Xxx::getStatus, bo.getStatus());
329
-
330
- // ✅ 模糊匹配
331
233
  lqw.like(StringUtils.isNotBlank(bo.getXxxName()), Xxx::getXxxName, bo.getXxxName());
332
-
333
- // ✅ 时间范围
334
234
  lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
335
235
  Xxx::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
336
-
337
- // ✅ 排序
338
236
  lqw.orderByAsc(Xxx::getId);
339
237
  return lqw;
340
238
  }
341
239
 
342
- /**
343
- * 保存前验证
344
- */
345
240
  private void validEntityBeforeSave(Xxx entity) {
346
241
  // TODO 做一些数据校验,如唯一约束
347
242
  }
348
243
  }
349
244
  ```
350
245
 
351
- ---
352
-
353
- ## 6. Mapper 接口(继承 BaseMapperPlus)
246
+ ## 6. Mapper
354
247
 
355
248
  ```java
356
249
  package org.dromara.demo.mapper;
@@ -359,17 +252,12 @@ import org.dromara.demo.domain.Xxx;
359
252
  import org.dromara.demo.domain.vo.XxxVo;
360
253
  import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
361
254
 
362
- /**
363
- * XXX Mapper 接口
364
- */
365
255
  public interface XxxMapper extends BaseMapperPlus<Xxx, XxxVo> {
366
- // 继承 BaseMapperPlus,已提供 selectVoById、selectVoPage、selectVoList 等方法
256
+ // 已提供 selectVoById、selectVoPage、selectVoList 等方法
367
257
  }
368
258
  ```
369
259
 
370
- ---
371
-
372
- ## 7. Controller 控制器(标准 RESTful 路径)
260
+ ## 7. Controller
373
261
 
374
262
  ```java
375
263
  package org.dromara.demo.controller;
@@ -396,41 +284,26 @@ import org.dromara.demo.domain.vo.XxxVo;
396
284
  import org.dromara.demo.domain.bo.XxxBo;
397
285
  import org.dromara.demo.service.IXxxService;
398
286
 
399
- /**
400
- * XXX 管理控制器
401
- */
402
287
  @Validated
403
288
  @RequiredArgsConstructor
404
289
  @RestController
405
290
  @RequestMapping("/demo/xxx")
406
- public class XxxController extends BaseController { // ✅ 继承 BaseController
291
+ public class XxxController extends BaseController {
407
292
 
408
293
  private final IXxxService xxxService;
409
294
 
410
- /**
411
- * 查询列表
412
- * ✅ RESTful 路径:/list(不是 /pageXxxs)
413
- */
414
295
  @SaCheckPermission("demo:xxx:list")
415
296
  @GetMapping("/list")
416
297
  public TableDataInfo<XxxVo> list(XxxBo bo, PageQuery pageQuery) {
417
298
  return xxxService.queryPageList(bo, pageQuery);
418
299
  }
419
300
 
420
- /**
421
- * 获取详情
422
- * ✅ RESTful 路径:/{id}(不是 /getXxx/{id})
423
- */
424
301
  @SaCheckPermission("demo:xxx:query")
425
302
  @GetMapping("/{id}")
426
303
  public R<XxxVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) {
427
304
  return R.ok(xxxService.queryById(id));
428
305
  }
429
306
 
430
- /**
431
- * 新增
432
- * ✅ POST 空路径
433
- */
434
307
  @SaCheckPermission("demo:xxx:add")
435
308
  @Log(title = "XXX管理", businessType = BusinessType.INSERT)
436
309
  @RepeatSubmit()
@@ -439,10 +312,6 @@ public class XxxController extends BaseController { // ✅ 继承 BaseControlle
439
312
  return toAjax(xxxService.insertByBo(bo));
440
313
  }
441
314
 
442
- /**
443
- * 修改
444
- * ✅ PUT 空路径
445
- */
446
315
  @SaCheckPermission("demo:xxx:edit")
447
316
  @Log(title = "XXX管理", businessType = BusinessType.UPDATE)
448
317
  @RepeatSubmit()
@@ -451,10 +320,6 @@ public class XxxController extends BaseController { // ✅ 继承 BaseControlle
451
320
  return toAjax(xxxService.updateByBo(bo));
452
321
  }
453
322
 
454
- /**
455
- * 删除
456
- * ✅ DELETE /{ids}
457
- */
458
323
  @SaCheckPermission("demo:xxx:remove")
459
324
  @Log(title = "XXX管理", businessType = BusinessType.DELETE)
460
325
  @DeleteMapping("/{ids}")
@@ -462,9 +327,6 @@ public class XxxController extends BaseController { // ✅ 继承 BaseControlle
462
327
  return toAjax(xxxService.deleteWithValidByIds(Arrays.asList(ids), true));
463
328
  }
464
329
 
465
- /**
466
- * 导出
467
- */
468
330
  @SaCheckPermission("demo:xxx:export")
469
331
  @Log(title = "XXX管理", businessType = BusinessType.EXPORT)
470
332
  @PostMapping("/export")
@@ -475,21 +337,14 @@ public class XxxController extends BaseController { // ✅ 继承 BaseControlle
475
337
  }
476
338
  ```
477
339
 
478
- ---
479
-
480
- ## 8. 数据库建表(SQL)
340
+ ## 8. 建表 SQL
481
341
 
482
342
  ```sql
483
- -- 表前缀:demo_(根据模块选择:sys_/demo_/workflow_ 等)
484
343
  CREATE TABLE demo_xxx (
485
- id BIGINT(20) NOT NULL COMMENT '主键 ID', -- ✅ 雪花 ID,不用 AUTO_INCREMENT
486
- tenant_id VARCHAR(20) DEFAULT '000000' COMMENT '租户 ID',
487
-
488
- -- 业务字段
344
+ id BIGINT(20) NOT NULL COMMENT '主键(雪花ID,不用AUTO_INCREMENT)',
345
+ tenant_id VARCHAR(20) DEFAULT '000000' COMMENT '租户ID',
489
346
  xxx_name VARCHAR(100) NOT NULL COMMENT '名称',
490
347
  status CHAR(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
491
-
492
- -- 审计字段(必须)
493
348
  create_dept BIGINT(20) DEFAULT NULL COMMENT '创建部门',
494
349
  create_by BIGINT(20) DEFAULT NULL COMMENT '创建人',
495
350
  create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
@@ -497,141 +352,58 @@ CREATE TABLE demo_xxx (
497
352
  update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
498
353
  remark VARCHAR(255) DEFAULT NULL COMMENT '备注',
499
354
  del_flag BIGINT(20) DEFAULT 0 COMMENT '删除标志(0正常 1已删除)',
500
-
501
355
  PRIMARY KEY (id)
502
356
  ) ENGINE=InnoDB COMMENT='XXX表';
503
357
  ```
504
358
 
505
359
  ---
506
360
 
507
- ## 架构对比
508
-
509
- ### 三层架构流程图
510
-
511
- ```
512
- 请求到达
513
-
514
- Controller (路由转发 + 权限检查 + 参数校验)
515
-
516
- Service (业务逻辑 + 查询构建 + 对象转换)
517
-
518
- Mapper (数据持久化)
519
-
520
- 数据库
521
- ```
522
-
523
- ### 关键差异
524
-
525
- | 环节 | 操作 | 位置 |
526
- |------|------|------|
527
- | **查询构建** | `buildQueryWrapper()` | **Service 层** ✅ |
528
- | **Mapper 注入** | 在 Service 中注入 | ✅ 直接注入 baseMapper |
529
- | **DAO 层** | 是否存在 | ❌ **不存在** |
530
- | **对象转换** | `MapstructUtils.convert()` | Service 层 |
531
- | **权限注解** | `@DataPermission` | Mapper 接口方法 |
532
-
533
- ---
534
-
535
361
  ## 常见错误速查
536
362
 
537
- ### ❌ 不要做
538
-
539
363
  ```java
540
- // 错误 1: 在 Service 层注入 DAO
541
- @Service
542
- public class XxxServiceImpl {
543
- private final IXxxDao xxxDao; // 本项目没有 DAO 层!
544
- }
545
-
546
- // 错误 2: 使用 BeanUtil
547
- BeanUtil.copyProperties(bo, entity); // ❌ 必须用 MapstructUtils.convert()
548
-
549
- // 错误 3: Service 继承基类
550
- public class XxxServiceImpl extends ServiceImpl<XxxMapper, Xxx> { // 不继承!
551
- }
552
-
553
- // 错误 4: 使用 @AutoMappers(复数)
554
- @AutoMappers({ // 本项目用单数 @AutoMapper
555
- @AutoMapper(target = Xxx.class)
556
- })
557
- public class XxxBo { }
558
-
559
- // 错误 5: 包名错误
560
- package org.dromara.xxx; // ❌ 必须是 org.dromara.xxx
561
-
562
- // 错误 6: 使用错误的路径格式
563
- @GetMapping("/pageXxxs") // ❌ 应该是 /list
564
- @GetMapping("/getXxx/{id}") // ❌ 应该是 /{id}
565
- ```
566
-
567
- ### ✅ 正确做法
568
-
569
- ```java
570
- // 正确 1: 直接在 Service 中注入 Mapper
571
- @Service
572
- @RequiredArgsConstructor
573
- public class XxxServiceImpl implements IXxxService {
574
- private final XxxMapper baseMapper; // ✅ 直接注入 Mapper
575
- }
576
-
577
- // 正确 2: 使用 MapstructUtils
578
- Xxx entity = MapstructUtils.convert(bo, Xxx.class); // ✅
579
-
580
- // 正确 3: Service 只实现接口
581
- public class XxxServiceImpl implements IXxxService { // ✅
582
-
583
- // 正确 4: 使用 @AutoMapper(单数)
584
- @AutoMapper(target = Xxx.class) // ✅
585
- public class XxxBo { }
586
-
587
- // 正确 5: 使用 org.dromara 包名
588
- package org.dromara.demo.service; // ✅
589
-
590
- // 正确 6: 使用标准 RESTful 路径
591
- @GetMapping("/list") // ✅
592
- @GetMapping("/{id}") // ✅
593
- @PostMapping
594
- @PutMapping
595
- @DeleteMapping("/{ids}")
364
+ // ---- 错误写法 ----
365
+ private final IXxxDao xxxDao; // 本项目没有 DAO 层
366
+ BeanUtil.copyProperties(bo, entity); // 必须用 MapstructUtils.convert()
367
+ class XxxServiceImpl extends ServiceImpl<...> {} // Service 不继承基类
368
+ @AutoMappers({@AutoMapper(...)}) // 用单数 @AutoMapper
369
+ @GetMapping("/pageXxxs") // 应该是 /list
370
+ @GetMapping("/getXxx/{id}") // 应该是 /{id}
371
+
372
+ // ---- 正确写法 ----
373
+ private final XxxMapper baseMapper; // 直接注入 Mapper
374
+ MapstructUtils.convert(bo, Xxx.class); // MapstructUtils 转换
375
+ class XxxServiceImpl implements IXxxService {} // 只实现接口
376
+ @AutoMapper(target = Xxx.class) // 单数注解
377
+ @GetMapping("/list") // RESTful 路径
378
+ @GetMapping("/{id}") // RESTful 路径
596
379
  ```
597
380
 
598
381
  ---
599
382
 
600
383
  ## 检查清单
601
384
 
602
- 生成代码前必须检查:
603
-
604
- - [ ] **包名是否是 `org.dromara.*`**?
605
- - [ ] **Service 是否只实现接口,不继承任何基类**?
606
- - [ ] **Service 是否直接注入 Mapper(无 DAO 层)**?
607
- - [ ] **buildQueryWrapper() 是否在 Service 层实现**?
608
- - [ ] **Entity 是否继承 `TenantEntity`**?
609
- - [ ] **BO 是否使用 `@AutoMapper`(单数)映射到 Entity**?
610
- - [ ] **VO 是否使用 `@AutoMapper` 映射**?
611
- - [ ] **是否使用 `MapstructUtils.convert()` 转换对象**?
612
- - [ ] **是否所有类型都先 import 再使用短类名**?
613
- - [ ] **Mapper 是否继承 `BaseMapperPlus<Entity, VO>`**?
614
- - [ ] **Controller 是否使用标准 RESTful 路径(/list、/{id} 等)**?
615
- - [ ] **是否使用了 `@DataPermission` 进行行级权限控制**?
616
- - [ ] **SQL 是否使用了 `del_flag`(非 `is_deleted`)**?
617
- - [ ] **主键是否使用雪花 ID(无 AUTO_INCREMENT)**?
618
- - [ ] **所有代码注释是否使用中文**?(Javadoc、行内注释、SQL 注释)
619
- - [ ] **SQL COMMENT 是否使用中文**?(禁止英文 COMMENT)
385
+ - [ ] 包名是 `org.dromara.*`?
386
+ - [ ] Service 只实现接口,不继承基类?
387
+ - [ ] Service 直接注入 Mapper(无 DAO)?
388
+ - [ ] `buildQueryWrapper()` 在 Service 层?
389
+ - [ ] Entity 继承 `TenantEntity`?
390
+ - [ ] BO 使用 `@AutoMapper`(单数)?
391
+ - [ ] 使用 `MapstructUtils.convert()` 转换?
392
+ - [ ] Mapper 继承 `BaseMapperPlus<Entity, VO>`?
393
+ - [ ] Controller 使用 RESTful 路径?
394
+ - [ ] SQL 使用 `del_flag`(0正常 1删除)?
395
+ - [ ] 主键使用雪花 ID(无 AUTO_INCREMENT)?
396
+ - [ ] 代码注释和 SQL COMMENT 使用中文?
620
397
 
621
398
  ---
622
399
 
623
400
  ## 参考实现
624
401
 
625
- 查看已有的完整实现:
626
-
627
- - **Entity 参考**: `org.dromara.demo.domain.TestDemo`
628
- - **BO 参考**: `org.dromara.demo.domain.bo.TestDemoBo`
629
- - **VO 参考**: `org.dromara.demo.domain.vo.TestDemoVo`
630
- - **Service 参考**: `org.dromara.demo.service.impl.TestDemoServiceImpl`
631
- - **Mapper 参考**: `org.dromara.demo.mapper.TestDemoMapper`
632
- - **Controller 参考**: `org.dromara.demo.controller.TestDemoController`
633
-
634
- **特别注意**:上述参考代码是本项目的标准实现,严格遵循三层架构(Service 直接调用 Mapper,无 DAO 层)。
635
-
636
-
637
- <!-- 抓蛙师 -->
402
+ | 类型 | 类名 |
403
+ |------|------|
404
+ | Entity | `org.dromara.demo.domain.TestDemo` |
405
+ | BO | `org.dromara.demo.domain.bo.TestDemoBo` |
406
+ | VO | `org.dromara.demo.domain.vo.TestDemoVo` |
407
+ | Service | `org.dromara.demo.service.impl.TestDemoServiceImpl` |
408
+ | Mapper | `org.dromara.demo.mapper.TestDemoMapper` |
409
+ | Controller | `org.dromara.demo.controller.TestDemoController` |