ai-engineering-init 1.3.3 → 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 (228) hide show
  1. package/.claude/hooks/skill-forced-eval.js +4 -1
  2. package/.claude/settings.json +3 -3
  3. package/.claude/skills/add-skill/SKILL.md +252 -116
  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 -325
  38. package/.claude/skills/leniu-report-customization/references/table-fields.md +93 -0
  39. package/.claude/skills/leniu-report-standard-customization/SKILL.md +328 -0
  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 +252 -116
  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 -325
  113. package/.codex/skills/leniu-report-customization/references/table-fields.md +93 -0
  114. package/.codex/skills/leniu-report-standard-customization/SKILL.md +328 -0
  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/rules/skill-activation.mdc +2 -0
  154. package/.cursor/skills/add-skill/SKILL.md +252 -116
  155. package/.cursor/skills/api-development/SKILL.md +83 -377
  156. package/.cursor/skills/architecture-design/SKILL.md +138 -632
  157. package/.cursor/skills/backend-annotations/SKILL.md +134 -506
  158. package/.cursor/skills/banana-image/SKILL.md +10 -3
  159. package/.cursor/skills/brainstorm/SKILL.md +103 -535
  160. package/.cursor/skills/bug-detective/SKILL.md +147 -1097
  161. package/.cursor/skills/bug-detective/references/error-patterns.md +242 -0
  162. package/.cursor/skills/code-patterns/SKILL.md +116 -426
  163. package/.cursor/skills/code-patterns/references/leniu-code-patterns.md +87 -0
  164. package/.cursor/skills/crud-development/SKILL.md +64 -304
  165. package/.cursor/skills/data-permission/SKILL.md +105 -412
  166. package/.cursor/skills/data-permission/references/custom-data-scope.md +90 -0
  167. package/.cursor/skills/file-oss-management/SKILL.md +106 -714
  168. package/.cursor/skills/file-oss-management/references/entities.md +105 -0
  169. package/.cursor/skills/file-oss-management/references/service-impl.md +104 -0
  170. package/.cursor/skills/git-workflow/SKILL.md +27 -5
  171. package/.cursor/skills/leniu-api-development/SKILL.md +142 -626
  172. package/.cursor/skills/leniu-api-development/references/real-examples.md +273 -0
  173. package/.cursor/skills/leniu-architecture-design/SKILL.md +176 -391
  174. package/.cursor/skills/leniu-backend-annotations/SKILL.md +132 -519
  175. package/.cursor/skills/leniu-brainstorm/SKILL.md +132 -541
  176. package/.cursor/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
  177. package/.cursor/skills/leniu-crud-development/SKILL.md +232 -938
  178. package/.cursor/skills/leniu-crud-development/references/templates.md +597 -0
  179. package/.cursor/skills/leniu-customization-location/SKILL.md +410 -0
  180. package/.cursor/skills/leniu-data-permission/SKILL.md +70 -0
  181. package/.cursor/skills/leniu-java-code-style/SKILL.md +510 -0
  182. package/.cursor/skills/leniu-java-entity/SKILL.md +76 -590
  183. package/.cursor/skills/leniu-java-entity/references/templates.md +237 -0
  184. package/.cursor/skills/leniu-java-export/SKILL.md +94 -379
  185. package/.cursor/skills/leniu-java-logging/SKILL.md +106 -709
  186. package/.cursor/skills/leniu-java-logging/references/data-mask.md +46 -0
  187. package/.cursor/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
  188. package/.cursor/skills/leniu-java-mybatis/SKILL.md +73 -446
  189. package/.cursor/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
  190. package/.cursor/skills/leniu-report-customization/SKILL.md +111 -325
  191. package/.cursor/skills/leniu-report-customization/references/table-fields.md +93 -0
  192. package/.cursor/skills/leniu-report-standard-customization/SKILL.md +328 -0
  193. package/.cursor/skills/leniu-report-standard-customization/references/analysis-module.md +64 -0
  194. package/.cursor/skills/leniu-report-standard-customization/references/table-fields.md +113 -0
  195. package/.cursor/skills/leniu-security-guard/SKILL.md +133 -347
  196. package/.cursor/skills/mysql-debug/SKILL.md +364 -0
  197. package/.cursor/skills/openspec-apply-change/SKILL.md +10 -1
  198. package/.cursor/skills/openspec-archive-change/SKILL.md +9 -1
  199. package/.cursor/skills/openspec-bulk-archive-change/SKILL.md +9 -1
  200. package/.cursor/skills/openspec-continue-change/SKILL.md +9 -1
  201. package/.cursor/skills/openspec-explore/SKILL.md +10 -1
  202. package/.cursor/skills/openspec-ff-change/SKILL.md +9 -1
  203. package/.cursor/skills/openspec-new-change/SKILL.md +9 -1
  204. package/.cursor/skills/openspec-onboard/SKILL.md +15 -130
  205. package/.cursor/skills/openspec-sync-specs/SKILL.md +9 -1
  206. package/.cursor/skills/openspec-verify-change/SKILL.md +9 -1
  207. package/.cursor/skills/performance-doctor/SKILL.md +110 -434
  208. package/.cursor/skills/redis-cache/SKILL.md +89 -595
  209. package/.cursor/skills/redis-cache/references/listeners.md +23 -0
  210. package/.cursor/skills/scheduled-jobs/SKILL.md +88 -407
  211. package/.cursor/skills/security-guard/SKILL.md +137 -532
  212. package/.cursor/skills/security-guard/references/encrypt-config.md +103 -0
  213. package/.cursor/skills/security-guard/references/sensitive-strategies.md +42 -0
  214. package/.cursor/skills/sms-mail/SKILL.md +116 -574
  215. package/.cursor/skills/sms-mail/references/mail-config.md +88 -0
  216. package/.cursor/skills/sms-mail/references/sms-config.md +74 -0
  217. package/.cursor/skills/social-login/SKILL.md +112 -514
  218. package/.cursor/skills/social-login/references/provider-configs.md +118 -0
  219. package/.cursor/skills/tenant-management/SKILL.md +129 -444
  220. package/.cursor/skills/tenant-management/references/tenant-scenarios.md +91 -0
  221. package/.cursor/skills/test-development/SKILL.md +86 -540
  222. package/.cursor/skills/test-development/references/parameterized-examples.md +119 -0
  223. package/.cursor/skills/utils-toolkit/SKILL.md +52 -305
  224. package/.cursor/skills/utils-toolkit/references/redis-utils-api.md +56 -0
  225. package/.cursor/skills/websocket-sse/SKILL.md +105 -550
  226. package/.cursor/skills/workflow-engine/SKILL.md +147 -502
  227. package/AGENTS.md +1 -0
  228. package/package.json +1 -1
@@ -7,8 +7,8 @@ description: |
7
7
  - 查看项目禁止事项(后端代码)
8
8
  - 命名规范速查
9
9
  - Git 提交规范
10
- - 避免过度工程
11
10
  - 代码风格检查
11
+ - 避免过度工程
12
12
 
13
13
  触发词:规范、禁止、命名、Git提交、代码风格、不能用、不允许、包名、架构
14
14
 
@@ -17,94 +17,60 @@ description: |
17
17
 
18
18
  # 代码规范速查
19
19
 
20
- ## 🚫 后端禁令速查表
21
-
22
- > **快速查表**:一眼定位所有后端代码禁止写法
23
-
24
- | 禁止项 | 禁止写法 | 正确写法 | 原因 |
25
- |--------|-----------|-----------|------|
26
- | 包名规范 | `com.ruoyi.*` `plus.ruoyi.*` | `org.dromara.*` | 包名统一标准 |
27
- | 完整引用 | `org.dromara.xxx.Xxx` (内联全限定名) | `import` + 短类名 | 代码整洁 |
28
- | 数据返回 | `Map<String, Object>` 返回业务数据 | 创建 VO | 类型安全 |
29
- | Service设计 | `extends ServiceImpl<>` | `implements IXxxService` | 三层架构 |
30
- | 查询构建 | Controller 层构建 | **Service 层** `buildQueryWrapper()` | 职责分离 |
31
- | 接口路径 | `/pageXxxs`, `/getXxx/{id}` | `/list`, `/{id}`, `/` | RESTful 规范 |
32
- | 对象转换 | `BeanUtil.copyProperties()` | `MapstructUtils.convert()` | 项目统一规范 |
33
- | 主键策略 | `AUTO_INCREMENT` | 雪花ID(不指定type) | 主键策略规范 |
34
- | 返回String陷阱 | `R.ok(stringValue)` 返回字符串到data | `R.ok(null, stringValue)` | 方法重载陷阱 |
35
- | Entity基类 | 无基类继承 | `extends TenantEntity`(业务表)或 `extends BaseEntity`(系统表) | 多租户支持 |
36
- | Redis缓存 | `@Cacheable` 返回 `List.of()`/`Set.of()` | `new ArrayList<>(List.of())` | Redis 反序列化失败 |
37
- | Mapper注解 | 单目标用 `@AutoMappers`(复数) | 单目标用 `@AutoMapper`(单数) | 多目标时可用复数 |
38
- | Bash命令 | `> nul` | `> /dev/null 2>&1` | Windows 会创建 nul 文件 |
39
- | 注释语言 | 英文注释 `// get user name` | 中文注释 `// 获取用户名` | 项目统一中文 |
40
- | SQL COMMENT | `COMMENT 'user name'` | `COMMENT '用户名'` | 项目统一中文 |
20
+ ## 后端禁令速查表
21
+
22
+ | # | 禁止项 | 错误写法 | 正确写法 |
23
+ |---|--------|---------|---------|
24
+ | 1 | 包名 | `com.ruoyi.*` / `plus.ruoyi.*` | `org.dromara.*` |
25
+ | 2 | 完整引用 | `org.dromara.xxx.Xxx` 内联 | `import` + 短类名 |
26
+ | 3 | 数据返回 | `Map<String, Object>` | 创建 VO |
27
+ | 4 | Service设计 | `extends ServiceImpl<>` | `implements IXxxService` |
28
+ | 5 | 查询构建 | Controller | **Service 层** `buildQueryWrapper()` |
29
+ | 6 | 接口路径 | `/pageXxxs`, `/getXxx/{id}` | `/list`, `/{id}`, `/` |
30
+ | 7 | 对象转换 | `BeanUtil.copyProperties()` | `MapstructUtils.convert()` |
31
+ | 8 | 主键 | `AUTO_INCREMENT` | 雪花ID(不指定type) |
32
+ | 9 | R.ok(string) | `R.ok(token)` | `R.ok(null, token)` |
33
+ | 10 | Entity基类 | 无基类 | `extends TenantEntity` / `BaseEntity` |
34
+ | 11 | @Cacheable | 返回 `List.of()`/`Set.of()` | `new ArrayList<>(List.of())` |
35
+ | 12 | Mapper注解 | 单目标用 `@AutoMappers` | 单目标用 `@AutoMapper` |
36
+ | 13 | 注释语言 | 英文注释 | **中文注释** |
37
+ | 14 | SQL COMMENT | `COMMENT 'user name'` | `COMMENT '用户名'` |
41
38
 
42
39
  ---
43
40
 
44
- ## 🚫 后端禁令(14 条)
41
+ ## 禁令详解
45
42
 
46
- ### 1. 包名必须是 `org.dromara.*`
43
+ ### 1-2. 包名与引用
47
44
 
48
45
  ```java
49
- // ✅ 正确
46
+ // ✅
50
47
  package org.dromara.system.service;
51
- package org.dromara.demo.controller;
52
-
53
- // ❌ 错误
54
- package com.ruoyi.system.service;
55
- package plus.ruoyi.business.service;
56
- ```
57
-
58
- ### 2. 禁止使用完整类型引用
59
-
60
- ```java
61
- // ✅ 正确:先 import 再使用
62
48
  import org.dromara.common.core.domain.R;
63
49
  public R<XxxVo> getXxx(Long id) { ... }
64
50
 
65
- // ❌ 错误:直接使用完整包名
51
+ // ❌
52
+ package com.ruoyi.system.service;
66
53
  public org.dromara.common.core.domain.R<XxxVo> getXxx(Long id) { ... }
67
54
  ```
68
55
 
69
- ### 3. 禁止使用 Map 封装业务数据
56
+ ### 3. 禁止 Map 传业务数据
70
57
 
71
58
  ```java
72
- // ✅ 正确:创建 VO 类
59
+ // ✅ 创建 VO 类
73
60
  public XxxVo getXxx(Long id) {
74
61
  return MapstructUtils.convert(entity, XxxVo.class);
75
62
  }
76
63
 
77
- // ❌ 错误:使用 Map
78
- public Map<String, Object> getXxx(Long id) {
79
- Map<String, Object> result = new HashMap<>();
80
- result.put("id", entity.getId());
81
- return result;
82
- }
64
+ // ❌
65
+ public Map<String, Object> getXxx(Long id) { ... }
83
66
  ```
84
67
 
85
- ### 4. Service 禁止继承 ServiceImpl 基类
68
+ ### 4-5. Service 架构
86
69
 
87
70
  ```java
88
- // ✅ 正确:不继承任何基类,直接注入 Mapper
71
+ // ✅ 三层架构:不继承 ServiceImpl,直接注入 Mapper
89
72
  @Service
90
73
  public class XxxServiceImpl implements IXxxService {
91
- private final XxxMapper baseMapper; // 直接注入 Mapper
92
- }
93
-
94
- // ❌ 错误:继承 ServiceImpl
95
- public class XxxServiceImpl extends ServiceImpl<XxxMapper, Xxx> {
96
- }
97
- ```
98
-
99
- ### 5. 查询条件必须在 Service 层构建
100
-
101
- > **本项目是三层架构(无 DAO 层)**,`buildQueryWrapper()` 在 **Service 实现类**中。
102
-
103
- ```java
104
- // ✅ 正确:在 Service 层构建查询条件
105
- @Service
106
- public class XxxServiceImpl implements IXxxService {
107
-
108
74
  private final XxxMapper baseMapper;
109
75
 
110
76
  private LambdaQueryWrapper<Xxx> buildQueryWrapper(XxxBo bo) {
@@ -113,253 +79,142 @@ public class XxxServiceImpl implements IXxxService {
113
79
  lqw.like(StringUtils.isNotBlank(bo.getName()), Xxx::getName, bo.getName());
114
80
  return lqw;
115
81
  }
116
-
117
- @Override
118
- public TableDataInfo<XxxVo> queryPageList(XxxBo bo, PageQuery pageQuery) {
119
- LambdaQueryWrapper<Xxx> lqw = buildQueryWrapper(bo);
120
- Page<XxxVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
121
- return TableDataInfo.build(result);
122
- }
123
82
  }
124
83
 
125
- // ❌ 错误:在 Controller 层构建查询条件
126
- @RestController
127
- public class XxxController {
128
- @GetMapping("/list")
129
- public R<List<XxxVo>> list(XxxBo bo) {
130
- LambdaQueryWrapper<Xxx> wrapper = new LambdaQueryWrapper<>(); // 禁止!
131
- wrapper.eq(Xxx::getStatus, bo.getStatus());
132
- }
133
- }
84
+ // ❌
85
+ public class XxxServiceImpl extends ServiceImpl<XxxMapper, Xxx> { }
134
86
  ```
135
87
 
136
- ### 6. 接口路径必须使用标准 RESTful 格式
88
+ ### 6. RESTful 路径
137
89
 
138
90
  ```java
139
- // ✅ 正确:标准 RESTful 路径
140
- @GetMapping("/list") // 分页/列表查询
141
- @GetMapping("/{id}") // 获取详情
142
- @PostMapping // 新增(空路径)
143
- @PutMapping // 修改(空路径)
144
- @DeleteMapping("/{ids}") // 删除
145
- @PostMapping("/export") // 导出
146
-
147
- // ❌ 错误:包含动词或实体名
148
- @GetMapping("/pageAds")
149
- @GetMapping("/getAd/{id}")
150
- @PostMapping("/addAd")
151
- @PutMapping("/updateAd")
91
+ // ✅
92
+ @GetMapping("/list") @GetMapping("/{id}")
93
+ @PostMapping @PutMapping
94
+ @DeleteMapping("/{ids}") @PostMapping("/export")
95
+
96
+ //
97
+ @GetMapping("/pageAds") @GetMapping("/getAd/{id}")
98
+ @PostMapping("/addAd") @PutMapping("/updateAd")
152
99
  ```
153
100
 
154
- ### 7. 禁止使用 BeanUtil 进行对象转换
101
+ ### 7. 对象转换
155
102
 
156
103
  ```java
157
- // ✅ 正确:使用 MapstructUtils
104
+ // ✅ MapstructUtils
158
105
  XxxVo vo = MapstructUtils.convert(entity, XxxVo.class);
159
106
  List<XxxVo> voList = MapstructUtils.convert(entityList, XxxVo.class);
160
107
 
161
- // ❌ 错误:使用 BeanUtil
162
- BeanUtil.copyProperties(entity, vo); // 禁止!
163
- BeanUtils.copyProperties(entity, vo); // 禁止!
108
+ // ❌ BeanUtil
109
+ BeanUtil.copyProperties(entity, vo);
164
110
  ```
165
111
 
166
- ### 8. 禁止使用 AUTO_INCREMENT
112
+ ### 8. 主键策略
167
113
 
168
114
  ```sql
169
- -- ✅ 正确:不指定自增,使用雪花ID(MyBatis-Plus 全局配置)
115
+ -- ✅ 雪花ID
170
116
  id BIGINT(20) NOT NULL COMMENT '主键ID'
171
117
 
172
- -- ❌ 错误:使用自增
173
- id BIGINT(20) AUTO_INCREMENT -- 禁止!
118
+ -- ❌
119
+ id BIGINT(20) AUTO_INCREMENT
174
120
  ```
175
121
 
176
- ### 9. R.ok() 返回 String 类型的陷阱
122
+ ### 9. R.ok() 返回 String 陷阱
177
123
 
178
124
  ```java
179
- // 场景:Controller 返回 R<String>,想把字符串放到 data
180
-
181
- // ❌ 错误:会匹配 R.ok(String msg),字符串进入 msg 而非 data
182
- return R.ok(token); // 结果:{code:200, msg:"xxx", data:null}
125
+ // 匹配 R.ok(String msg),字符串进入 msg 而非 data
126
+ return R.ok(token); // {code:200, msg:"xxx", data:null}
183
127
 
184
- // ✅ 正确:明确指定 msg 和 data
185
- return R.ok(null, token); // data 有值,msgnull
186
- return R.ok("获取成功", token); // msg 和 data 都有值
128
+ // ✅ 明确指定
129
+ return R.ok(null, token); // data=token, msg=null
130
+ return R.ok("获取成功", token); // 都有值
187
131
  ```
188
132
 
189
- ### 10. Entity 必须继承合适的基类
133
+ ### 10. Entity 基类
190
134
 
191
135
  ```java
192
- // ✅ 正确:业务表(需要多租户隔离)继承 TenantEntity
193
- @Data
194
- @EqualsAndHashCode(callSuper = true)
195
- @TableName("xxx_table")
196
- public class Xxx extends TenantEntity { // ✅ 业务表推荐
136
+ // ✅ 业务表(需多租户隔离)
137
+ public class Xxx extends TenantEntity {
197
138
  @TableId(value = "id")
198
139
  private Long id;
199
140
  }
200
141
 
201
- // ✅ 正确:系统级/工具级表(不需要多租户)继承 BaseEntity
202
- // 例如:SysClient(OAuth2客户端)、GenTable(代码生成)
203
- @Data
204
- @EqualsAndHashCode(callSuper = true)
205
- @TableName("sys_client")
206
- public class SysClient extends BaseEntity { // ✅ 系统表可用
207
- @TableId(value = "id")
208
- private Long id;
209
- }
142
+ // ✅ 系统表(不需多租户)
143
+ public class SysClient extends BaseEntity { }
210
144
 
211
- // ❌ 错误:不继承任何基类
212
- public class Xxx { // 禁止!缺少审计字段
213
- }
145
+ // ❌ 不继承基类
146
+ public class Xxx { }
214
147
  ```
215
148
 
216
- ### 11. @Cacheable 禁止返回不可变集合
149
+ ### 11. @Cacheable 不可变集合
217
150
 
218
151
  ```java
219
- // ❌ 错误:List.of()/Set.of()/Map.of() 返回不可变集合
220
- // 会导致 Redis 反序列化失败(Jackson DefaultTyping 无法正确处理)
221
- @Cacheable(value = "xxx")
222
- public List<String> listXxx() {
223
- return List.of("1", "2"); // 禁止!第二次请求会报错
224
- return Set.of("a", "b"); // 禁止!
225
- return Map.of("k", "v"); // 禁止!
226
- }
227
-
228
- // ✅ 正确:使用可变集合包装
152
+ // ❌ Redis 反序列化失败
229
153
  @Cacheable(value = "xxx")
230
- public List<String> listXxx() {
231
- return new ArrayList<>(List.of("1", "2")); // ✅
232
- }
233
-
234
- @Cacheable(value = "xxx")
235
- public Set<String> setXxx() {
236
- return new HashSet<>(Set.of("a", "b")); // ✅
237
- }
154
+ public List<String> listXxx() { return List.of("1", "2"); }
238
155
 
156
+ // ✅ 可变集合包装
239
157
  @Cacheable(value = "xxx")
240
- public Map<String, String> mapXxx() {
241
- return new HashMap<>(Map.of("k", "v")); // ✅
242
- }
158
+ public List<String> listXxx() { return new ArrayList<>(List.of("1", "2")); }
243
159
  ```
244
160
 
245
- **原因**:本项目 Redis 使用 `Jackson DefaultTyping.NON_FINAL`,会为非 final 类添加类型信息。`List.of()` 返回的 `ImmutableCollections$List12` 是非 final 类,序列化后反序列化时会将内层元素误判为类型数组,导致 `ClassNotFoundException`。
161
+ > **原因**:Jackson DefaultTyping.NON_FINAL 会为 `ImmutableCollections$List12` 添加类型信息,反序列化时导致 `ClassNotFoundException`。
246
162
 
247
- ### 12. BO 映射注解规范
163
+ ### 12. BO 映射注解
248
164
 
249
165
  ```java
250
- // ✅ 正确:单目标映射使用 @AutoMapper(单数)
251
- @Data
166
+ // ✅ 单目标:@AutoMapper
252
167
  @AutoMapper(target = Xxx.class, reverseConvertGenerate = false)
253
- public class XxxBo {
254
- // ...
255
- }
168
+ public class XxxBo { }
256
169
 
257
- // ✅ 正确:多目标映射使用 @AutoMappers(复数)
258
- // 例如 SysOperLogBo 需要映射到 SysOperLog 和 OperLogEvent 两个目标
170
+ // ✅ 多目标:@AutoMappers
259
171
  @AutoMappers({
260
172
  @AutoMapper(target = SysOperLog.class, reverseConvertGenerate = false),
261
173
  @AutoMapper(target = OperLogEvent.class)
262
174
  })
263
- public class SysOperLogBo {
264
- // ...
265
- }
266
-
267
- // ❌ 错误:单目标时使用 @AutoMappers 包装(冗余)
268
- @AutoMappers({
269
- @AutoMapper(target = Xxx.class)
270
- })
271
- public class XxxBo {
272
- // ...
273
- }
175
+ public class SysOperLogBo { }
274
176
  ```
275
177
 
276
- ### 13. 代码注释必须使用中文
277
-
278
- > **⚠️ 高频问题**:Codex/Gemini 协作时经常输出英文注释,必须检查并修正。
178
+ ### 13-14. 中文注释与 SQL COMMENT
279
179
 
280
180
  ```java
281
- // ✅ 正确:中文注释
282
- /**
283
- * 根据 ID 查询用户信息
284
- *
285
- * @param id 用户 ID
286
- * @return 用户视图对象
287
- */
181
+ // ✅ 中文注释
182
+ /** 根据 ID 查询用户信息 */
288
183
  public SysUserVo queryById(Long id) {
289
184
  // 查询用户基本信息
290
185
  return baseMapper.selectVoById(id);
291
186
  }
292
187
 
293
- // ❌ 错误:英文注释
294
- /**
295
- * Query user info by ID
296
- *
297
- * @param id user ID
298
- * @return user view object
299
- */
300
- public SysUserVo queryById(Long id) {
301
- // query user basic info
302
- return baseMapper.selectVoById(id);
303
- }
188
+ // ❌ 英文注释
189
+ /** Query user info by ID */
304
190
  ```
305
191
 
306
- **适用范围**:
307
- - Javadoc 注释(`/** */`)
308
- - 行内注释(`//`)
309
- - 块注释(`/* */`)
310
- - `@param`、`@return`、`@throws` 的描述文本
311
- - SQL 注释(`--`)
312
-
313
- **不适用**(保持英文):
314
- - 变量名、方法名、类名(遵循 Java 命名规范)
315
- - 注解属性值(如 `@TableName("sys_user")`)
316
- - 日志中的英文关键词(如 `log.error("Failed to...")`,但建议也用中文)
317
-
318
- ### 14. SQL COMMENT 必须使用中文
319
-
320
192
  ```sql
321
- -- ✅ 正确:中文 COMMENT
193
+ -- ✅
322
194
  `user_name` VARCHAR(50) NOT NULL COMMENT '用户名',
323
- `status` CHAR(1) DEFAULT '0' COMMENT '状态(0正常 1停用)',
324
195
  ) ENGINE=InnoDB COMMENT='用户信息表';
325
196
 
326
- -- ❌ 错误:英文 COMMENT(⚠️ Codex 高频错误)
197
+ -- ❌
327
198
  `user_name` VARCHAR(50) NOT NULL COMMENT 'user name',
328
- `status` CHAR(1) DEFAULT '0' COMMENT 'status(0=normal 1=disabled)',
329
- ) ENGINE=InnoDB COMMENT='user info table';
330
199
  ```
331
200
 
332
201
  ---
333
202
 
334
- ## 📝 命名规范速查
335
-
336
- ### 后端命名
337
-
338
- | 类型 | 规范 | 示例 |
339
- |------|------|------|
340
- | 包名 | 小写,点分隔 | `org.dromara.system` |
341
- | 类名 | 大驼峰 | `SysUserServiceImpl` |
342
- | 方法名 | 小驼峰 | `queryPageList`, `selectById` |
343
- | 变量名 | 小驼峰 | `userName`, `createTime` |
344
- | 常量 | 全大写下划线 | `MAX_PAGE_SIZE` |
345
- | 表名 | 小写下划线 | `sys_user`, `test_demo` |
346
- | 字段名 | 小写下划线 | `user_name`, `create_time` |
347
-
348
- ### 类命名后缀
203
+ ## 命名后缀规范
349
204
 
350
205
  | 类型 | 后缀 | 示例 |
351
206
  |------|------|------|
352
207
  | 实体类 | 无/Sys前缀 | `SysUser`, `TestDemo` |
353
- | 业务对象 | Bo | `SysUserBo`, `TestDemoBo` |
354
- | 视图对象 | Vo | `SysUserVo`, `TestDemoVo` |
208
+ | 业务对象 | Bo | `SysUserBo` |
209
+ | 视图对象 | Vo | `SysUserVo` |
355
210
  | 服务接口 | IXxxService | `ISysUserService` |
356
211
  | 服务实现 | XxxServiceImpl | `SysUserServiceImpl` |
357
212
  | 控制器 | XxxController | `SysUserController` |
358
213
  | Mapper | XxxMapper | `SysUserMapper` |
359
214
 
360
- > **注意**:本项目是三层架构,没有 DAO 层。Service 直接注入 Mapper。
215
+ > 本项目是三层架构,没有 DAO 层。Service 直接注入 Mapper。
361
216
 
362
- ### 方法命名
217
+ ## 方法命名
363
218
 
364
219
  | 操作 | Service 方法 | Controller URL |
365
220
  |------|-------------|----------------|
@@ -372,219 +227,54 @@ public SysUserVo queryById(Long id) {
372
227
 
373
228
  ---
374
229
 
375
- ## 避免过度工程
376
-
377
- ### 不要做的事
378
-
379
- 1. **不要创建不必要的抽象**
380
- - 只有一处使用的代码不需要抽取
381
- - 三处以上相同代码才考虑抽取
382
-
383
- 2. **不要添加不需要的功能**
384
- - 只实现当前需求
385
- - 不要"以防万一"添加功能
386
-
387
- 3. **不要过早优化**
388
- - 优先使用简单直接的方案
389
- - 复杂方案需要有明确理由
390
-
391
- 4. **不要添加无用注释**
392
- - 不要给显而易见的代码加注释
393
- - 只在逻辑复杂处添加注释
394
-
395
- 5. **不要保留废弃代码**
396
- - 删除不用的代码,不要注释保留
397
- - Git 有历史记录
398
-
399
- ---
400
-
401
- ## 📦 Git 提交规范
402
-
403
- ### 格式
230
+ ## Git 提交规范
404
231
 
405
232
  ```
406
233
  <type>(<scope>): <description>
407
234
  ```
408
235
 
409
- ### 类型
410
-
411
- | type | 说明 |
412
- |------|------|
413
- | `feat` | 新功能 |
414
- | `fix` | 修复 Bug |
415
- | `docs` | 文档更新 |
416
- | `style` | 代码格式(不影响逻辑) |
417
- | `refactor` | 重构(不是新功能或修复) |
418
- | `perf` | 性能优化 |
419
- | `test` | 测试 |
420
- | `chore` | 构建/工具 |
421
-
422
- ### 示例
423
-
424
- ```bash
425
- feat(system): 新增用户反馈功能
426
- fix(demo): 修复订单状态显示错误
427
- docs(readme): 更新安装说明
428
- refactor(common): 重构分页查询工具类
429
- perf(system): 优化用户列表查询性能
430
- ```
431
-
432
- ---
433
-
434
- ## 🔗 相关 Skill
435
-
436
- | 需要了解 | 激活 Skill |
437
- |---------|-----------|
438
- | 后端 CRUD 开发规范 | `crud-development` |
439
- | API 开发规范 | `api-development` |
440
- | 数据库设计规范 | `database-ops` |
441
- | 系统架构设计 | `architecture-design` |
442
- | 技术方案决策 | `tech-decision` |
443
-
444
- ---
445
-
446
- ## 多项目适配说明
447
-
448
- ### 不同项目代码模式对比
449
-
450
- | 项目特征 | RuoYi-Vue-Plus | leniu-tengyun-core |
451
- |---------|----------------|-------------------|
452
- | **包名前缀** | `org.dromara.*` | `net.xnzn.core.*` |
453
- | **JDK 版本** | 17 | 21 |
454
- | **Validation** | `jakarta.validation.*` | `jakarta.validation.*` |
455
- | **工具库** | 自定义工具类 | Hutool (CollUtil, ObjectUtil, BeanUtil) |
456
- | **分页** | `TableDataInfo<T>` | `Page<T>` |
457
- | **对象转换** | `MapstructUtils.convert()` | `BeanUtil.copyProperties()` |
458
-
459
- ### 通用代码规范
460
-
461
- 无论使用哪种项目架构,以下规范都是通用的:
462
-
463
- 1. **禁止使用 `SELECT *`**:明确指定字段
464
- 2. **使用参数化查询**:`#{}` 而非 `${}`
465
- 3. **异常必须处理**:不能吞掉异常
466
- 4. **日志使用占位符**:`log.info("msg: {}", value)`
467
- 5. **敏感信息脱敏**:不记录密码、身份证等
468
- 6. **集合判空**:使用 `CollUtil.isEmpty()` 或类似方法
469
- 7. **空指针防护**:使用 `Optional` 或 `ObjectUtil.isNull()`
470
-
471
- ### Hutool 工具类速查
472
-
473
- ```java
474
- // 集合判空
475
- if (CollUtil.isEmpty(list)) { }
476
- if (CollUtil.isNotEmpty(list)) { }
477
-
478
- // 对象判空
479
- if (ObjectUtil.isNull(obj)) { }
480
- if (ObjectUtil.isNotNull(obj)) { }
481
-
482
- // 字符串判空
483
- if (StrUtil.isBlank(str)) { }
484
- if (StrUtil.isNotBlank(str)) { }
485
-
486
- // 对象拷贝
487
- Target target = BeanUtil.copyProperties(source, Target.class);
488
- List<Target> targets = BeanUtil.copyToList(sources, Target.class);
489
- ```
236
+ | type | 说明 | 示例 |
237
+ |------|------|------|
238
+ | `feat` | 新功能 | `feat(system): 新增用户反馈功能` |
239
+ | `fix` | 修复 | `fix(demo): 修复订单状态显示错误` |
240
+ | `refactor` | 重构 | `refactor(common): 重构分页查询工具类` |
241
+ | `perf` | 性能 | `perf(system): 优化用户列表查询性能` |
242
+ | `docs` | 文档 | `docs(readme): 更新安装说明` |
243
+ | `style` | 格式 | `chore` 构建/工具 | `test` 测试 |
490
244
 
491
245
  ---
492
246
 
493
- ## leniu-tengyun-core 代码模式
494
-
495
- ### Hutool 工具类完整用法
247
+ ## 多项目适配
496
248
 
497
- ```java
498
- import cn.hutool.core.collection.CollUtil;
499
- import cn.hutool.core.util.ObjectUtil;
500
- import cn.hutool.core.util.StrUtil;
501
- import cn.hutool.core.bean.BeanUtil;
502
-
503
- // 1. 集合操作
504
- if (CollUtil.isEmpty(list)) {
505
- throw new LeException("列表不能为空");
506
- }
507
- if (CollUtil.isNotEmpty(list)) {
508
- // 处理列表
509
- }
249
+ | 特征 | RuoYi-Vue-Plus | leniu-tengyun-core |
250
+ |------|----------------|-------------------|
251
+ | 包名 | `org.dromara.*` | `net.xnzn.core.*` |
252
+ | JDK | 17 | 21 |
253
+ | 对象转换 | `MapstructUtils.convert()` | `BeanUtil.copyProperties()` |
254
+ | 分页 | `TableDataInfo<T>` | `Page<T>` |
255
+ | 异常 | `ServiceException` | `LeException` |
256
+ | 工具库 | 自定义工具类 | Hutool |
510
257
 
511
- // 2. 对象判空
512
- if (ObjectUtil.isNull(user)) {
513
- throw new LeException("用户不存在");
514
- }
515
- if (ObjectUtil.isNotNull(user)) {
516
- // 处理用户
517
- }
518
-
519
- // 3. 字符串操作
520
- if (StrUtil.isBlank(name)) {
521
- throw new LeException("名称不能为空");
522
- }
523
- String trimmed = StrUtil.trim(name);
524
- String joined = StrUtil.join(",", list);
525
-
526
- // 4. 对象拷贝
527
- TargetDTO target = BeanUtil.copyProperties(source, TargetDTO.class);
528
- List<TargetDTO> targets = BeanUtil.copyToList(sources, TargetDTO.class);
529
-
530
- // 5. 集合创建
531
- List<String> list = CollUtil.newArrayList("a", "b", "c");
532
- Map<String, Object> map = CollUtil.newHashMap();
533
- ```
534
-
535
- ### 国际化消息
258
+ ### leniu-tengyun-core 专用
536
259
 
537
260
  ```java
538
- import net.xnzn.core.common.i18n.I18n;
539
-
540
- // RuoYi-Vue-Plus 风格
541
- throw new ServiceException(MessageUtils.message("user.not.exists"));
542
-
543
- // leniu-tengyun-core 风格
261
+ // 国际化
544
262
  throw new LeException(I18n.getMessage("user.not.exists"));
545
263
 
546
- // 带参数的国际化
547
- throw new LeException(I18n.getMessage("user.password.retry.limit.exceed", maxRetryCount));
548
- ```
549
-
550
- ### 租户上下文
551
-
552
- ```java
553
- import net.xnzn.core.context.TenantContextHolder;
554
-
555
- // 获取当前租户ID
264
+ // 租户上下文
556
265
  Long tenantId = TenantContextHolder.getTenantId();
557
266
 
558
- // 设置租户ID
559
- TenantContextHolder.setTenantId(tenantId);
560
-
561
- // 清除租户上下文
562
- TenantContextHolder.clear();
267
+ // 分页
268
+ PageMethod.startPage(param.getPage().getPageNum(), param.getPage().getPageSize());
563
269
  ```
564
270
 
565
- ### 分页参数处理
566
-
567
- ```java
568
- // leniu-tengyun-core 风格
569
- @Data
570
- public class XxxQueryParam implements Serializable {
571
- @ApiModelProperty(value = "分页参数", required = true)
572
- @NotNull(message = "分页参数不能为空")
573
- private PageDTO page;
574
-
575
- @ApiModelProperty("关键字")
576
- private String keyword;
577
-
578
- @ApiModelProperty("状态")
579
- private Integer status;
580
- }
271
+ ---
581
272
 
582
- // Service 层处理
583
- public Page<XxxVO> pageList(XxxQueryParam param) {
584
- // 使用 PageHelper 分页
585
- PageMethod.startPage(param.getPage().getPageNum(), param.getPage().getPageSize());
273
+ ## 相关 Skill
586
274
 
587
- List<XxxEntity> list = xxxMapper.selectList(buildWrapper(param));
588
- return new Page<>(list);
589
- }
590
- ```
275
+ | 需要了解 | 激活 Skill |
276
+ |---------|-----------|
277
+ | 后端 CRUD 开发 | `crud-development` |
278
+ | API 开发 | `api-development` |
279
+ | 数据库设计 | `database-ops` |
280
+ | 系统架构 | `architecture-design` |