-- 查询性能索引补充（按前端高频接口整理）
-- 适用场景：
-- 1) /api/job_postings/page_list, /api/job_postings/deliver_status_map
-- 2) /api/apply/list, /api/apply/statistics
-- 3) /api/task/command/page_list
-- 4) /api/user/account-config/get 中 resume_info 最新记录查询

-- =========================
-- job_postings
-- =========================
ALTER TABLE `job_postings`
  ADD INDEX `idx_job_postings_sn_platform_modify` (`sn_code`, `platform`, `last_modify_time`);

ALTER TABLE `job_postings`
  ADD INDEX `idx_job_postings_sn_create` (`sn_code`, `create_time`);

-- =========================
-- apply_records
-- =========================
ALTER TABLE `apply_records`
  ADD INDEX `idx_apply_records_sn_create` (`sn_code`, `create_time`);

ALTER TABLE `apply_records`
  ADD INDEX `idx_apply_records_sn_platform_create` (`sn_code`, `platform`, `create_time`);

ALTER TABLE `apply_records`
  ADD INDEX `idx_apply_records_sn_apply_status_create` (`sn_code`, `applyStatus`, `create_time`);

ALTER TABLE `apply_records`
  ADD INDEX `idx_apply_records_sn_feedback_status_create` (`sn_code`, `feedbackStatus`, `create_time`);

-- =========================
-- task_status
-- =========================
ALTER TABLE `task_status`
  ADD INDEX `idx_task_status_sn_id` (`sn_code`, `id`);

ALTER TABLE `task_status`
  ADD INDEX `idx_task_status_sn_status_id` (`sn_code`, `status`, `id`);

-- =========================
-- task_commands
-- =========================
ALTER TABLE `task_commands`
  ADD INDEX `idx_task_commands_task_id_id` (`task_id`, `id`);

ALTER TABLE `task_commands`
  ADD INDEX `idx_task_commands_task_id_status_id` (`task_id`, `status`, `id`);

-- =========================
-- resume_info / pla_account
-- =========================
ALTER TABLE `resume_info`
  ADD INDEX `idx_resume_info_sn_platform_active_modify` (`sn_code`, `platform`, `isActive`, `last_modify_time`);

ALTER TABLE `pla_account`
  ADD INDEX `idx_pla_account_sn_code` (`sn_code`);

