Files
ccdi/docs/reports/implementation/2026-05-07-staff-recruitment-allow-duplicate-recruit-id.md

44 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.
# 招聘项目编号允许重复实施记录
## 保存路径确认
- 实施记录保存路径:`docs/reports/implementation/2026-05-07-staff-recruitment-allow-duplicate-recruit-id.md`
- 本次为招聘信息主从表关联修正,使用实施记录目录保存。
## 修改内容
1. 移除新增、编辑、导入时对 `recruit_id` 的重复拦截,招聘项目编号允许重复。
2. `ccdi_staff_recruitment_work` 新增 `recruitment_id`,历史工作经历改为关联招聘主表自增 `id`
3. 列表历史工作经历条数、详情历史工作经历、编辑保存和删除清理均改为按 `recruitment_id` 处理。
4. 导入模板字段保持不变,历史工作经历导入时通过“招聘项目编号 + 候选人姓名 + 招聘项目名称 + 职位名称”匹配主记录;匹配多条时返回失败,避免错误归属。
5. 更新初始化 SQL、增量 SQL、数据库字段说明和 API 文档。
## 影响范围
- 后端服务:招聘信息 CRUD、双 Sheet 导入、历史工作经历查询与清理。
- 数据库表:`ccdi_staff_recruitment``ccdi_staff_recruitment_work`
- 前端页面:接口仍传主表 `id`,页面字段无新增。
- 导入功能:模板不新增主键列。
## 验证情况
1. 数据库迁移已执行:
- `sh bin/mysql_utf8_exec.sh sql/migration/2026-05-07-allow-duplicate-staff-recruitment-id.sql`
- 回查确认 `ccdi_staff_recruitment.recruit_id` 为普通索引,`ccdi_staff_recruitment_work.recruitment_id` 为非空字段并已建立索引。
2. 后端定向测试通过:
- `mvn -pl ccdi-info-collection -am -Dtest=CcdiStaffRecruitmentImportServiceImplTest,CcdiStaffRecruitmentDualImportContractTest -Dsurefire.failIfNoSpecifiedTests=false test`
3. 前端构建通过:
- `cd ruoyi-ui && nvm use && npm run build:prod`
- 构建仅保留既有资源体积 warning。
4. 真实页面验证:
- 已按项目规则优先尝试 `browser-use`,但当前 Codex 环境没有可用 in-app browser pane运行时返回 `No active Codex browser pane available`
- 使用本机 Playwright 兜底打开真实页面 `http://localhost:8080/maintain/staffRecruitment` 验证。
- 通过接口新增两条相同招聘项目编号 `RC-DUP-20260507003554` 的招聘记录,均返回操作成功。
- 给第一条记录插入 1 条历史工作经历后,页面列表展示两条同编号记录:`TestA``1段``TestB``0段`
- 打开 `TestA` 详情可见 `Company A` 历史工作经历;打开 `TestB` 详情显示“暂无历史工作经历”,未发生串数据。
- 后端日志确认列表按 `recruitment_id` 聚合历史工作经历,详情查询分别按 `recruitment_id = 6003``recruitment_id = 6004` 查询从表。
5. 清理情况:
- 已删除本轮测试主表和从表造数。
- 已关闭 Playwright 浏览器。
- 已停止本轮启动的前端 `8080` 与后端 `62318` 进程,端口回查无监听。