Files
pkAssistant/plan/2026-02-08_23-45-12-map-to-lambda-migration-report.md

36 lines
2.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Map/注解SQL 到 DTO/Lambda 迁移映射说明CMLR-110
## 1. 方法迁移映射(旧 -> 新)
| 旧位置/方法 | 新位置/方法 | 说明 |
| --- | --- | --- |
| `UserDao.queryWithPhoneNumber` 注解 SQL | `UserDao.queryWithPhoneNumber` default + `Wrappers.lambdaQuery` | 用户手机号查询改为 Lambda补齐 `UserModel.mobile` 映射。 |
| `UserDao.findCreatedPk` | `PkRecordDao.findCreatedPk` | 跨表 `pk_record` 查询归位到 `PkRecordDao`。 |
| `UserDao.getMyGuestPkList` | `PkRecordDao.getMyGuestPkList` | 跨表 `pk_record` 查询归位到 `PkRecordDao`。 |
| `UserDao.signIn` | `SignInRecordDao.signIn` | 新增 `SignInRecord` 实体与 Dao 承接签到写入。 |
| `UserDao.checkSignStatus` | `SignInRecordDao.checkSignStatus` | 当日签到状态查询迁移到 `sign_in_records` 专属 Dao。 |
| `PkRecordDao.fetchDetailPkDataWithId` 跨表 SQL | `PkRecordDetailDao.queryDetail` | 明细查询归位到 `pk_record_detail` 对应 Dao。 |
| `PkInfoDao.checkIfUnfinishedPKExistsWithAnchor` 跨表 SQL | `PkRecordDao.checkIfUnfinishedPKExistsWithAnchor` | 未完成记录检查归位到 `PkRecordDao`。 |
| `PkInfoDao.selectPkInfoByCondition` 动态注解 SQL | `PkInfoDao.selectPkInfoByCondition` default + `LambdaQueryWrapper` + `last` | 条件拼装迁移为 Lambda排序 SQL 通过 `last` 保序。 |
| `PkInfoDao.queryCanUseData/queryAllPkData/...` 注解 SQL | 对应 `PkInfoDao` default Lambda 方法 | 静态 SQL 批量迁移到 Wrapper。 |
| `PkRecordDao.pkListForToday/fetchDataFromTodayWithUserId/...` 注解 SQL | 对应 `PkRecordDao` default Lambda 方法 | PK 记录相关静态 SQL 迁移。 |
## 2. 风险点
1. `Lombok` 注解处理在当前仓库编译链路中未生效,导致 `mvn clean test` 无法执行,自动化证据受限。
2. `system_user/system_users` 表名历史不一致,需在目标环境确认最终物理表映射。
3. `pk_time``PkRecord` 为字符串字段,迁移后时间比较依赖字符串时间戳格式稳定。
4. `SignInRecordDao` 使用 `Asia/Shanghai` 日期写入,需与数据库时区策略一致。
## 3. 回滚策略
1. 按 feature commit 粒度回滚(`git revert`):优先回滚 `3246146`(跨表归位)、`a78b06f`(动态查询)、`8692b10`静态SQL迁移`32a6d71`User查询迁移
2. 若线上仅出现单链路问题,优先局部回滚对应 mapper 文件(例如仅回滚 `PkInfoDao.selectPkInfoByCondition`)。
3. 保留 `ControllerMapToDtoContractTests` 与 DAO/E2E catalog 测试目录,回滚后再次执行以确认契约恢复。
## 4. 兼容性结论
1. Controller 层 18 个历史 `@RequestBody Map` 端点已替换为 DTOURL 与返回类型保持不变。
2. DAO 层迁移采用 default 方法 + MyBatis-Plus Wrapper保持方法签名与调用入口稳定。
3. 受限项:当前环境无法完成 `mvn clean test`,因此“行为完全等价”仍需在修复编译基线后做最终运行态确认。