ai-engineering-init 1.3.4 → 1.4.1
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 +2 -0
- package/.claude/settings.json +3 -3
- package/.claude/skills/add-skill/SKILL.md +79 -32
- 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 -365
- package/.claude/skills/leniu-report-customization/references/table-fields.md +93 -0
- package/.claude/skills/leniu-report-standard-customization/SKILL.md +111 -334
- 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 +79 -32
- 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 -365
- package/.codex/skills/leniu-report-customization/references/table-fields.md +93 -0
- package/.codex/skills/leniu-report-standard-customization/SKILL.md +111 -334
- 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/cursor-skill-eval.js +53 -1
- package/.cursor/hooks.json +3 -3
- package/.cursor/skills/add-skill/SKILL.md +79 -32
- 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 -365
- package/.cursor/skills/leniu-report-customization/references/table-fields.md +93 -0
- package/.cursor/skills/leniu-report-standard-customization/SKILL.md +111 -334
- 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/package.json +1 -1
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# Bug 排查详细错误案例库
|
|
2
|
+
|
|
3
|
+
> 本文件是 `bug-detective` 技能的参考文档,包含完整的错误排查案例。
|
|
4
|
+
|
|
5
|
+
## 1. NullPointerException 详细排查
|
|
6
|
+
|
|
7
|
+
```java
|
|
8
|
+
// 常见场景
|
|
9
|
+
User user = baseMapper.selectById(id); // 可能返回 null
|
|
10
|
+
user.getName(); // NPE
|
|
11
|
+
|
|
12
|
+
// 修复方案
|
|
13
|
+
XxxEntity entity = Optional.ofNullable(xxxMapper.selectById(id))
|
|
14
|
+
.orElseThrow(() -> new LeException("记录不存在"));
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**本项目常见 NPE 位置**:
|
|
18
|
+
- `xxxMapper.selectById(id)` 返回 null
|
|
19
|
+
- `BeanUtil.copyProperties()` 源对象为 null
|
|
20
|
+
- 链式调用中间某环节为 null
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 2. SQL 异常详细排查
|
|
25
|
+
|
|
26
|
+
```sql
|
|
27
|
+
-- 检查表是否存在
|
|
28
|
+
SHOW TABLES LIKE 'xxx_table';
|
|
29
|
+
|
|
30
|
+
-- 检查字段
|
|
31
|
+
DESC xxx_table;
|
|
32
|
+
|
|
33
|
+
-- 直接执行验证
|
|
34
|
+
SELECT * FROM xxx_table WHERE id = 1;
|
|
35
|
+
|
|
36
|
+
-- 唯一键冲突检查
|
|
37
|
+
SELECT * FROM xxx_table WHERE unique_field = 'value';
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 3. 权限问题详细排查
|
|
43
|
+
|
|
44
|
+
```java
|
|
45
|
+
// 1. 检查认证注解
|
|
46
|
+
@RequiresAuthentication // leniu 项目使用此注解
|
|
47
|
+
@RequiresGuest // 免登录接口
|
|
48
|
+
|
|
49
|
+
// 2. 检查请求头
|
|
50
|
+
// Admin-Token: xxx (localStorage)
|
|
51
|
+
// MERCHANT-ID: xxx (租户标识)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 4. 事务问题详细排查
|
|
57
|
+
|
|
58
|
+
```java
|
|
59
|
+
// 1. 是否加了事务注解
|
|
60
|
+
@Transactional(rollbackFor = Exception.class)
|
|
61
|
+
|
|
62
|
+
// 2. 异常是否被 try-catch 吞掉
|
|
63
|
+
try {
|
|
64
|
+
// 操作
|
|
65
|
+
} catch (Exception e) {
|
|
66
|
+
log.error("错误", e);
|
|
67
|
+
throw e; // 必须重新抛出,否则事务不回滚
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// 3. 是否在非 public 方法上使用(不生效)
|
|
71
|
+
@Transactional // private 方法不生效
|
|
72
|
+
private void doSomething() {}
|
|
73
|
+
|
|
74
|
+
// 4. 同类调用是否通过 self
|
|
75
|
+
@Autowired @Lazy
|
|
76
|
+
private XxxBusiness self;
|
|
77
|
+
self.transactionalMethod(); // 通过代理调用
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 5. 日志分析完整示例
|
|
83
|
+
|
|
84
|
+
### 场景:接口报 500
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
AI 执行步骤:
|
|
88
|
+
1. Read ./logs/sys-console.log
|
|
89
|
+
-> 找到最后一个 ERROR:NullPointerException at XxxService.java:45
|
|
90
|
+
|
|
91
|
+
2. Read 对应源文件第 45 行
|
|
92
|
+
-> 代码:user.getName()
|
|
93
|
+
|
|
94
|
+
3. 分析日志中的 SQL
|
|
95
|
+
-> SELECT * FROM xxx WHERE id = 999 返回空
|
|
96
|
+
|
|
97
|
+
4. 数据库验证
|
|
98
|
+
-> 确认 ID 999 不存在
|
|
99
|
+
|
|
100
|
+
5. 诊断:用户不存在时代码未判空
|
|
101
|
+
-> 解决:添加 Optional 判空
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 场景:查询慢
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
1. 搜索 SQL 日志
|
|
108
|
+
grep "p6spy" ./logs/sys-console.log
|
|
109
|
+
|
|
110
|
+
2. 分析 Cost 耗时
|
|
111
|
+
- Cost < 50ms -> 正常
|
|
112
|
+
- Cost 50-200ms -> 关注
|
|
113
|
+
- Cost > 200ms -> 优化
|
|
114
|
+
|
|
115
|
+
3. 检查 N+1 查询
|
|
116
|
+
4. 建议添加索引或批量查询
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 场景:租户数据问题
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
1. 搜索 SQL 日志中的查询语句
|
|
123
|
+
2. 检查是否使用了正确的 Executors 切换
|
|
124
|
+
- Executors.doInSystem() -> 系统库
|
|
125
|
+
- 默认 -> 商户库(根据 MERCHANT-ID)
|
|
126
|
+
3. 对比实际数据
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 6. 前端问题排查
|
|
132
|
+
|
|
133
|
+
### 接口调用失败
|
|
134
|
+
|
|
135
|
+
| 状态码 | 含义 | 解决 |
|
|
136
|
+
|--------|------|------|
|
|
137
|
+
| 400 | 参数错误 | 检查参数类型格式 |
|
|
138
|
+
| 401 | 未认证 | 检查 Admin-Token (localStorage) |
|
|
139
|
+
| 403 | 无权限 | 检查角色权限、v-hasPerm |
|
|
140
|
+
| 404 | 接口不存在 | 检查 URL、后端是否启动 |
|
|
141
|
+
| 500 | 服务端错误 | 查后端日志 |
|
|
142
|
+
|
|
143
|
+
### 前端特有问题
|
|
144
|
+
|
|
145
|
+
```javascript
|
|
146
|
+
// 前端成功码是 10000(非 200)
|
|
147
|
+
if (res.code === 10000) { ... }
|
|
148
|
+
|
|
149
|
+
// 金额单位是分,展示需转元
|
|
150
|
+
money(amountInFen)
|
|
151
|
+
|
|
152
|
+
// 加密使用 SM4
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 7. 数据库排查 SQL 模板
|
|
158
|
+
|
|
159
|
+
### 数据关联检查
|
|
160
|
+
|
|
161
|
+
```sql
|
|
162
|
+
SELECT a.*, b.*
|
|
163
|
+
FROM table_a a
|
|
164
|
+
LEFT JOIN table_b b ON a.id = b.a_id
|
|
165
|
+
WHERE a.id = ?;
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### 重复数据检查
|
|
169
|
+
|
|
170
|
+
```sql
|
|
171
|
+
SELECT id, COUNT(*) FROM 表 GROUP BY id HAVING COUNT(*) > 1;
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 孤立数据检查
|
|
175
|
+
|
|
176
|
+
```sql
|
|
177
|
+
SELECT a.id FROM 主表 a
|
|
178
|
+
LEFT JOIN 子表 b ON a.id = b.主表id
|
|
179
|
+
WHERE b.id IS NULL;
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 性能检查
|
|
183
|
+
|
|
184
|
+
```sql
|
|
185
|
+
-- 执行计划
|
|
186
|
+
EXPLAIN SELECT * FROM 表 WHERE 条件;
|
|
187
|
+
|
|
188
|
+
-- type: ALL(全表扫描需优化) | index | range | ref | const(最优)
|
|
189
|
+
|
|
190
|
+
-- 检查索引
|
|
191
|
+
SHOW INDEX FROM 表;
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## 8. 多数据库差异
|
|
197
|
+
|
|
198
|
+
| 功能 | MySQL | PostgreSQL |
|
|
199
|
+
|------|-------|------------|
|
|
200
|
+
| 分页 | `LIMIT 10` | `LIMIT 10` |
|
|
201
|
+
| 字符串连接 | `CONCAT()` | `||` |
|
|
202
|
+
| 当前时间 | `NOW()` | `NOW()` |
|
|
203
|
+
| 类型转换 | `CAST()` | `::` |
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## 9. Bean 注入失败排查
|
|
208
|
+
|
|
209
|
+
```java
|
|
210
|
+
// NoSuchBeanDefinitionException 排查步骤:
|
|
211
|
+
// 1. 检查是否有 @Service/@Component
|
|
212
|
+
@Service
|
|
213
|
+
public class XxxServiceImpl implements XxxService { ... }
|
|
214
|
+
|
|
215
|
+
// 2. 检查包路径(必须 net.xnzn.core.*)
|
|
216
|
+
package net.xnzn.core.xxx.service.impl;
|
|
217
|
+
|
|
218
|
+
// 3. 检查循环依赖(A->B->A)
|
|
219
|
+
// 4. 检查接口与实现类是否匹配
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## 10. 排查清单
|
|
225
|
+
|
|
226
|
+
### 后端
|
|
227
|
+
|
|
228
|
+
- [ ] 是否读取了日志文件 `./logs/sys-console.log`?
|
|
229
|
+
- [ ] 异常堆栈包名是否为 `net.xnzn.core.*`?
|
|
230
|
+
- [ ] Controller 路由前缀是否正确(`/api/v2/web|mobile|android/{module}`)?
|
|
231
|
+
- [ ] Service 是否直接注入 Mapper(无 DAO 层)?
|
|
232
|
+
- [ ] 非字符串字段是否使用了 eq/in/between 而不是 like?
|
|
233
|
+
- [ ] BeanUtil.copyProperties() 转换前是否判空?
|
|
234
|
+
- [ ] 双库切换是否正确(Executors.doInSystem/doInTenant)?
|
|
235
|
+
- [ ] del_flag 是否用 2=正常、1=删除?
|
|
236
|
+
- [ ] 数据库中是否真的存在需要的数据?
|
|
237
|
+
|
|
238
|
+
### 前端
|
|
239
|
+
|
|
240
|
+
- [ ] Network 中接口状态码和响应内容?
|
|
241
|
+
- [ ] 成功码是否判断 10000?
|
|
242
|
+
- [ ] Admin-Token 和 MERCHANT-ID 请求头是否正确?
|