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,111 +1,60 @@
1
1
  ---
2
2
  name: leniu-backend-annotations
3
3
  description: |
4
- leniu-yunshitang-core 项目后端注解使用指南。包含认证注解、参数校验注解、Swagger 文档注解、分组校验注解等核心注解的用法。
4
+ leniu-yunshitang-core 项目后端注解速查指南。包含认证、校验、Swagger、MyBatis-Plus、审计字段等注解的正确用法。
5
5
 
6
6
  触发场景:
7
- - 配置认证注解(@RequiresAuthentication, @RequiresGuest)
8
- - 配置参数校验(@Validated, @NotNull, @NotBlank
9
- - 配置 Swagger 文档注解(@Api, @ApiOperation, @ApiModelProperty
10
- - 配置分组校验(InsertGroup, UpdateGroup)
7
+ - 配置 leniu 认证注解(@RequiresAuthentication, @RequiresGuest)
8
+ - 配置参数校验和分组校验(InsertGroup, UpdateGroup
9
+ - 配置 Swagger 文档注解(@Api, @ApiOperation)
10
+ - 配置 Entity 审计字段注解
11
+ - 排查注解使用错误(javax vs jakarta、AddGroup vs InsertGroup)
11
12
 
12
- 适用项目:
13
- - leniu-tengyun-core:/Users/xujiajun/Developer/gongsi_proj/leniu-api/leniu-tengyun-core
14
- - leniu-yunshitang:/Users/xujiajun/Developer/gongsi_proj/leniu-api/leniu-tengyun/leniu-yunshitang
13
+ 适用项目:leniu-tengyun-core(云食堂项目)
15
14
 
16
- 触发词:@RequiresAuthentication、@RequiresGuest、@Validated、@NotNull、@Api、@ApiOperation、@ApiModelProperty、分组校验、InsertGroup、UpdateGroup
15
+ 触发词:@RequiresAuthentication、@RequiresGuest、@Validated、@NotNull、@Api、@ApiOperationInsertGroup、UpdateGroup、注解用法、审计字段注解
17
16
  ---
18
17
 
19
- # leniu-yunshitang-core 后端注解指南
18
+ # leniu 后端注解速查
20
19
 
21
- > 本文档专注于 leniu-tengyun-core 项目的 Java 后端注解使用规范。
20
+ ## 注解总览
22
21
 
23
- ## 注解快速特征对比
24
-
25
- | 注解 | 作用范围 | 包路径 | 常用场景 |
26
- |------|--------|--------|---------|
27
- | `@RequiresAuthentication` | Controller 类/方法 | `net.xnzn.framework.secure.filter` | 需要登录认证 |
28
- | `@RequiresGuest` | Controller 类/方法 | `net.xnzn.framework.secure.filter` | 允许游客访问 |
29
- | `@Validated` | Controller 方法 | `jakarta.validation` | 参数校验 |
30
- | `@Valid` | Controller 方法 | `jakarta.validation` | 参数校验 |
31
- | `@Api` | Controller | `io.swagger.annotations` | Swagger 文档 |
32
- | `@ApiOperation` | Controller 方法 | `io.swagger.annotations` | Swagger 文档 |
33
- | `@ApiModelProperty` | DTO/VO 字段 | `io.swagger.annotations` | Swagger 文档 |
22
+ | 注解 | 作用层 | 包路径 | 场景 |
23
+ |------|--------|--------|------|
24
+ | `@RequiresAuthentication` | Controller 类/方法 | `net.xnzn.framework.secure.filter.annotation` | 需要登录 |
25
+ | `@RequiresGuest` | Controller 类/方法 | `net.xnzn.framework.secure.filter.annotation` | 允许游客 |
26
+ | `@Validated` | Controller 方法参数 | `org.springframework.validation.annotation` | 分组校验 |
27
+ | `@Valid` | Controller 方法参数 | `jakarta.validation` | 简单校验 |
28
+ | `@Api` | Controller | `io.swagger.annotations` | Swagger 类文档 |
29
+ | `@ApiOperation` | Controller 方法 | `io.swagger.annotations` | Swagger 方法文档 |
30
+ | `@ApiModelProperty` | DTO/VO/Entity 字段 | `io.swagger.annotations` | Swagger 字段文档 |
31
+ | `@TableName` | Entity | `com.baomidou.mybatisplus.annotation` | 表名映射 |
32
+ | `@TableId` | Entity 主键字段 | `com.baomidou.mybatisplus.annotation` | 主键策略 |
33
+ | `@TableField` | Entity 字段 | `com.baomidou.mybatisplus.annotation` | 字段映射/自动填充 |
34
34
 
35
35
  ---
36
36
 
37
37
  ## 1. 认证注解
38
38
 
39
- ### @RequiresAuthentication - 需要登录
40
-
41
39
  ```java
42
40
  import net.xnzn.framework.secure.filter.annotation.RequiresAuthentication;
43
-
44
- @RestController
45
- @RequestMapping("/api/xxx")
46
- @Api(tags = "XXX管理")
47
- @RequiresAuthentication // 类级别:所有方法都需要登录
48
- public class XxxController {
49
-
50
- @Resource
51
- private XxxService xxxService;
52
-
53
- @PostMapping("/add")
54
- @ApiOperation(value = "XXX-新增")
55
- public Long add(@Valid @RequestBody LeRequest<XxxDTO> request) {
56
- return xxxService.add(request.getContent());
57
- }
58
-
59
- @PostMapping("/delete")
60
- @ApiOperation(value = "XXX-删除")
61
- public void delete(@RequestBody LeRequest<Long> request) {
62
- xxxService.delete(request.getContent());
63
- }
64
- }
65
- ```
66
-
67
- ### @RequiresGuest - 允许游客访问
68
-
69
- ```java
70
41
  import net.xnzn.framework.secure.filter.annotation.RequiresGuest;
71
42
 
72
43
  @RestController
73
- @RequestMapping("/api/public")
74
- @Api(tags = "公开接口")
75
- public class PublicController {
76
-
77
- @Resource
78
- private PublicService publicService;
79
-
80
- @RequiresGuest
81
- @GetMapping("/config")
82
- @ApiOperation(value = "获取配置")
83
- public LeResponse<ConfigVO> getConfig() {
84
- return LeResponse.succ(publicService.getConfig());
85
- }
86
- }
87
- ```
88
-
89
- ### 混合使用
90
-
91
- ```java
92
- @RestController
93
- @RequestMapping("/api/xxx")
44
+ @RequiresAuthentication // 类级别:所有方法默认需登录
45
+ @RequestMapping("/api/v2/web/xxx")
94
46
  @Api(tags = "XXX管理")
95
- @RequiresAuthentication // 类级别默认需要登录
96
47
  public class XxxController {
97
48
 
98
- // 继承类级别配置:需要登录
99
- @PostMapping("/add")
49
+ @PostMapping("/add") // 继承类级别:需要登录
100
50
  @ApiOperation(value = "XXX-新增")
101
- public Long add(@Valid @RequestBody LeRequest<XxxDTO> request) {
102
- return xxxService.add(request.getContent());
51
+ public void add(@Validated(InsertGroup.class) @RequestBody LeRequest<XxxDTO> request) {
52
+ xxxService.add(request.getContent());
103
53
  }
104
54
 
105
- // 覆盖类级别配置:允许游客访问
106
- @RequiresGuest
55
+ @RequiresGuest // 方法级别覆盖:允许游客
107
56
  @GetMapping("/list")
108
- @ApiOperation(value = "XXX-列表")
57
+ @ApiOperation(value = "XXX-公开列表")
109
58
  public List<XxxVO> list() {
110
59
  return xxxService.list();
111
60
  }
@@ -116,166 +65,97 @@ public class XxxController {
116
65
 
117
66
  ## 2. 参数校验注解
118
67
 
119
- ### @Validated 和 @Valid
68
+ ### 分组校验(新增/修改场景区分)
120
69
 
121
70
  ```java
122
- import jakarta.validation.Valid;
123
- import jakarta.validation.Validated;
124
- import jakarta.validation.constraints.*;
71
+ // 分组接口
72
+ public interface InsertGroup {}
73
+ public interface UpdateGroup {}
125
74
 
126
- @RestController
127
- @RequestMapping("/api/xxx")
128
- public class XxxController {
75
+ // Controller 中使用分组
76
+ @PostMapping("/add")
77
+ public void add(@Validated(InsertGroup.class) @RequestBody LeRequest<XxxDTO> request) {}
129
78
 
130
- // 使用 @Validated 进行分组校验
131
- @PostMapping("/add")
132
- @ApiOperation(value = "XXX-新增")
133
- public Long add(@Validated(InsertGroup.class) @RequestBody LeRequest<XxxDTO> request) {
134
- return xxxService.add(request.getContent());
135
- }
79
+ @PostMapping("/update")
80
+ public void update(@Validated(UpdateGroup.class) @RequestBody LeRequest<XxxDTO> request) {}
136
81
 
137
- // 使用 @Valid 进行简单校验
138
- @PostMapping("/update")
139
- @ApiOperation(value = "XXX-修改")
140
- public void update(@Valid @RequestBody LeRequest<XxxDTO> request) {
141
- xxxService.update(request.getContent());
142
- }
143
- }
82
+ // 不需要分组时用 @Valid 或 @Validated(不带参数)
83
+ @PostMapping("/query")
84
+ public Page<XxxVO> query(@Valid @RequestBody LeRequest<XxxQueryParam> request) {}
144
85
  ```
145
86
 
146
- ### DTO 校验注解
87
+ ### DTO 校验字段
147
88
 
148
89
  ```java
149
- import jakarta.validation.constraints.*;
150
- import io.swagger.annotations.ApiModel;
151
- import io.swagger.annotations.ApiModelProperty;
152
- import lombok.Data;
153
- import java.io.Serializable;
90
+ import jakarta.validation.constraints.*; // JDK 21 必须 jakarta
154
91
 
155
- /**
156
- * XXX DTO
157
- */
158
92
  @Data
159
93
  @ApiModel("XXX DTO")
160
94
  public class XxxDTO implements Serializable {
161
95
 
162
- private static final long serialVersionUID = 1L;
163
-
164
- @ApiModelProperty(value = "主键ID")
165
- @NotNull(message = "主键ID不能为空", groups = {UpdateGroup.class})
96
+ @NotNull(message = "ID不能为空", groups = {UpdateGroup.class})
97
+ @ApiModelProperty("主键ID")
166
98
  private Long id;
167
99
 
168
- @ApiModelProperty(value = "名称", required = true)
169
100
  @NotBlank(message = "名称不能为空", groups = {InsertGroup.class, UpdateGroup.class})
170
101
  @Size(max = 100, message = "名称长度不能超过100个字符")
102
+ @ApiModelProperty(value = "名称", required = true)
171
103
  private String name;
172
104
 
173
- @ApiModelProperty(value = "状态")
174
105
  @Min(value = 0, message = "状态不能小于0")
175
106
  @Max(value = 1, message = "状态不能大于1")
107
+ @ApiModelProperty("状态")
176
108
  private Integer status;
177
109
 
178
- @ApiModelProperty(value = "邮箱")
179
- @Email(message = "邮箱格式不正确")
180
- private String email;
181
-
182
- @ApiModelProperty(value = "手机号")
183
110
  @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
111
+ @ApiModelProperty("手机号")
184
112
  private String phone;
185
113
 
186
- @ApiModelProperty(value = "身份证号")
187
- @Pattern(regexp = "^[1-9]\\d{5}(19|20)\\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])\\d{3}[\\dXx]$", message = "身份证号格式不正确")
188
- private String idCard;
189
-
190
- @ApiModelProperty(value = "URL")
191
- @Pattern(regexp = "^https?://.+", message = "URL格式不正确")
192
- private String url;
114
+ @Email(message = "邮箱格式不正确")
115
+ @ApiModelProperty("邮箱")
116
+ private String email;
193
117
 
194
- @ApiModelProperty(value = "开始时间", required = true)
195
118
  @NotNull(message = "开始时间不能为空", groups = {InsertGroup.class, UpdateGroup.class})
119
+ @ApiModelProperty(value = "开始时间", required = true)
196
120
  private Date startTime;
197
121
 
198
- @ApiModelProperty(value = "结束时间", required = true)
199
- @NotNull(message = "结束时间不能为空", groups = {InsertGroup.class, UpdateGroup.class})
200
- private Date endTime;
201
-
202
- @ApiModelProperty(value = "备注")
203
122
  @Size(max = 500, message = "备注长度不能超过500个字符")
123
+ @ApiModelProperty("备注")
204
124
  private String remark;
205
125
  }
206
126
  ```
207
127
 
208
- ### 分组校验
209
-
210
- ```java
211
- // InsertGroup.java - 新增分组
212
- public interface InsertGroup {}
213
-
214
- // UpdateGroup.java - 修改分组
215
- public interface UpdateGroup {}
216
- ```
217
-
218
128
  ---
219
129
 
220
130
  ## 3. Swagger 文档注解
221
131
 
222
- ### @Api - 类级别
223
-
224
132
  ```java
225
133
  import io.swagger.annotations.Api;
226
-
227
- @RestController
228
- @RequestMapping("/api/xxx")
229
- @Api(value = "XXX管理", tags = "XXX管理")
230
- @RequiresAuthentication
231
- public class XxxController {
232
- // ...
233
- }
234
- ```
235
-
236
- ### @ApiOperation - 方法级别
237
-
238
- ```java
239
134
  import io.swagger.annotations.ApiOperation;
135
+ import io.swagger.annotations.ApiModelProperty;
136
+ import io.swagger.annotations.ApiParam;
240
137
 
241
- @PostMapping("/add")
242
- @ApiOperation(value = "XXX-新增")
243
- public Long add(@Valid @RequestBody LeRequest<XxxDTO> request) {
244
- return xxxService.add(request.getContent());
245
- }
246
-
247
- @PostMapping("/update")
248
- @ApiOperation(value = "XXX-修改")
249
- public void update(@Valid @RequestBody LeRequest<XxxDTO> request) {
250
- xxxService.update(request.getContent());
251
- }
138
+ // 类级别
139
+ @Api(value = "XXX管理", tags = "XXX管理")
140
+ public class XxxController {}
252
141
 
253
- @PostMapping("/delete")
254
- @ApiOperation(value = "XXX-删除")
255
- public void delete(@RequestBody LeRequest<Long> request) {
256
- xxxService.delete(request.getContent());
257
- }
142
+ // 方法级别
143
+ @ApiOperation(value = "XXX-分页查询")
144
+ @PostMapping("/page")
145
+ public Page<XxxVO> page(@Valid @RequestBody LeRequest<XxxDTO> request) {}
258
146
 
147
+ // 路径参数
259
148
  @GetMapping("/get/{id}")
260
- @ApiOperation(value = "XXX-获取详情")
261
- public XxxVO getById(@PathVariable Long id) {
262
- return xxxService.getById(id);
263
- }
149
+ public XxxVO getById(@ApiParam(value = "主键ID", required = true) @PathVariable Long id) {}
264
150
 
265
- @PostMapping("/page")
266
- @ApiOperation(value = "XXX-分页查询")
267
- public Page<XxxVO> page(@Valid @RequestBody LeRequest<XxxDTO> request) {
268
- return xxxService.page(request.getContent());
269
- }
151
+ // 查询参数
152
+ @PostMapping("/search")
153
+ public List<XxxVO> search(@ApiParam(value = "搜索关键词") @RequestParam(required = false) String keyword) {}
270
154
  ```
271
155
 
272
- ### @ApiModelProperty - 字段级别
156
+ ### VO 字段文档
273
157
 
274
158
  ```java
275
- import io.swagger.annotations.ApiModel;
276
- import io.swagger.annotations.ApiModelProperty;
277
- import com.fasterxml.jackson.annotation.JsonFormat;
278
-
279
159
  @Data
280
160
  @ApiModel("XXX VO")
281
161
  public class XxxVO implements Serializable {
@@ -286,370 +166,105 @@ public class XxxVO implements Serializable {
286
166
  @ApiModelProperty("名称")
287
167
  private String name;
288
168
 
289
- @ApiModelProperty("状态")
290
- private String status;
291
-
292
- @ApiModelProperty("状态描述")
293
- private String statusDesc;
294
-
295
- @ApiModelProperty(value = "创建时间")
169
+ @ApiModelProperty("创建时间")
296
170
  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
297
171
  private Date crtime;
298
-
299
- @ApiModelProperty(value = "更新时间")
300
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
301
- private Date uptime;
302
- }
303
- ```
304
-
305
- ### @ApiParam - 参数级别
306
-
307
- ```java
308
- import io.swagger.annotations.ApiParam;
309
-
310
- @GetMapping("/get/{id}")
311
- @ApiOperation(value = "XXX-获取详情")
312
- public XxxVO getById(
313
- @ApiParam(value = "主键ID", required = true)
314
- @PathVariable Long id
315
- ) {
316
- return xxxService.getById(id);
317
- }
318
-
319
- @PostMapping("/search")
320
- @ApiOperation(value = "XXX-搜索")
321
- public List<XxxVO> search(
322
- @ApiParam(value = "搜索关键词")
323
- @RequestParam(required = false) String keyword
324
- ) {
325
- return xxxService.search(keyword);
326
- }
327
- ```
328
-
329
- ---
330
-
331
- ## 4. MyBatis 注解
332
-
333
- ### @Mapper - Mapper 接口
334
-
335
- ```java
336
- import org.apache.ibatis.annotations.Mapper;
337
-
338
- @Mapper
339
- public interface XxxMapper extends BaseMapper<XxxEntity> {
340
- // ...
341
- }
342
- ```
343
-
344
- ### @TableName - 实体类
345
-
346
- ```java
347
- import com.baomidou.mybatisplus.annotation.TableName;
348
-
349
- @TableName("xxx_table")
350
- public class XxxEntity {
351
- // ...
352
172
  }
353
173
  ```
354
174
 
355
- ### @TableId - 主键
356
-
357
- ```java
358
- import com.baomidou.mybatisplus.annotation.TableId;
359
- import com.baomidou.mybatisplus.annotation.IdType;
360
-
361
- @TableId(value = "id", type = IdType.AUTO)
362
- private Long id;
363
- ```
364
-
365
- ### @TableField - 字段映射
366
-
367
- ```java
368
- import com.baomidou.mybatisplus.annotation.TableField;
369
- import com.baomidou.mybatisplus.annotation.FieldFill;
370
-
371
- @TableField("name")
372
- private String name;
373
-
374
- @TableField(value = "crby", fill = FieldFill.INSERT)
375
- private String crby;
376
-
377
- @TableField(value = "crtime", fill = FieldFill.INSERT)
378
- private Date crtime;
379
-
380
- @TableField(value = "upby", fill = FieldFill.INSERT_UPDATE)
381
- private String upby;
382
-
383
- @TableField(value = "uptime", fill = FieldFill.INSERT_UPDATE)
384
- private Date uptime;
385
- ```
386
-
387
- ---
388
-
389
- ## 5. JSON 序列化注解
390
-
391
- ### @JsonFormat - 日期格式化
392
-
393
- ```java
394
- import com.fasterxml.jackson.annotation.JsonFormat;
395
-
396
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
397
- private Date crtime;
398
-
399
- @JsonFormat(pattern = "yyyy-MM-dd")
400
- private Date date;
401
- ```
402
-
403
175
  ---
404
176
 
405
- ## 6. Lombok 注解
406
-
407
- ### @Data - 实体类
177
+ ## 4. Entity 注解(MyBatis-Plus + 审计字段)
408
178
 
409
179
  ```java
410
- import lombok.Data;
180
+ import com.baomidou.mybatisplus.annotation.*;
411
181
 
412
182
  @Data
413
183
  @TableName("xxx_table")
414
- public class XxxEntity {
415
- private Long id;
416
- private String name;
417
- }
418
- ```
419
-
420
- ### @Accessors(chain = true) - 链式调用
184
+ public class XxxEntity implements Serializable {
421
185
 
422
- ```java
423
- import lombok.Data;
424
- import lombok.experimental.Accessors;
425
-
426
- @Data
427
- @Accessors(chain = true)
428
- public class XxxEntity {
186
+ @ApiModelProperty("主键ID")
187
+ @TableId(value = "id", type = IdType.AUTO)
429
188
  private Long id;
430
- private String name;
431
- }
432
-
433
- // 使用
434
- XxxEntity entity = new XxxEntity()
435
- .setId(1L)
436
- .setName("test");
437
- ```
438
189
 
439
- ---
440
-
441
- ## 7. 完整 Controller 示例
442
-
443
- ```java
444
- package net.xnzn.core.xxx.controller;
445
-
446
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
447
- import com.pig4cloud.pigx.common.core.util.LeRequest;
448
- import io.swagger.annotations.Api;
449
- import io.swagger.annotations.ApiOperation;
450
- import io.swagger.annotations.ApiParam;
451
- import lombok.extern.slf4j.Slf4j;
452
- import net.xnzn.core.xxx.dto.XxxDTO;
453
- import net.xnzn.core.xxx.service.XxxService;
454
- import net.xnzn.core.xxx.vo.XxxVO;
455
- import net.xnzn.framework.secure.filter.annotation.RequiresAuthentication;
456
- import net.xnzn.framework.secure.filter.annotation.RequiresGuest;
457
-
458
- import org.springframework.web.bind.annotation.*;
459
-
460
- import jakarta.validation.Valid;
461
- import java.util.List;
462
-
463
- /**
464
- * XXX 管理控制器
465
- */
466
- @Slf4j
467
- @RestController
468
- @RequestMapping("/api/xxx")
469
- @Api(value = "XXX管理", tags = "XXX管理")
470
- @RequiresAuthentication
471
- public class XxxController {
472
-
473
- @Resource
474
- private XxxService xxxService;
475
-
476
- /**
477
- * 新增
478
- */
479
- @PostMapping("/add")
480
- @ApiOperation(value = "XXX-新增")
481
- public Long add(@Validated(InsertGroup.class) @RequestBody LeRequest<XxxDTO> request) {
482
- log.info("新增XXX,参数: {}", request.getContent());
483
- return xxxService.add(request.getContent());
484
- }
485
-
486
- /**
487
- * 修改
488
- */
489
- @PostMapping("/update")
490
- @ApiOperation(value = "XXX-修改")
491
- public void update(@Validated(UpdateGroup.class) @RequestBody LeRequest<XxxDTO> request) {
492
- log.info("修改XXX,参数: {}", request.getContent());
493
- xxxService.update(request.getContent());
494
- }
495
-
496
- /**
497
- * 删除
498
- */
499
- @PostMapping("/delete")
500
- @ApiOperation(value = "XXX-删除")
501
- public void delete(@RequestBody LeRequest<Long> request) {
502
- log.info("删除XXX,参数: {}", request.getContent());
503
- xxxService.delete(request.getContent());
504
- }
505
-
506
- /**
507
- * 获取详情
508
- */
509
- @GetMapping("/get/{id}")
510
- @ApiOperation(value = "XXX-获取详情")
511
- @RequiresGuest
512
- public XxxVO getById(
513
- @ApiParam(value = "主键ID", required = true)
514
- @PathVariable Long id
515
- ) {
516
- return xxxService.getById(id);
517
- }
518
-
519
- /**
520
- * 分页查询
521
- */
522
- @PostMapping("/page")
523
- @ApiOperation(value = "XXX-分页查询")
524
- public Page<XxxVO> page(@Valid @RequestBody LeRequest<XxxDTO> request) {
525
- log.info("分页查询XXX,参数: {}", request.getContent());
526
- return xxxService.page(request.getContent());
527
- }
528
-
529
- /**
530
- * 查询列表
531
- */
532
- @PostMapping("/list")
533
- @ApiOperation(value = "XXX-查询列表")
534
- @RequiresGuest
535
- public List<XxxVO> list(@Valid @RequestBody LeRequest<XxxDTO> request) {
536
- return xxxService.list(request.getContent());
537
- }
538
- }
539
- ```
540
-
541
- ---
542
-
543
- ## 8. 常见错误对比
544
-
545
- ### ❌ 错误写法
190
+ @ApiModelProperty("名称")
191
+ @TableField("name")
192
+ private String name;
546
193
 
547
- ```java
548
- // 错误 1: 使用 RuoYi 的认证注解
549
- @SaCheckPermission("system:user:list") // leniu 使用 @RequiresAuthentication
194
+ // ===== 审计字段(leniu 标准) =====
195
+ @ApiModelProperty("创建人")
196
+ @TableField(value = "crby", fill = FieldFill.INSERT)
197
+ private String crby;
550
198
 
551
- // 错误 2: 使用 javax.validation(JDK 21 应用 jakarta.validation)
552
- import javax.validation.Valid; // 错误
553
- import javax.validation.constraints.NotNull; // ❌ 错误
199
+ @ApiModelProperty("创建时间")
200
+ @TableField(value = "crtime", fill = FieldFill.INSERT)
201
+ private LocalDateTime crtime;
554
202
 
555
- // 错误 3: 使用 RuoYi 的分组
556
- @Validated(AddGroup.class) // 应该用 InsertGroup.class
203
+ @ApiModelProperty("更新人")
204
+ @TableField(value = "upby", fill = FieldFill.INSERT_UPDATE)
205
+ private String upby;
557
206
 
558
- // 错误 4: Swagger 注解包错误
559
- import io.swagger.v3.oas.annotations.*; // OpenAPI 3.0
560
- // 应该用
561
- import io.swagger.annotations.*; // ✅ Swagger 2.0
207
+ @ApiModelProperty("更新时间")
208
+ @TableField(value = "uptime", fill = FieldFill.INSERT_UPDATE)
209
+ private LocalDateTime uptime;
562
210
 
563
- // 错误 5: 缺少 Swagger 文档注解
564
- @RestController
565
- public class XxxController { // ❌ 缺少 @Api
566
- @PostMapping("/add")
567
- public Long add(@RequestBody LeRequest<XxxDTO> request) { // ❌ 缺少 @ApiOperation
568
- return xxxService.add(request.getContent());
569
- }
211
+ @ApiModelProperty("删除标识(1-删除,2-正常)")
212
+ private Integer delFlag;
570
213
  }
571
-
572
- // 错误 6: 审计字段注解错误
573
- @TableField("create_by") // ❌ 应该用 crby
574
- @TableField("create_time") // ❌ 应该用 crtime
575
214
  ```
576
215
 
577
- ### 正确写法
216
+ ### Mapper 接口
578
217
 
579
218
  ```java
580
- // 正确 1: 使用 leniu 的认证注解
581
- @RequiresAuthentication //
582
- @RequiresGuest // ✅
583
-
584
- // 正确 2: 使用 Jakarta Validation
585
- import jakarta.validation.Valid; // ✅
586
- import jakarta.validation.constraints.NotNull; // ✅
587
-
588
- // 正确 3: 使用 leniu 的分组
589
- @Validated(InsertGroup.class) // ✅
590
-
591
- // 正确 4: Swagger 注解包正确
592
- import io.swagger.annotations.Api; // ✅
593
- import io.swagger.annotations.ApiOperation; // ✅
594
-
595
- // 正确 5: Swagger 文档注解完整
596
- @RestController
597
- @Api(value = "XXX管理", tags = "XXX管理") // ✅
598
- public class XxxController {
599
- @PostMapping("/add")
600
- @ApiOperation(value = "XXX-新增") // ✅
601
- public Long add(@RequestBody LeRequest<XxxDTO> request) {
602
- return xxxService.add(request.getContent());
603
- }
604
- }
219
+ import org.apache.ibatis.annotations.Mapper;
220
+ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
605
221
 
606
- // 正确 6: 审计字段注解正确
607
- @TableField(value = "crby", fill = FieldFill.INSERT) // ✅
608
- @TableField(value = "crtime", fill = FieldFill.INSERT) // ✅
222
+ @Mapper
223
+ public interface XxxMapper extends BaseMapper<XxxEntity> {}
609
224
  ```
610
225
 
611
226
  ---
612
227
 
613
- ## 9. 检查清单
614
-
615
- 使用注解前必须检查:
228
+ ## 5. 注解组合速查
616
229
 
617
- - [ ] **是否使用 `@RequiresAuthentication` 或 `@RequiresGuest`**?
618
- - [ ] **是否使用 Jakarta Validation**(jakarta.validation)?
619
- - [ ] **分组校验是否正确**(InsertGroup/UpdateGroup)?
620
- - [ ] **Controller 是否添加 `@Api` 注解**?
621
- - [ ] **方法是否添加 `@ApiOperation` 注解**?
622
- - [ ] **DTO/VO 是否添加 `@ApiModelProperty` 注解**?
623
- - [ ] **Swagger 注解包是否正确**(io.swagger.annotations)?
624
- - [ ] **Entity 是否正确配置 `@TableName`**?
625
- - [ ] **主键是否正确配置 `@TableId`**?
626
- - [ ] **审计字段是否配置 `FieldFill`**?
230
+ | 层级 | 标准注解组合 |
231
+ |------|-------------|
232
+ | Controller | `@Api` + `@RestController` + `@RequiresAuthentication` + `@RequestMapping` |
233
+ | 写操作方法 | `@ApiOperation` + `@PostMapping` + `@Validated(InsertGroup/UpdateGroup.class)` |
234
+ | 查询方法 | `@ApiOperation` + `@PostMapping` + `@Valid` 或 `@Validated` |
235
+ | DTO 字段 | `@ApiModelProperty` + `@NotNull/@NotBlank` + `(groups = {InsertGroup.class})` |
236
+ | Entity | `@Data` + `@TableName` |
237
+ | Entity 主键 | `@ApiModelProperty` + `@TableId(type = IdType.AUTO)` |
238
+ | 审计字段 | `@ApiModelProperty` + `@TableField(fill = FieldFill.INSERT/INSERT_UPDATE)` |
627
239
 
628
240
  ---
629
241
 
630
- ## 10. 快速参考
242
+ ## 6. 错误对比
631
243
 
632
- ### 注解速查表
244
+ | 错误写法 | 正确写法 | 说明 |
245
+ |---------|---------|------|
246
+ | `@SaCheckPermission("xxx")` | `@RequiresAuthentication` | leniu 不用 Sa-Token 细粒度权限 |
247
+ | `import javax.validation.*` | `import jakarta.validation.*` | JDK 21 必须 jakarta |
248
+ | `@Validated(AddGroup.class)` | `@Validated(InsertGroup.class)` | leniu 分组名为 InsertGroup |
249
+ | `import io.swagger.v3.oas.*` | `import io.swagger.annotations.*` | leniu 用 Swagger 2.0 |
250
+ | `@TableField("create_by")` | `@TableField(value = "crby", fill = FieldFill.INSERT)` | leniu 审计字段 |
251
+ | `@TableField("create_time")` | `@TableField(value = "crtime", fill = FieldFill.INSERT)` | leniu 审计字段 |
252
+ | `@TableId(type = IdType.ASSIGN_ID)` | `@TableId(type = IdType.AUTO)` | leniu 用自增主键 |
253
+ | Controller 缺 `@Api` | 必须加 `@Api(tags = "模块名")` | Swagger 文档要求 |
254
+ | 方法缺 `@ApiOperation` | 必须加 `@ApiOperation(value = "描述")` | Swagger 文档要求 |
633
255
 
634
- ```
635
- @RequiresAuthentication → 需要登录认证
636
- @RequiresGuest → 允许游客访问
637
- @Validated → 参数校验(支持分组)
638
- @Valid → 参数校验(不支持分组)
639
- @Api → Swagger 文档(类级别)
640
- @ApiOperation → Swagger 文档(方法级别)
641
- @ApiModelProperty → Swagger 文档(字段级别)
642
- @ApiParam → Swagger 文档(参数级别)
643
- ```
256
+ ---
644
257
 
645
- ### 注解组合速查
258
+ ## 检查清单
646
259
 
647
- ```
648
- Controller: @Api + @RequiresAuthentication
649
- Method: @ApiOperation + @Validated(InsertGroup.class)
650
- DTO Field: @ApiModelProperty + @NotNull/NotBlank
651
- Entity Field: @TableField + @ApiModelProperty
652
- ```
260
+ - [ ] 认证注解:`@RequiresAuthentication` 或 `@RequiresGuest`
261
+ - [ ] 校验包:`jakarta.validation`(非 `javax.validation`)
262
+ - [ ] 分组名:`InsertGroup` / `UpdateGroup`(非 `AddGroup` / `EditGroup`)
263
+ - [ ] Swagger 包:`io.swagger.annotations`(非 `io.swagger.v3.oas`)
264
+ - [ ] Controller 有 `@Api`,方法有 `@ApiOperation`
265
+ - [ ] DTO/VO 字段有 `@ApiModelProperty`
266
+ - [ ] Entity 主键:`@TableId(type = IdType.AUTO)`
267
+ - [ ] 审计字段:`crby/crtime/upby/uptime` + 正确的 `FieldFill`
653
268
 
654
269
  ---
655
270
 
@@ -657,8 +272,6 @@ Entity Field: @TableField + @ApiModelProperty
657
272
 
658
273
  | 类型 | 路径 |
659
274
  |------|------|
660
- | Controller 示例 | `core-attendance/.../controller/AttendanceLeaveInfoController.java` |
661
- | DTO 示例 | `core-attendance/.../dto/AddOrUpdateAttendanceLeaveInfoDTO.java` |
662
- | Entity 示例 | `core-bus/.../model/BusLine.java` |
663
-
664
- **项目路径**:`/Users/xujiajun/Developer/gongsi_proj/leniu-api/leniu-tengyun-core`
275
+ | Controller 示例 | `sys-canteen/.../order/web/controller/OrderInfoWebController.java` |
276
+ | DTO 示例 | `sys-kitchen/.../attendance/.../dto/` |
277
+ | Entity 示例 | `sys-canteen/.../order/common/model/OrderInfo.java` |