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.
- package/.claude/hooks/skill-forced-eval.js +4 -1
- package/.claude/settings.json +3 -3
- package/.claude/skills/add-skill/SKILL.md +252 -116
- package/.claude/skills/api-development/SKILL.md +83 -377
- package/.claude/skills/architecture-design/SKILL.md +138 -632
- package/.claude/skills/backend-annotations/SKILL.md +134 -506
- package/.claude/skills/banana-image/SKILL.md +10 -3
- package/.claude/skills/brainstorm/SKILL.md +103 -535
- package/.claude/skills/bug-detective/SKILL.md +147 -1097
- package/.claude/skills/bug-detective/references/error-patterns.md +242 -0
- package/.claude/skills/code-patterns/SKILL.md +116 -426
- package/.claude/skills/code-patterns/references/leniu-code-patterns.md +87 -0
- package/.claude/skills/crud-development/SKILL.md +64 -304
- package/.claude/skills/data-permission/SKILL.md +105 -412
- package/.claude/skills/data-permission/references/custom-data-scope.md +90 -0
- package/.claude/skills/file-oss-management/SKILL.md +106 -714
- package/.claude/skills/file-oss-management/references/entities.md +105 -0
- package/.claude/skills/file-oss-management/references/service-impl.md +104 -0
- package/.claude/skills/leniu-api-development/SKILL.md +142 -626
- package/.claude/skills/leniu-api-development/references/real-examples.md +273 -0
- package/.claude/skills/leniu-architecture-design/SKILL.md +176 -391
- package/.claude/skills/leniu-backend-annotations/SKILL.md +132 -519
- package/.claude/skills/leniu-brainstorm/SKILL.md +132 -541
- package/.claude/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
- package/.claude/skills/leniu-crud-development/SKILL.md +232 -938
- package/.claude/skills/leniu-crud-development/references/templates.md +597 -0
- package/.claude/skills/leniu-customization-location/SKILL.md +410 -0
- package/.claude/skills/leniu-data-permission/SKILL.md +70 -0
- package/.claude/skills/leniu-java-entity/SKILL.md +76 -590
- package/.claude/skills/leniu-java-entity/references/templates.md +237 -0
- package/.claude/skills/leniu-java-export/SKILL.md +94 -379
- package/.claude/skills/leniu-java-logging/SKILL.md +106 -709
- package/.claude/skills/leniu-java-logging/references/data-mask.md +46 -0
- package/.claude/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
- package/.claude/skills/leniu-java-mybatis/SKILL.md +73 -446
- package/.claude/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
- package/.claude/skills/leniu-report-customization/SKILL.md +111 -325
- package/.claude/skills/leniu-report-customization/references/table-fields.md +93 -0
- package/.claude/skills/leniu-report-standard-customization/SKILL.md +328 -0
- package/.claude/skills/leniu-report-standard-customization/references/analysis-module.md +64 -0
- package/.claude/skills/leniu-report-standard-customization/references/table-fields.md +113 -0
- package/.claude/skills/leniu-security-guard/SKILL.md +133 -347
- package/.claude/skills/mysql-debug/SKILL.md +364 -0
- package/.claude/skills/openspec-apply-change/SKILL.md +10 -1
- package/.claude/skills/openspec-archive-change/SKILL.md +9 -1
- package/.claude/skills/openspec-bulk-archive-change/SKILL.md +9 -1
- package/.claude/skills/openspec-continue-change/SKILL.md +9 -1
- package/.claude/skills/openspec-explore/SKILL.md +10 -1
- package/.claude/skills/openspec-ff-change/SKILL.md +9 -1
- package/.claude/skills/openspec-new-change/SKILL.md +9 -1
- package/.claude/skills/openspec-onboard/SKILL.md +15 -130
- package/.claude/skills/openspec-sync-specs/SKILL.md +9 -1
- package/.claude/skills/openspec-verify-change/SKILL.md +9 -1
- package/.claude/skills/performance-doctor/SKILL.md +110 -434
- package/.claude/skills/redis-cache/SKILL.md +89 -595
- package/.claude/skills/redis-cache/references/listeners.md +23 -0
- package/.claude/skills/scheduled-jobs/SKILL.md +88 -407
- package/.claude/skills/security-guard/SKILL.md +137 -532
- package/.claude/skills/security-guard/references/encrypt-config.md +103 -0
- package/.claude/skills/security-guard/references/sensitive-strategies.md +42 -0
- package/.claude/skills/sms-mail/SKILL.md +116 -574
- package/.claude/skills/sms-mail/references/mail-config.md +88 -0
- package/.claude/skills/sms-mail/references/sms-config.md +74 -0
- package/.claude/skills/social-login/SKILL.md +112 -514
- package/.claude/skills/social-login/references/provider-configs.md +118 -0
- package/.claude/skills/tenant-management/SKILL.md +129 -444
- package/.claude/skills/tenant-management/references/tenant-scenarios.md +91 -0
- package/.claude/skills/test-development/SKILL.md +86 -540
- package/.claude/skills/test-development/references/parameterized-examples.md +119 -0
- package/.claude/skills/utils-toolkit/SKILL.md +52 -305
- package/.claude/skills/utils-toolkit/references/redis-utils-api.md +56 -0
- package/.claude/skills/websocket-sse/SKILL.md +105 -550
- package/.claude/skills/workflow-engine/SKILL.md +147 -502
- package/.codex/skills/add-skill/SKILL.md +252 -116
- package/.codex/skills/api-development/SKILL.md +172 -599
- package/.codex/skills/architecture-design/SKILL.md +138 -504
- package/.codex/skills/backend-annotations/SKILL.md +134 -496
- package/.codex/skills/banana-image/SKILL.md +10 -3
- package/.codex/skills/brainstorm/SKILL.md +103 -535
- package/.codex/skills/bug-detective/SKILL.md +147 -1097
- package/.codex/skills/bug-detective/references/error-patterns.md +242 -0
- package/.codex/skills/code-patterns/SKILL.md +120 -282
- package/.codex/skills/code-patterns/references/leniu-code-patterns.md +87 -0
- package/.codex/skills/crud-development/SKILL.md +64 -292
- package/.codex/skills/data-permission/SKILL.md +108 -407
- package/.codex/skills/data-permission/references/custom-data-scope.md +90 -0
- package/.codex/skills/database-ops/SKILL.md +8 -154
- package/.codex/skills/error-handler/SKILL.md +10 -0
- package/.codex/skills/file-oss-management/SKILL.md +106 -714
- package/.codex/skills/file-oss-management/references/entities.md +105 -0
- package/.codex/skills/file-oss-management/references/service-impl.md +104 -0
- package/.codex/skills/git-workflow/SKILL.md +27 -5
- package/.codex/skills/leniu-api-development/SKILL.md +142 -626
- package/.codex/skills/leniu-api-development/references/real-examples.md +273 -0
- package/.codex/skills/leniu-architecture-design/SKILL.md +176 -391
- package/.codex/skills/leniu-backend-annotations/SKILL.md +132 -519
- package/.codex/skills/leniu-brainstorm/SKILL.md +132 -541
- package/.codex/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
- package/.codex/skills/leniu-crud-development/SKILL.md +232 -938
- package/.codex/skills/leniu-crud-development/references/templates.md +597 -0
- package/.codex/skills/leniu-customization-location/SKILL.md +410 -0
- package/.codex/skills/leniu-data-permission/SKILL.md +70 -0
- package/.codex/skills/leniu-java-code-style/SKILL.md +510 -0
- package/.codex/skills/leniu-java-entity/SKILL.md +76 -590
- package/.codex/skills/leniu-java-entity/references/templates.md +237 -0
- package/.codex/skills/leniu-java-export/SKILL.md +94 -379
- package/.codex/skills/leniu-java-logging/SKILL.md +106 -709
- package/.codex/skills/leniu-java-logging/references/data-mask.md +46 -0
- package/.codex/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
- package/.codex/skills/leniu-java-mybatis/SKILL.md +73 -446
- package/.codex/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
- package/.codex/skills/leniu-report-customization/SKILL.md +111 -325
- package/.codex/skills/leniu-report-customization/references/table-fields.md +93 -0
- package/.codex/skills/leniu-report-standard-customization/SKILL.md +328 -0
- package/.codex/skills/leniu-report-standard-customization/references/analysis-module.md +64 -0
- package/.codex/skills/leniu-report-standard-customization/references/table-fields.md +113 -0
- package/.codex/skills/leniu-security-guard/SKILL.md +133 -347
- package/.codex/skills/mysql-debug/SKILL.md +364 -0
- package/.codex/skills/openspec-apply-change/SKILL.md +10 -1
- package/.codex/skills/openspec-archive-change/SKILL.md +9 -1
- package/.codex/skills/openspec-bulk-archive-change/SKILL.md +9 -1
- package/.codex/skills/openspec-continue-change/SKILL.md +9 -1
- package/.codex/skills/openspec-explore/SKILL.md +10 -1
- package/.codex/skills/openspec-ff-change/SKILL.md +9 -1
- package/.codex/skills/openspec-new-change/SKILL.md +9 -1
- package/.codex/skills/openspec-onboard/SKILL.md +15 -130
- package/.codex/skills/openspec-sync-specs/SKILL.md +9 -1
- package/.codex/skills/openspec-verify-change/SKILL.md +9 -1
- package/.codex/skills/performance-doctor/SKILL.md +110 -434
- package/.codex/skills/project-navigator/SKILL.md +20 -1
- package/.codex/skills/redis-cache/SKILL.md +93 -589
- package/.codex/skills/redis-cache/references/listeners.md +23 -0
- package/.codex/skills/scheduled-jobs/SKILL.md +88 -407
- package/.codex/skills/security-guard/SKILL.md +141 -527
- package/.codex/skills/security-guard/references/encrypt-config.md +103 -0
- package/.codex/skills/security-guard/references/sensitive-strategies.md +42 -0
- package/.codex/skills/sms-mail/SKILL.md +116 -574
- package/.codex/skills/sms-mail/references/mail-config.md +88 -0
- package/.codex/skills/sms-mail/references/sms-config.md +74 -0
- package/.codex/skills/social-login/SKILL.md +112 -514
- package/.codex/skills/social-login/references/provider-configs.md +118 -0
- package/.codex/skills/store-pc/SKILL.md +258 -383
- package/.codex/skills/tenant-management/SKILL.md +129 -444
- package/.codex/skills/tenant-management/references/tenant-scenarios.md +91 -0
- package/.codex/skills/test-development/SKILL.md +86 -540
- package/.codex/skills/test-development/references/parameterized-examples.md +119 -0
- package/.codex/skills/ui-pc/SKILL.md +350 -387
- package/.codex/skills/utils-toolkit/SKILL.md +52 -283
- package/.codex/skills/utils-toolkit/references/redis-utils-api.md +56 -0
- package/.codex/skills/websocket-sse/SKILL.md +105 -550
- package/.codex/skills/workflow-engine/SKILL.md +147 -502
- package/.cursor/hooks.json +3 -3
- package/.cursor/rules/skill-activation.mdc +2 -0
- package/.cursor/skills/add-skill/SKILL.md +252 -116
- package/.cursor/skills/api-development/SKILL.md +83 -377
- package/.cursor/skills/architecture-design/SKILL.md +138 -632
- package/.cursor/skills/backend-annotations/SKILL.md +134 -506
- package/.cursor/skills/banana-image/SKILL.md +10 -3
- package/.cursor/skills/brainstorm/SKILL.md +103 -535
- package/.cursor/skills/bug-detective/SKILL.md +147 -1097
- package/.cursor/skills/bug-detective/references/error-patterns.md +242 -0
- package/.cursor/skills/code-patterns/SKILL.md +116 -426
- package/.cursor/skills/code-patterns/references/leniu-code-patterns.md +87 -0
- package/.cursor/skills/crud-development/SKILL.md +64 -304
- package/.cursor/skills/data-permission/SKILL.md +105 -412
- package/.cursor/skills/data-permission/references/custom-data-scope.md +90 -0
- package/.cursor/skills/file-oss-management/SKILL.md +106 -714
- package/.cursor/skills/file-oss-management/references/entities.md +105 -0
- package/.cursor/skills/file-oss-management/references/service-impl.md +104 -0
- package/.cursor/skills/git-workflow/SKILL.md +27 -5
- package/.cursor/skills/leniu-api-development/SKILL.md +142 -626
- package/.cursor/skills/leniu-api-development/references/real-examples.md +273 -0
- package/.cursor/skills/leniu-architecture-design/SKILL.md +176 -391
- package/.cursor/skills/leniu-backend-annotations/SKILL.md +132 -519
- package/.cursor/skills/leniu-brainstorm/SKILL.md +132 -541
- package/.cursor/skills/leniu-brainstorm/references/business-scenarios.md +162 -0
- package/.cursor/skills/leniu-crud-development/SKILL.md +232 -938
- package/.cursor/skills/leniu-crud-development/references/templates.md +597 -0
- package/.cursor/skills/leniu-customization-location/SKILL.md +410 -0
- package/.cursor/skills/leniu-data-permission/SKILL.md +70 -0
- package/.cursor/skills/leniu-java-code-style/SKILL.md +510 -0
- package/.cursor/skills/leniu-java-entity/SKILL.md +76 -590
- package/.cursor/skills/leniu-java-entity/references/templates.md +237 -0
- package/.cursor/skills/leniu-java-export/SKILL.md +94 -379
- package/.cursor/skills/leniu-java-logging/SKILL.md +106 -709
- package/.cursor/skills/leniu-java-logging/references/data-mask.md +46 -0
- package/.cursor/skills/leniu-java-logging/references/logging-scenarios.md +113 -0
- package/.cursor/skills/leniu-java-mybatis/SKILL.md +73 -446
- package/.cursor/skills/leniu-java-mybatis/references/report-mapper.md +88 -0
- package/.cursor/skills/leniu-report-customization/SKILL.md +111 -325
- package/.cursor/skills/leniu-report-customization/references/table-fields.md +93 -0
- package/.cursor/skills/leniu-report-standard-customization/SKILL.md +328 -0
- package/.cursor/skills/leniu-report-standard-customization/references/analysis-module.md +64 -0
- package/.cursor/skills/leniu-report-standard-customization/references/table-fields.md +113 -0
- package/.cursor/skills/leniu-security-guard/SKILL.md +133 -347
- package/.cursor/skills/mysql-debug/SKILL.md +364 -0
- package/.cursor/skills/openspec-apply-change/SKILL.md +10 -1
- package/.cursor/skills/openspec-archive-change/SKILL.md +9 -1
- package/.cursor/skills/openspec-bulk-archive-change/SKILL.md +9 -1
- package/.cursor/skills/openspec-continue-change/SKILL.md +9 -1
- package/.cursor/skills/openspec-explore/SKILL.md +10 -1
- package/.cursor/skills/openspec-ff-change/SKILL.md +9 -1
- package/.cursor/skills/openspec-new-change/SKILL.md +9 -1
- package/.cursor/skills/openspec-onboard/SKILL.md +15 -130
- package/.cursor/skills/openspec-sync-specs/SKILL.md +9 -1
- package/.cursor/skills/openspec-verify-change/SKILL.md +9 -1
- package/.cursor/skills/performance-doctor/SKILL.md +110 -434
- package/.cursor/skills/redis-cache/SKILL.md +89 -595
- package/.cursor/skills/redis-cache/references/listeners.md +23 -0
- package/.cursor/skills/scheduled-jobs/SKILL.md +88 -407
- package/.cursor/skills/security-guard/SKILL.md +137 -532
- package/.cursor/skills/security-guard/references/encrypt-config.md +103 -0
- package/.cursor/skills/security-guard/references/sensitive-strategies.md +42 -0
- package/.cursor/skills/sms-mail/SKILL.md +116 -574
- package/.cursor/skills/sms-mail/references/mail-config.md +88 -0
- package/.cursor/skills/sms-mail/references/sms-config.md +74 -0
- package/.cursor/skills/social-login/SKILL.md +112 -514
- package/.cursor/skills/social-login/references/provider-configs.md +118 -0
- package/.cursor/skills/tenant-management/SKILL.md +129 -444
- package/.cursor/skills/tenant-management/references/tenant-scenarios.md +91 -0
- package/.cursor/skills/test-development/SKILL.md +86 -540
- package/.cursor/skills/test-development/references/parameterized-examples.md +119 -0
- package/.cursor/skills/utils-toolkit/SKILL.md +52 -305
- package/.cursor/skills/utils-toolkit/references/redis-utils-api.md +56 -0
- package/.cursor/skills/websocket-sse/SKILL.md +105 -550
- package/.cursor/skills/workflow-engine/SKILL.md +147 -502
- package/AGENTS.md +1 -0
- 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
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
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
|
-
##
|
|
41
|
+
## 禁令详解
|
|
45
42
|
|
|
46
|
-
### 1.
|
|
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.
|
|
56
|
+
### 3. 禁止 Map 传业务数据
|
|
70
57
|
|
|
71
58
|
```java
|
|
72
|
-
// ✅
|
|
59
|
+
// ✅ 创建 VO 类
|
|
73
60
|
public XxxVo getXxx(Long id) {
|
|
74
61
|
return MapstructUtils.convert(entity, XxxVo.class);
|
|
75
62
|
}
|
|
76
63
|
|
|
77
|
-
// ❌
|
|
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
|
|
68
|
+
### 4-5. Service 架构
|
|
86
69
|
|
|
87
70
|
```java
|
|
88
|
-
// ✅
|
|
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
|
-
// ❌
|
|
126
|
-
|
|
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.
|
|
88
|
+
### 6. RESTful 路径
|
|
137
89
|
|
|
138
90
|
```java
|
|
139
|
-
// ✅
|
|
140
|
-
@GetMapping("/list")
|
|
141
|
-
@
|
|
142
|
-
@PostMapping
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
@
|
|
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.
|
|
101
|
+
### 7. 对象转换
|
|
155
102
|
|
|
156
103
|
```java
|
|
157
|
-
// ✅
|
|
104
|
+
// ✅ MapstructUtils
|
|
158
105
|
XxxVo vo = MapstructUtils.convert(entity, XxxVo.class);
|
|
159
106
|
List<XxxVo> voList = MapstructUtils.convert(entityList, XxxVo.class);
|
|
160
107
|
|
|
161
|
-
// ❌
|
|
162
|
-
BeanUtil.copyProperties(entity, vo);
|
|
163
|
-
BeanUtils.copyProperties(entity, vo); // 禁止!
|
|
108
|
+
// ❌ BeanUtil
|
|
109
|
+
BeanUtil.copyProperties(entity, vo);
|
|
164
110
|
```
|
|
165
111
|
|
|
166
|
-
### 8.
|
|
112
|
+
### 8. 主键策略
|
|
167
113
|
|
|
168
114
|
```sql
|
|
169
|
-
-- ✅
|
|
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
|
-
//
|
|
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
|
-
// ✅
|
|
185
|
-
return R.ok(null, token);
|
|
186
|
-
return R.ok("获取成功", token);
|
|
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
|
-
// ✅
|
|
193
|
-
|
|
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
|
-
// ✅
|
|
202
|
-
|
|
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
|
-
// ❌
|
|
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
|
|
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
|
-
|
|
161
|
+
> **原因**:Jackson DefaultTyping.NON_FINAL 会为 `ImmutableCollections$List12` 添加类型信息,反序列化时导致 `ClassNotFoundException`。
|
|
246
162
|
|
|
247
|
-
### 12. BO
|
|
163
|
+
### 12. BO 映射注解
|
|
248
164
|
|
|
249
165
|
```java
|
|
250
|
-
// ✅
|
|
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
|
-
// ✅
|
|
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
|
-
-- ✅
|
|
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
|
-
-- ❌
|
|
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
|
|
354
|
-
| 视图对象 | Vo | `SysUserVo
|
|
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
|
-
>
|
|
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
|
-
|
|
|
412
|
-
|
|
413
|
-
| `
|
|
414
|
-
| `
|
|
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
|
-
##
|
|
494
|
-
|
|
495
|
-
### Hutool 工具类完整用法
|
|
247
|
+
## 多项目适配
|
|
496
248
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
//
|
|
559
|
-
|
|
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
|
-
|
|
583
|
-
public Page<XxxVO> pageList(XxxQueryParam param) {
|
|
584
|
-
// 使用 PageHelper 分页
|
|
585
|
-
PageMethod.startPage(param.getPage().getPageNum(), param.getPage().getPageSize());
|
|
273
|
+
## 相关 Skill
|
|
586
274
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
275
|
+
| 需要了解 | 激活 Skill |
|
|
276
|
+
|---------|-----------|
|
|
277
|
+
| 后端 CRUD 开发 | `crud-development` |
|
|
278
|
+
| API 开发 | `api-development` |
|
|
279
|
+
| 数据库设计 | `database-ops` |
|
|
280
|
+
| 系统架构 | `architecture-design` |
|