Files
ccdi/docs/reports/implementation/2026-05-07-staff-recruitment-auto-id-primary-key.md

48 lines
2.5 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.
# 招聘信息自增主键实施记录
## 保存路径确认
- 实施记录保存路径:`docs/reports/implementation/2026-05-07-staff-recruitment-auto-id-primary-key.md`
- 本次为招聘信息主键结构调整,使用实施记录目录保存。
## 修改内容
1. `ccdi_staff_recruitment` 新增 `id` 自增主键,`recruit_id` 调整为普通业务编号。
2. 后端实体 `CcdiStaffRecruitment` 的 MyBatis Plus 主键从 `recruitId` 切换为 `id`
3. 招聘信息详情、编辑、删除接口改为按 `id` 定位记录。
4. 招聘信息列表和详情 SQL 返回 `id` 字段,前端列表行操作改为传递 `id`
5. 导入链路继续在模板中填写 `recruit_id`,后续补充改为由后端解析到招聘主表 `id`
6. 补充迁移脚本 `sql/migration/2026-05-07-add-staff-recruitment-auto-id.sql`,同步更新初始化 SQL 与数据库字段说明。
7. 同步更新招聘信息 API 文档中详情、编辑、删除的主键参数说明。
## 影响范围
- 后端接口:`/ccdi/staffRecruitment/{id}``PUT /ccdi/staffRecruitment``DELETE /ccdi/staffRecruitment/{ids}`
- 前端页面:`ruoyi-ui/src/views/ccdiStaffRecruitment/index.vue`
- 数据库表:`ccdi_staff_recruitment`
- 导入功能:招聘主信息与历史工作经历模板字段不变,后续补充改为落库时关联招聘主表 `id`
## 数据库执行
- 已通过 `bin/mysql_utf8_exec.sh sql/migration/2026-05-07-add-staff-recruitment-auto-id.sql` 执行本地 dev 库迁移。
- 回查结果:
- `id``PRIMARY``auto_increment`
- `recruit_id`:普通索引,允许重复。
## 验证情况
1. 后端定向测试通过:
- `mvn -pl ccdi-info-collection -am -Dtest=CcdiStaffRecruitmentImportServiceImplTest,CcdiStaffRecruitmentDualImportContractTest -Dsurefire.failIfNoSpecifiedTests=false test`
2. 前端生产构建通过:
- `cd ruoyi-ui && nvm use && npm run build:prod`
- 构建仅保留既有资源体积 warning。
3. 后端重启验证通过:
- `sh bin/restart_java_backend.sh restart`
- 应用启动成功。
4. 真实页面验证通过:
- 使用 browser-use 打开 `http://localhost:8080/maintain/staffRecruitment`
- 登录后招聘信息维护列表正常展示。
- 点击 `RC2025001001` 详情,后端日志显示详情 SQL 使用 `WHERE id = ?` 查询主表。
- 历史工作经历后续补充改为使用招聘主表 `id` 查询,避免编号重复时串数据。
5. 测试后已关闭本轮启动的前端 `8080` 与后端 `62318` 进程,端口回查无监听。