-- 将 pap_spider_news 中 id=119~126 的公益项目数据转入 pap_article，column_id=5
-- content 优先取已转存的 content，其次取原始 content_original
INSERT INTO `pap_article` (`column_id`, `title`, `summary`, `content`, `cover`, `category`, `is_top`, `status`, `publish_time`, `sort`, `create_time`)
SELECT
  5 AS column_id,
  s.title,
  '' AS summary,
  COALESCE(s.content, s.content_original, '') AS content,
  COALESCE(s.cover, s.cover_original, '') AS cover,
  s.category,
  0 AS is_top,
  1 AS status,
  s.publish_time,
  0 AS sort,
  NOW()
FROM `pap_spider_news` s
WHERE s.id IN (119, 120, 121, 122, 123, 124, 125, 126);

-- 回写 article_id 到 spider_news（方便追溯）
UPDATE `pap_spider_news` sn
INNER JOIN `pap_article` a ON a.title = sn.title AND a.column_id = 5
SET sn.article_id = a.id, sn.status = 3
WHERE sn.id IN (119, 120, 121, 122, 123, 124, 125, 126);
