fix: 完善工具导出和类型转换 (-35 errors)

This commit is contained in:
wanwu
2025-10-29 21:11:32 +08:00
parent 944034695e
commit b20db79771
3 changed files with 61 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
## 🎯 当前进度总结
### ✅ 已完成的架构改进
1. **中央Service方法签名索引** (1038个方法)
- Scanner提取所有Java方法参数
- Coordinator构建全局索引
- ControllerGenerator使用索引不再读文件
2. **Java类型智能映射**
- Integer/Long → number (自动Number()转换)
- String → string (直接使用)
- Boolean → boolean
3. **Controller参数匹配V6**
- 路径参数id: Integer → Number(id)
- Query参数name: String → query.name
- Query参数count: Integer → Number(query.count)
- Body参数dto: XxxDto → body
### 📊 错误改善
- 初始14,382 个
- 当前14,121 个
- **减少261 个 (-1.8%)**
#### Controller层重点
- 初始162 个
- 当前49 个
- **减少113 个 (-69.8%)**
#### Service层
- 当前:~14,072 个 (占99.65%)
- 主要问题Java语法转换、Repository注入、Entity导入
### 🔄 下一步计划
Service层转换器完善14,000+错误):
1. 完善变量声明转换Java泛型、数组
2. 完善Collection转换所有集合构造
3. Repository动态注入
4. Entity动态导入
5. Java工具类映射ObjectUtil/CollUtil/StrUtil
6. 异常转换CommonException → BadRequestException
7. 类型转换语法
---
2025-10-29 21:02:55

View File

@@ -84,6 +84,9 @@ class TypeConverter {
// 【Map/Set】→ TypeScript类型
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Record<String, ...> → Record<string, ...> (泛型中的String要小写)
tsCode = tsCode.replace(/Record<String,\s*/g, 'Record<string, ');
// Map<K,V> → Record<K, V>
tsCode = tsCode.replace(/Map<(\w+),\s*(\w+)>/g, 'Record<$1, $2>');

View File

@@ -1,7 +1,15 @@
// 统一导出所有工具类
export * from "./string.utils";
export * from "./common.utils";
export * from "./json.utils";
export * from "./file.utils";
export * from "./date.utils";
export * from "./crypto.utils";
// 重新导出保持与Java工具类命名一致
export { StringUtils } from "./string.utils";
export { CommonUtils } from "./common.utils";
export { JsonUtils } from "./json.utils";
export { FileUtils } from "./file.utils";
export { DateUtils } from "./date.utils";
export { CryptoUtils } from "./crypto.utils";