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
@@ -0,0 +1,510 @@
1
+ ---
2
+ name: leniu-java-code-style
3
+ description: |
4
+ leniu-tengyun-core 项目代码风格和命名规范。当编写或生成 Java 代码时使用此 skill,适用于所有 Java 类的命名和风格规范。
5
+
6
+ 触发场景:
7
+ - 编写 Java 类时的命名规范(类名、方法名、变量名)
8
+ - 代码风格检查(注解使用、依赖注入方式)
9
+ - 包结构规范设计
10
+ - Controller/Service/Entity/VO/DTO 等各类型 Java 类规范
11
+
12
+ 触发词:代码风格、命名规范、类命名、方法命名、包结构、注解使用、依赖注入、驼峰命名、代码规范
13
+ ---
14
+
15
+ # leniu-tengyun-core 代码风格规范
16
+
17
+ ## 项目特征
18
+
19
+ | 特征 | 说明 |
20
+ |------|------|
21
+ | **包名前缀** | `net.xnzn.core.*` |
22
+ | **JDK 版本** | 21 |
23
+ | **Validation** | `jakarta.validation.*` |
24
+ | **工具库** | Hutool (CollUtil, ObjectUtil, BeanUtil) |
25
+ | **异常类** | `LeException` |
26
+ | **国际化** | `I18n` |
27
+ | **租户上下文** | `TenantContextHolder` |
28
+ | **分页组件** | PageHelper (PageMethod) |
29
+
30
+ ## 包结构规范
31
+
32
+ ```
33
+ net.xnzn.core
34
+ ├── [module]/
35
+ │ ├── controller/ # 控制器层
36
+ │ ├── service/ # 服务层
37
+ │ │ └── impl/ # 服务实现
38
+ │ ├── mapper/ # 数据访问层(含 XML)
39
+ │ ├── model/ # 数据模型
40
+ │ │ ├── entity/ # 实体类
41
+ │ │ └── po/ # 持久化对象
42
+ │ ├── vo/ # 视图对象(返回前端)
43
+ │ ├── dto/ # 数据传输对象(服务间/MQ)
44
+ │ ├── param/ # 请求参数对象
45
+ │ ├── constants/ # 常量
46
+ │ ├── enums/ # 枚举
47
+ │ ├── api/ # 对外 API 接口
48
+ │ ├── config/ # 配置类
49
+ │ ├── mq/ # 消息队列监听器
50
+ │ ├── task/ # 定时任务
51
+ │ ├── handle/ # 业务处理器(策略模式)
52
+ │ └── util/ # 工具类
53
+ ```
54
+
55
+ ## 类命名规范
56
+
57
+ | 类型 | 命名格式 | 示例 |
58
+ |------|----------|------|
59
+ | Controller | `XxxController` | `OrderController` |
60
+ | Service 接口 | `XxxService` | `OrderService` |
61
+ | Service 实现 | `XxxServiceImpl` | `OrderServiceImpl` |
62
+ | Mapper | `XxxMapper` | `OrderMapper` |
63
+ | Entity | `Xxx` 或 `XxxEntity` | `Order` |
64
+ | PO | `XxxPO` | `OrderPO` |
65
+ | VO | `XxxVO` | `OrderVO` |
66
+ | DTO | `XxxDTO` | `OrderDTO` |
67
+ | Param | `XxxParam` / `XxxQueryParam` | `OrderQueryParam` |
68
+ | Enum | `XxxEnum` | `OrderStatusEnum` |
69
+ | Converter | `XxxConverter` | `OrderConverter` |
70
+ | Handler | `XxxHandler` | `OrderHandler` |
71
+ | Api | `XxxApi` | `OrderApi` |
72
+
73
+ ## 方法命名规范
74
+
75
+ | 操作 | Service 方法 | Mapper 方法 | Controller URL |
76
+ |------|-------------|-------------|---------------|
77
+ | 分页查询 | `pageXxx` | `pageXxx` | `GET /list` |
78
+ | 查询列表 | `listXxx` | `listXxx` | - |
79
+ | 查询单个 | `getXxx` | `selectById` | `GET /{id}` |
80
+ | 新增 | `save` / `add` / `create` | `insert` | `POST /` |
81
+ | 更新 | `update` / `modify` | `updateById` | `PUT /` |
82
+ | 删除 | `delete` / `remove` | `deleteById` | `DELETE /{ids}` |
83
+ | 统计 | `count` / `summary` | `selectCount` | - |
84
+ | 导出 | `export` | - | `POST /export` |
85
+ | 同步 | `sync` | - | - |
86
+
87
+ ## Controller 层模板
88
+
89
+ ```java
90
+ import io.swagger.annotations.Api;
91
+ import io.swagger.annotations.ApiOperation;
92
+ import lombok.extern.slf4j.Slf4j;
93
+ import net.xnzn.core.common.exception.LeException;
94
+ import net.xnzn.core.common.response.LeResponse;
95
+ import net.xnzn.core.order.param.OrderQueryParam;
96
+ import net.xnzn.core.order.service.OrderService;
97
+ import net.xnzn.core.order.vo.OrderVO;
98
+ import org.springframework.beans.factory.annotation.Autowired;
99
+ import org.springframework.web.bind.annotation.*;
100
+
101
+ import jakarta.validation.Valid;
102
+
103
+ @Slf4j
104
+ @RequiresAuthentication
105
+ @RestController
106
+ @RequestMapping("/api/order")
107
+ @Api(value = "订单管理", tags = "订单管理")
108
+ public class OrderController {
109
+
110
+ @Autowired
111
+ private OrderService orderService;
112
+
113
+ @ApiOperation(value = "分页查询订单")
114
+ @PostMapping("/list")
115
+ public LeResponse<Page<OrderVO>> list(@Valid @RequestBody OrderQueryParam param) {
116
+ return LeResponse.success(orderService.pageList(param));
117
+ }
118
+
119
+ @ApiOperation(value = "获取订单详情")
120
+ @GetMapping("/{id}")
121
+ public LeResponse<OrderVO> getById(@PathVariable Long id) {
122
+ return LeResponse.success(orderService.getById(id));
123
+ }
124
+
125
+ @ApiOperation(value = "创建订单")
126
+ @PostMapping("/")
127
+ public LeResponse<Long> create(@Valid @RequestBody OrderParam param) {
128
+ return LeResponse.success(orderService.create(param));
129
+ }
130
+
131
+ @ApiOperation(value = "更新订单")
132
+ @PutMapping("/")
133
+ public LeResponse<Boolean> update(@Valid @RequestBody OrderParam param) {
134
+ return LeResponse.success(orderService.update(param));
135
+ }
136
+
137
+ @ApiOperation(value = "删除订单")
138
+ @DeleteMapping("/{ids}")
139
+ public LeResponse<Boolean> delete(@PathVariable String ids) {
140
+ return LeResponse.success(orderService.delete(ids));
141
+ }
142
+ }
143
+ ```
144
+
145
+ **要点**:
146
+ - 统一使用 `@PostMapping`(部分查询也可以用 `@GetMapping`)
147
+ - 需要 `@RequiresAuthentication` 认证注解
148
+ - 使用 `LeResponse<T>` 封装返回结果
149
+ - 参数校验使用 `@Valid` 触发
150
+
151
+ ## Service 层模板
152
+
153
+ ```java
154
+ import cn.hutool.core.util.ObjectUtil;
155
+ import cn.hutool.core.bean.BeanUtil;
156
+ import lombok.extern.slf4j.Slf4j;
157
+ import net.xnzn.core.common.exception.LeException;
158
+ import net.xnzn.core.order.mapper.OrderMapper;
159
+ import net.xnzn.core.order.model.Order;
160
+ import net.xnzn.core.order.param.OrderParam;
161
+ import net.xnzn.core.order.vo.OrderVO;
162
+ import org.springframework.beans.factory.annotation.Autowired;
163
+ import org.springframework.stereotype.Service;
164
+ import org.springframework.transaction.annotation.Transactional;
165
+
166
+ import java.util.List;
167
+
168
+ @Slf4j
169
+ @Service
170
+ public class OrderServiceImpl implements OrderService {
171
+
172
+ @Autowired
173
+ private OrderMapper orderMapper;
174
+
175
+ @Autowired
176
+ @Lazy
177
+ private ProductService productService;
178
+
179
+ @Transactional(rollbackFor = Exception.class)
180
+ public Long create(OrderParam param) {
181
+ // 业务逻辑
182
+ Order order = BeanUtil.copyProperties(param, Order.class);
183
+ orderMapper.insert(order);
184
+ return order.getId();
185
+ }
186
+
187
+ public OrderVO getById(Long id) {
188
+ Order order = orderMapper.selectById(id);
189
+ if (ObjectUtil.isNull(order)) {
190
+ throw new LeException("订单不存在");
191
+ }
192
+ return BeanUtil.copyProperties(order, OrderVO.class);
193
+ }
194
+
195
+ public List<OrderVO> list(OrderQueryParam param) {
196
+ List<Order> orders = orderMapper.selectList(buildWrapper(param));
197
+ return BeanUtil.copyToList(orders, OrderVO.class);
198
+ }
199
+ }
200
+ ```
201
+
202
+ **要点**:
203
+ - 使用 `@Slf4j` 日志注解
204
+ - 循环依赖使用 `@Lazy`
205
+ - 事务使用 `@Transactional(rollbackFor = Exception.class)`
206
+ - 使用 Hutool 工具类:`BeanUtil`、`ObjectUtil`
207
+
208
+ ## Entity 实体类模板
209
+
210
+ ```java
211
+ import com.baomidou.mybatisplus.annotation.*;
212
+ import io.swagger.annotations.ApiModel;
213
+ import io.swagger.annotations.ApiModelProperty;
214
+ import lombok.Data;
215
+
216
+ import java.time.LocalDateTime;
217
+
218
+ @Data
219
+ @TableName(value = "order_table", autoResultMap = true)
220
+ public class Order {
221
+
222
+ @TableId
223
+ @ApiModelProperty(value = "订单ID")
224
+ private Long id;
225
+
226
+ @ApiModelProperty(value = "用户ID")
227
+ private Long userId;
228
+
229
+ @ApiModelProperty(value = "订单金额(分)")
230
+ private Long amount;
231
+
232
+ @ApiModelProperty(value = "删除标识(1-删除,2-正常)")
233
+ private Integer delFlag;
234
+
235
+ @TableField(fill = FieldFill.INSERT)
236
+ @ApiModelProperty(value = "创建人")
237
+ private String crby;
238
+
239
+ @TableField(fill = FieldFill.INSERT)
240
+ @ApiModelProperty(value = "创建时间")
241
+ private LocalDateTime crtime;
242
+
243
+ @TableField(fill = FieldFill.INSERT_UPDATE)
244
+ @ApiModelProperty(value = "更新人")
245
+ private String upby;
246
+
247
+ @TableField(fill = FieldFill.INSERT_UPDATE)
248
+ @ApiModelProperty(value = "更新时间")
249
+ private LocalDateTime uptime;
250
+ }
251
+ ```
252
+
253
+ **要点**:
254
+ - 使用 `@TableName` 指定表名
255
+ - 主键使用 `@TableId`
256
+ - 字段使用 `@TableField` 映射
257
+ - 审计字段:`delFlag`(1=删除,2=正常)、`crby`、`crtime`、`upby`、`uptime`
258
+
259
+ ## VO/DTO 类模板
260
+
261
+ ```java
262
+ import io.swagger.annotations.ApiModel;
263
+ import io.swagger.annotations.ApiModelProperty;
264
+ import jakarta.validation.constraints.*;
265
+ import lombok.Data;
266
+ import lombok.experimental.Accessors;
267
+
268
+ @Data
269
+ @ApiModel("订单信息")
270
+ @Accessors(chain = true)
271
+ public class OrderVO {
272
+
273
+ @ApiModelProperty("订单ID")
274
+ private Long id;
275
+
276
+ @ApiModelProperty("用户ID")
277
+ @NotNull(message = "用户ID不能为空")
278
+ private Long userId;
279
+
280
+ @ApiModelProperty("订单金额(元)")
281
+ @NotNull(message = "订单金额不能为空")
282
+ @DecimalMin(value = "0.01", message = "金额必须大于0.01")
283
+ private BigDecimal amount;
284
+
285
+ @ApiModelProperty("订单状态")
286
+ private Integer status;
287
+ }
288
+ ```
289
+
290
+ **要点**:
291
+ - 使用 `@ApiModel` 类注解
292
+ - 使用 `@ApiModelProperty` 字段注解
293
+ - 参数校验使用 `jakarta.validation.constraints.*` 注解
294
+ - 使用 `@Accessors(chain = true)` 支持链式调用
295
+
296
+ ## 枚举类模板
297
+
298
+ ```java
299
+ import lombok.AllArgsConstructor;
300
+ import lombok.Getter;
301
+
302
+ @Getter
303
+ @AllArgsConstructor
304
+ public enum OrderStatusEnum {
305
+
306
+ CREATED(1, "已创建"),
307
+ PAID(2, "已支付"),
308
+ COMPLETED(3, "已完成"),
309
+ CANCELLED(4, "已取消");
310
+
311
+ private final Integer key;
312
+ private final String desc;
313
+
314
+ public static OrderStatusEnum getByKey(Integer key) {
315
+ if (key == null) {
316
+ return null;
317
+ }
318
+ for (OrderStatusEnum status : values()) {
319
+ if (status.getKey().equals(key)) {
320
+ return status;
321
+ }
322
+ }
323
+ return null;
324
+ }
325
+
326
+ public static boolean isExistKey(Integer key) {
327
+ return getByKey(key) != null;
328
+ }
329
+ }
330
+ ```
331
+
332
+ **要点**:
333
+ - 使用 `@Getter` 和 `@AllArgsConstructor`
334
+ - 提供 `getByKey` 静态方法
335
+ - 提供 `isExistKey` 校验方法
336
+
337
+ ## 依赖注入规范
338
+
339
+ ```java
340
+ // 推荐:字段注入
341
+ @Autowired
342
+ private OrderService orderService;
343
+
344
+ // 解决循环依赖
345
+ @Resource
346
+ @Lazy
347
+ private ProductService productService;
348
+ ```
349
+
350
+ ## 异常处理
351
+
352
+ ```java
353
+ import net.xnzn.core.common.exception.LeException;
354
+ import net.xnzn.core.common.i18n.I18n;
355
+
356
+ // 简单异常
357
+ throw new LeException("订单不存在");
358
+
359
+ // 国际化异常
360
+ throw new LeException(I18n.getMessage("order.not.exists"));
361
+
362
+ // 带参数的国际化
363
+ throw new LeException(I18n.getMessage("order.status.invalid", status));
364
+ ```
365
+
366
+ ## Hutool 工具类速查
367
+
368
+ ```java
369
+ import cn.hutool.core.collection.CollUtil;
370
+ import cn.hutool.core.util.ObjectUtil;
371
+ import cn.hutool.core.util.StrUtil;
372
+ import cn.hutool.core.bean.BeanUtil;
373
+
374
+ // 集合操作
375
+ if (CollUtil.isEmpty(list)) {
376
+ throw new LeException("列表不能为空");
377
+ }
378
+ if (CollUtil.isNotEmpty(list)) {
379
+ // 处理列表
380
+ }
381
+
382
+ // 对象判空
383
+ if (ObjectUtil.isNull(user)) {
384
+ throw new LeException("用户不存在");
385
+ }
386
+ if (ObjectUtil.isNotNull(user)) {
387
+ // 处理用户
388
+ }
389
+
390
+ // 字符串操作
391
+ if (StrUtil.isBlank(name)) {
392
+ throw new LeException("名称不能为空");
393
+ }
394
+ String trimmed = StrUtil.trim(name);
395
+ String joined = StrUtil.join(",", list);
396
+
397
+ // 对象拷贝
398
+ TargetDTO target = BeanUtil.copyProperties(source, TargetDTO.class);
399
+ List<TargetDTO> targets = BeanUtil.copyToList(sources, TargetDTO.class);
400
+ ```
401
+
402
+ ## 常用注解
403
+
404
+ ### Jakarta Validation
405
+
406
+ **重要**:项目使用 JDK 21,必须使用 `jakarta.validation.constraints.*` 包
407
+
408
+ ```java
409
+ import jakarta.validation.Valid;
410
+ import jakarta.validation.constraints.*;
411
+ ```
412
+
413
+ - `@NotNull` - 不能为 null
414
+ - `@NotBlank` - 字符串不能为空
415
+ - `@NotEmpty` - 集合不能为空
416
+ - `@Valid` - 触发参数校验
417
+
418
+ ### Lombok
419
+
420
+ - `@Data` - 生成 getter/setter
421
+ - `@Slf4j` - 日志
422
+ - `@Builder` - 建造者模式
423
+ - `@AllArgsConstructor` - 全参构造
424
+ - `@Accessors(chain = true)` - 链式调用
425
+
426
+ ### MyBatis-Plus
427
+
428
+ - `@TableName` - 表名映射
429
+ - `@TableId` - 主键
430
+ - `@TableField` - 字段映射
431
+ - `@TableField(fill = FieldFill.INSERT)` - 插入时自动填充
432
+ - `@TableField(fill = FieldFill.INSERT_UPDATE)` - 更新时自动填充
433
+
434
+ ## 类注释规范
435
+
436
+ 推荐使用 JavaDoc 标准格式:
437
+
438
+ ```java
439
+ /**
440
+ * 类功能描述
441
+ *
442
+ * @author xujiajun
443
+ * @date 2026-02-20
444
+ */
445
+ public class OrderService {
446
+ // ...
447
+ }
448
+ ```
449
+
450
+ **说明**:
451
+ - `@author` 使用实际作者名称
452
+ - `@date` 使用代码创建日期(格式:`YYYY-MM-DD`)
453
+
454
+ ## 常见错误
455
+
456
+ ### 错误1:使用 RuoYi 的包名
457
+
458
+ ```java
459
+ // ❌ 错误:使用 RuoYi 的包名
460
+ package org.dromara.system.service;
461
+
462
+ // ✅ 正确:使用 leniu 的包名
463
+ package net.xnzn.core.order.service;
464
+ ```
465
+
466
+ ### 错误2:使用 javax.validation
467
+
468
+ ```java
469
+ // ❌ 错误:使用 javax.validation(JDK 21 应该用 jakarta)
470
+ import javax.validation.constraints.NotNull;
471
+
472
+ // ✅ 正确:使用 jakarta.validation
473
+ import jakarta.validation.constraints.NotNull;
474
+ ```
475
+
476
+ ### 错误3:使用 MapstructUtils
477
+
478
+ ```java
479
+ // ❌ 错误:使用 RuoYi 的工具类
480
+ import org.dromara.common.core.utils.MapstructUtils;
481
+ Target target = MapstructUtils.convert(source, Target.class);
482
+
483
+ // ✅ 正确:leniu 使用 Hutool
484
+ import cn.hutool.core.bean.BeanUtil;
485
+ Target target = BeanUtil.copyProperties(source, Target.class);
486
+ ```
487
+
488
+ ### 错误4:使用 LeException 不使用 I18n
489
+
490
+ ```java
491
+ // ❌ 不推荐:直接硬编码中文
492
+ throw new LeException("订单不存在");
493
+
494
+ // ✅ 推荐:使用国际化
495
+ throw new LeException(I18n.getMessage("order.not.exists"));
496
+ ```
497
+
498
+ ### 错误5:使用 RuoYi 的 ServiceException
499
+
500
+ ```java
501
+ // ❌ 错误:使用 RuoYi 的异常
502
+ import org.dromara.common.core.exception.ServiceException;
503
+
504
+ // ✅ 正确:使用 leniu 的异常
505
+ import net.xnzn.core.common.exception.LeException;
506
+ ```
507
+
508
+ ## 参考文档
509
+
510
+ 详见:[leniu-tengyun-core 源码](/Users/xujiajun/Developer/gongsi_proj/core/leniu-tengyun-core)