|
@@ -0,0 +1,524 @@
|
|
|
|
|
+-- 创建“华夏新闻网”二级站,并从新闻网-2026迁移模板语义范围内的已发布内容。
|
|
|
|
|
+-- 新闻网-2026及其模板保持只读不变。
|
|
|
|
|
+
|
|
|
|
|
+SET NAMES utf8mb4;
|
|
|
|
|
+
|
|
|
|
|
+DROP PROCEDURE IF EXISTS sp_hxcs_create_huaxia_news_site;
|
|
|
|
|
+DELIMITER //
|
|
|
|
|
+CREATE PROCEDURE sp_hxcs_create_huaxia_news_site()
|
|
|
|
|
+BEGIN
|
|
|
|
|
+ DECLARE v_count INT DEFAULT 0;
|
|
|
|
|
+ DECLARE v_expected_nav_map_count INT DEFAULT 0;
|
|
|
|
|
+ DECLARE v_source_article_count INT DEFAULT 0;
|
|
|
|
|
+ DECLARE v_target_article_count INT DEFAULT 0;
|
|
|
|
|
+ DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
|
|
|
+ BEGIN
|
|
|
|
|
+ ROLLBACK;
|
|
|
|
|
+ RESIGNAL;
|
|
|
|
|
+ END;
|
|
|
|
|
+
|
|
|
|
|
+ START TRANSACTION;
|
|
|
|
|
+
|
|
|
|
|
+ SET @source_website_id := NULL;
|
|
|
|
|
+ SET @target_website_id := NULL;
|
|
|
|
|
+ SET @target_template_id := NULL;
|
|
|
|
|
+ SET @target_unit_id := 10000;
|
|
|
|
|
+ SET @operator_pid := 10000;
|
|
|
|
|
+ SET @target_domain_host := 'xinwen.hxcs.feifan.net';
|
|
|
|
|
+ SET @target_domain := 'xinwen.hxcs.feifan.net;';
|
|
|
|
|
+ SET @target_site_id_code := 'hxcs_huaxia_news_site_v1';
|
|
|
|
|
+ SET @target_template_id_code := 'hxcs_ffkjnewsred1_tpl';
|
|
|
|
|
+
|
|
|
|
|
+ SELECT COUNT(*) INTO v_count
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.website
|
|
|
|
|
+ WHERE websiteid = 10070
|
|
|
|
|
+ AND dcode = 61
|
|
|
|
|
+ AND name = '广州华夏职业学院'
|
|
|
|
|
+ AND FIND_IN_SET('hxcs.feifan.net', REPLACE(TRIM(BOTH ';' FROM IFNULL(domains, '')), ';', ',')) > 0;
|
|
|
|
|
+ IF v_count <> 1 THEN
|
|
|
|
|
+ SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = '主站定位不唯一,停止创建华夏新闻网';
|
|
|
|
|
+ END IF;
|
|
|
|
|
+
|
|
|
|
|
+ SELECT websiteid INTO @source_website_id
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.website
|
|
|
|
|
+ WHERE websiteid = 10073
|
|
|
|
|
+ AND dcode = 61
|
|
|
|
|
+ AND name = '新闻网-2026'
|
|
|
|
|
+ AND FIND_IN_SET('xinwen2026.hxcs.feifan.net', REPLACE(TRIM(BOTH ';' FROM IFNULL(domains, '')), ';', ',')) > 0
|
|
|
|
|
+ ORDER BY websiteid
|
|
|
|
|
+ LIMIT 1;
|
|
|
|
|
+ IF @source_website_id IS NULL THEN
|
|
|
|
|
+ SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = '新闻网-2026定位失败,停止创建华夏新闻网';
|
|
|
|
|
+ END IF;
|
|
|
|
|
+
|
|
|
|
|
+ SELECT COUNT(*) INTO v_count
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.website
|
|
|
|
|
+ WHERE websiteid <> 10070
|
|
|
|
|
+ AND dcode <> 72
|
|
|
|
|
+ AND FIND_IN_SET(@target_domain_host, REPLACE(TRIM(BOTH ';' FROM IFNULL(domains, '')), ';', ',')) > 0;
|
|
|
|
|
+ IF v_count <> 0 THEN
|
|
|
|
|
+ SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = '华夏新闻网域名已被其他网站占用,停止创建';
|
|
|
|
|
+ END IF;
|
|
|
|
|
+
|
|
|
|
|
+ -- 模板登记。
|
|
|
|
|
+ SELECT wtid INTO @target_template_id
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.website_template
|
|
|
|
|
+ WHERE config = 'ffkjnewsred1'
|
|
|
|
|
+ AND dcode = 61
|
|
|
|
|
+ ORDER BY wtid
|
|
|
|
|
+ LIMIT 1;
|
|
|
|
|
+
|
|
|
|
|
+ IF @target_template_id IS NULL THEN
|
|
|
|
|
+ INSERT INTO sp_gzhx_apps_mig_next.website_template (
|
|
|
|
|
+ dcode, unitid, name, `desc`, preview_url, thumbnail, wtccode, wttcode, wtacode,
|
|
|
|
|
+ cms, config, create_time, create_pid, id_code, sort_number
|
|
|
|
|
+ )
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ 61, source_tpl.unitid, '非繁新闻资讯模板-红色',
|
|
|
|
|
+ '面向新闻网资讯型首页的红色独立模板,栏目和文章全部由 ZQ 后台维护。',
|
|
|
|
|
+ CONCAT('https://', @target_domain_host, '/'), source_tpl.thumbnail,
|
|
|
|
|
+ source_tpl.wtccode, 10020, source_tpl.wtacode,
|
|
|
|
|
+ source_tpl.cms, 'ffkjnewsred1', NOW(), @operator_pid, @target_template_id_code, source_tpl.sort_number + 1
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.website_template source_tpl
|
|
|
|
|
+ WHERE source_tpl.wtid = 61
|
|
|
|
|
+ AND source_tpl.dcode = 61
|
|
|
|
|
+ AND source_tpl.config = 'ffkjcollegered1'
|
|
|
|
|
+ LIMIT 1;
|
|
|
|
|
+
|
|
|
|
|
+ SET @target_template_id := LAST_INSERT_ID();
|
|
|
|
|
+ END IF;
|
|
|
|
|
+
|
|
|
|
|
+ IF @target_template_id IS NULL THEN
|
|
|
|
|
+ SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = '新闻红模板登记失败,停止创建华夏新闻网';
|
|
|
|
|
+ END IF;
|
|
|
|
|
+
|
|
|
|
|
+ UPDATE sp_gzhx_apps_mig_next.website_template
|
|
|
|
|
+ SET dcode = 61,
|
|
|
|
|
+ unitid = @target_unit_id,
|
|
|
|
|
+ name = '非繁新闻资讯模板-红色',
|
|
|
|
|
+ `desc` = '面向新闻网资讯型首页的红色独立模板,栏目和文章全部由 ZQ 后台维护。',
|
|
|
|
|
+ preview_url = CONCAT('https://', @target_domain_host, '/'),
|
|
|
|
|
+ config = 'ffkjnewsred1',
|
|
|
|
|
+ id_code = @target_template_id_code
|
|
|
|
|
+ WHERE wtid = @target_template_id;
|
|
|
|
|
+
|
|
|
|
|
+ -- 模板栏目。模板只描述结构,不承载文章。
|
|
|
|
|
+ DROP TEMPORARY TABLE IF EXISTS tmp_hxn_template_nav_seed;
|
|
|
|
|
+ CREATE TEMPORARY TABLE tmp_hxn_template_nav_seed (
|
|
|
|
|
+ idcard VARCHAR(128) NOT NULL,
|
|
|
|
|
+ parent_idcard VARCHAR(128) NULL,
|
|
|
|
|
+ name VARCHAR(256) NOT NULL,
|
|
|
|
|
+ name_assistant VARCHAR(256) NULL,
|
|
|
|
|
+ description VARCHAR(2048) NOT NULL,
|
|
|
|
|
+ wntcode INT NOT NULL,
|
|
|
|
|
+ wnscode INT NOT NULL,
|
|
|
|
|
+ wnjtcode INT NOT NULL,
|
|
|
|
|
+ wnlscode INT NULL,
|
|
|
|
|
+ uri VARCHAR(512) NULL,
|
|
|
|
|
+ url VARCHAR(512) NULL,
|
|
|
|
|
+ sort_number INT NOT NULL,
|
|
|
|
|
+ photo_width INT NULL,
|
|
|
|
|
+ photo_height INT NULL
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ INSERT INTO tmp_hxn_template_nav_seed VALUES
|
|
|
|
|
+ ('FFKJ_NEWS_RED_HOME', NULL, '首页', 'Home', '华夏新闻网首页。', 10000, 10000, 10000, NULL, NULL, '/', 10, NULL, NULL),
|
|
|
|
|
+ ('FFKJ_NEWS_RED_CAMPUS', NULL, '校园新闻', 'Campus News', '校园新闻栏目。', 10010, 10000, 10010, 10000, 'xiaoyuanxinwen', '/xiaoyuanxinwen/', 20, 480, 320),
|
|
|
|
|
+ ('FFKJ_NEWS_RED_MEDIA', NULL, '媒体华夏', 'Media', '媒体华夏栏目。', 10010, 10000, 10010, 10000, 'meiti', '/meiti/', 30, 733, 296),
|
|
|
|
|
+ ('FFKJ_NEWS_RED_NOTICE', NULL, '通知公告', 'Notices', '通知公告栏目。', 10010, 10000, 10010, 10000, 'gonggao', '/gonggao/', 40, 480, 320),
|
|
|
|
|
+ ('FFKJ_NEWS_RED_CONVERGED', NULL, '融媒头条', 'Multimedia', '融媒头条目录栏目。', 10050, 10000, 10010, 10010, 'rongmeitoutiao', '/rongmeitoutiao/', 50, 733, 296),
|
|
|
|
|
+ ('FFKJ_NEWS_RED_FRONTLINE', NULL, '一线动态', 'From the Campus', '一线动态栏目。', 10010, 10000, 10010, 10000, 'yixiandongtai', '/yixiandongtai/', 60, 480, 320),
|
|
|
|
|
+ ('FFKJ_NEWS_RED_DOWNLOAD', NULL, '下载专栏', 'Downloads', '下载专栏。', 10010, 10000, 10010, 10000, 'xiazai', '/xiazai/', 70, 480, 320),
|
|
|
|
|
+ ('FFKJ_COLLEGE_HOME_GROUP', NULL, '首页子栏目', 'Home Sections', '首页和底部维护栏目。', 10051, 10030, 10010, NULL, NULL, NULL, 9000, NULL, NULL),
|
|
|
|
|
+ ('FFKJ_COLLEGE_SCHOOL_HOME', 'FFKJ_COLLEGE_HOME_GROUP', '顶部自定义栏目', 'Top Links', '顶部快捷入口维护。', 10010, 10030, 10010, 10000, 'top-links', '/top-links/', 1, 480, 320),
|
|
|
|
|
+ ('FFKJ_COLLEGE_FOOTER_INFO', 'FFKJ_COLLEGE_HOME_GROUP', '底部基础信息', 'Footer Info', '底部地址、电话、版权等基础信息。', 10010, 10030, 10010, 10000, 'dibujichuxinxi', '/dibujichuxinxi/', 9980, NULL, NULL),
|
|
|
|
|
+ ('FFKJ_COLLEGE_FOOTER_LINKS', 'FFKJ_COLLEGE_HOME_GROUP', '底部自定义栏目', 'Footer Links', '底部自定义链接维护。', 10010, 10030, 10010, 10000, 'dibuzidingyilanmu', '/dibuzidingyilanmu/', 9990, NULL, NULL),
|
|
|
|
|
+ ('FFKJ_NEWS_RED_HERO', 'FFKJ_COLLEGE_HOME_GROUP', '首页轮播', 'Hero', '新闻红模板隐藏轮播来源栏目。', 10010, 10030, 10010, 10010, 'shouyelunbo', '/shouyelunbo/', 2, 1920, 500),
|
|
|
|
|
+ ('FFKJ_NEWS_RED_VIDEO', 'FFKJ_NEWS_RED_CONVERGED', '视频', 'Video', '融媒头条视频内容。', 10010, 10000, 10010, 10010, 'shipin', '/rongmeitoutiao/shipin/', 10, 733, 296),
|
|
|
|
|
+ ('FFKJ_NEWS_RED_WECHAT', 'FFKJ_NEWS_RED_CONVERGED', '微信作品', 'WeChat', '融媒头条微信作品。', 10010, 10000, 10010, 10010, 'weixin', '/rongmeitoutiao/weixin/', 20, 733, 296),
|
|
|
|
|
+ ('FFKJ_NEWS_RED_GALLERY', 'FFKJ_NEWS_RED_CONVERGED', '图集', 'Gallery', '融媒头条图集。', 10010, 10000, 10010, 10010, 'tuji', '/rongmeitoutiao/tuji/', 30, 733, 296);
|
|
|
|
|
+
|
|
|
|
|
+ INSERT INTO sp_gzhx_apps_mig_next.website_navigation (
|
|
|
|
|
+ dcode, unitid, wnccode, websiteid, wtid, idcard, name, name_assistant, title, `desc`,
|
|
|
|
|
+ wntcode, wnscode, wnjtcode, wnlscode, uri, url, jump_url, jump_websiteid, parent_nid,
|
|
|
|
|
+ photo_size_width, photo_size_height, background_image, sort_number, create_time, create_pid,
|
|
|
|
|
+ id_code, guest_access_flag
|
|
|
|
|
+ )
|
|
|
|
|
+ SELECT 61, @target_unit_id, 10010, NULL, @target_template_id, s.idcard, s.name, s.name_assistant,
|
|
|
|
|
+ s.name, s.description, s.wntcode, s.wnscode, s.wnjtcode, s.wnlscode, s.uri, s.url,
|
|
|
|
|
+ NULL, NULL, NULL, s.photo_width, s.photo_height, NULL, s.sort_number, NOW(), @operator_pid,
|
|
|
|
|
+ NULL, 0
|
|
|
|
|
+ FROM tmp_hxn_template_nav_seed s
|
|
|
|
|
+ WHERE NOT EXISTS (
|
|
|
|
|
+ SELECT 1 FROM sp_gzhx_apps_mig_next.website_navigation n
|
|
|
|
|
+ WHERE n.wtid = @target_template_id AND n.idcard = s.idcard
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ UPDATE sp_gzhx_apps_mig_next.website_navigation n
|
|
|
|
|
+ JOIN tmp_hxn_template_nav_seed s ON s.idcard = n.idcard
|
|
|
|
|
+ SET n.dcode = 61,
|
|
|
|
|
+ n.unitid = @target_unit_id,
|
|
|
|
|
+ n.wnccode = 10010,
|
|
|
|
|
+ n.websiteid = NULL,
|
|
|
|
|
+ n.wtid = @target_template_id,
|
|
|
|
|
+ n.name = s.name,
|
|
|
|
|
+ n.name_assistant = s.name_assistant,
|
|
|
|
|
+ n.title = s.name,
|
|
|
|
|
+ n.`desc` = s.description,
|
|
|
|
|
+ n.wntcode = s.wntcode,
|
|
|
|
|
+ n.wnscode = s.wnscode,
|
|
|
|
|
+ n.wnjtcode = s.wnjtcode,
|
|
|
|
|
+ n.wnlscode = s.wnlscode,
|
|
|
|
|
+ n.uri = s.uri,
|
|
|
|
|
+ n.url = s.url,
|
|
|
|
|
+ n.jump_url = NULL,
|
|
|
|
|
+ n.jump_websiteid = NULL,
|
|
|
|
|
+ n.photo_size_width = s.photo_width,
|
|
|
|
|
+ n.photo_size_height = s.photo_height,
|
|
|
|
|
+ n.sort_number = s.sort_number,
|
|
|
|
|
+ n.guest_access_flag = 0
|
|
|
|
|
+ WHERE n.wtid = @target_template_id;
|
|
|
|
|
+
|
|
|
|
|
+ UPDATE sp_gzhx_apps_mig_next.website_navigation n
|
|
|
|
|
+ SET n.parent_nid = NULL
|
|
|
|
|
+ WHERE n.wtid = @target_template_id;
|
|
|
|
|
+
|
|
|
|
|
+ UPDATE sp_gzhx_apps_mig_next.website_navigation child
|
|
|
|
|
+ JOIN tmp_hxn_template_nav_seed s ON s.idcard = child.idcard
|
|
|
|
|
+ JOIN sp_gzhx_apps_mig_next.website_navigation parent
|
|
|
|
|
+ ON parent.wtid = @target_template_id AND parent.idcard = s.parent_idcard
|
|
|
|
|
+ SET child.parent_nid = parent.navigationid
|
|
|
|
|
+ WHERE child.wtid = @target_template_id
|
|
|
|
|
+ AND s.parent_idcard IS NOT NULL;
|
|
|
|
|
+
|
|
|
|
|
+ -- 创建或校准目标网站。
|
|
|
|
|
+ SELECT websiteid INTO @target_website_id
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.website
|
|
|
|
|
+ WHERE id_code = @target_site_id_code
|
|
|
|
|
+ OR (name = '华夏新闻网' AND FIND_IN_SET(@target_domain_host, REPLACE(TRIM(BOTH ';' FROM IFNULL(domains, '')), ';', ',')) > 0)
|
|
|
|
|
+ ORDER BY (id_code = @target_site_id_code) DESC, websiteid
|
|
|
|
|
+ LIMIT 1;
|
|
|
|
|
+
|
|
|
|
|
+ IF @target_website_id IS NULL THEN
|
|
|
|
|
+ INSERT INTO sp_gzhx_apps_mig_next.website (
|
|
|
|
|
+ dcode, unitid, wtcode, wtid, parent_wid, name, `desc`, protocol, port, domains,
|
|
|
|
|
+ catalog_uri, logo, white_logo_file, seo_icon, seo_title, seo_keywords,
|
|
|
|
|
+ seo_description, create_time, create_pid, id_code, sort_number
|
|
|
|
|
+ )
|
|
|
|
|
+ SELECT 61, @target_unit_id, 10010, @target_template_id, parent_website.websiteid,
|
|
|
|
|
+ '华夏新闻网', '广州华夏职业学院新闻网,使用非繁新闻资讯模板-红色。',
|
|
|
|
|
+ 'https', 443, @target_domain, '/', source_site.logo, source_site.white_logo_file,
|
|
|
|
|
+ COALESCE(source_site.seo_icon, parent_website.seo_icon),
|
|
|
|
|
+ '华夏新闻网', '广州华夏职业学院,新闻网,融媒头条',
|
|
|
|
|
+ '广州华夏职业学院新闻网。', NOW(), @operator_pid, @target_site_id_code, 9992
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.website parent_website
|
|
|
|
|
+ JOIN sp_gzhx_apps_mig_next.website source_site ON source_site.websiteid = @source_website_id
|
|
|
|
|
+ WHERE parent_website.websiteid = 10070
|
|
|
|
|
+ LIMIT 1;
|
|
|
|
|
+
|
|
|
|
|
+ SET @target_website_id := LAST_INSERT_ID();
|
|
|
|
|
+ END IF;
|
|
|
|
|
+
|
|
|
|
|
+ IF @target_website_id IS NULL THEN
|
|
|
|
|
+ SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = '华夏新闻网创建失败';
|
|
|
|
|
+ END IF;
|
|
|
|
|
+
|
|
|
|
|
+ UPDATE sp_gzhx_apps_mig_next.website target_site
|
|
|
|
|
+ JOIN sp_gzhx_apps_mig_next.website parent_website ON parent_website.websiteid = 10070
|
|
|
|
|
+ JOIN sp_gzhx_apps_mig_next.website source_site ON source_site.websiteid = @source_website_id
|
|
|
|
|
+ SET target_site.dcode = 61,
|
|
|
|
|
+ target_site.unitid = @target_unit_id,
|
|
|
|
|
+ target_site.wtcode = 10010,
|
|
|
|
|
+ target_site.wtid = @target_template_id,
|
|
|
|
|
+ target_site.parent_wid = parent_website.websiteid,
|
|
|
|
|
+ target_site.name = '华夏新闻网',
|
|
|
|
|
+ target_site.`desc` = '广州华夏职业学院新闻网,使用非繁新闻资讯模板-红色。',
|
|
|
|
|
+ target_site.protocol = 'https',
|
|
|
|
|
+ target_site.port = 443,
|
|
|
|
|
+ target_site.domains = @target_domain,
|
|
|
|
|
+ target_site.catalog_uri = '/',
|
|
|
|
|
+ target_site.logo = source_site.logo,
|
|
|
|
|
+ target_site.white_logo_file = source_site.white_logo_file,
|
|
|
|
|
+ target_site.seo_icon = COALESCE(source_site.seo_icon, parent_website.seo_icon),
|
|
|
|
|
+ target_site.seo_title = '华夏新闻网',
|
|
|
|
|
+ target_site.seo_keywords = '广州华夏职业学院,新闻网,融媒头条',
|
|
|
|
|
+ target_site.seo_description = '广州华夏职业学院新闻网。',
|
|
|
|
|
+ target_site.id_code = @target_site_id_code,
|
|
|
|
|
+ target_site.sort_number = 9992
|
|
|
|
|
+ WHERE target_site.websiteid = @target_website_id;
|
|
|
|
|
+
|
|
|
|
|
+ -- 按模板复制真实网站栏目。
|
|
|
|
|
+ INSERT INTO sp_gzhx_apps_mig_next.website_navigation (
|
|
|
|
|
+ dcode, unitid, wnccode, websiteid, wtid, idcard, name, name_assistant, title, `desc`,
|
|
|
|
|
+ wntcode, wnscode, wnjtcode, wnlscode, uri, url, jump_url, jump_websiteid, parent_nid,
|
|
|
|
|
+ photo_size_width, photo_size_height, background_image, sort_number, create_time, create_pid,
|
|
|
|
|
+ id_code, guest_access_flag
|
|
|
|
|
+ )
|
|
|
|
|
+ SELECT 61, @target_unit_id, 10000, @target_website_id, NULL, t.idcard, t.name, t.name_assistant,
|
|
|
|
|
+ t.title, t.`desc`, t.wntcode, t.wnscode, t.wnjtcode, t.wnlscode, t.uri, t.url,
|
|
|
|
|
+ NULL, NULL, NULL, t.photo_size_width, t.photo_size_height, t.background_image,
|
|
|
|
|
+ t.sort_number, NOW(), @operator_pid, NULL, t.guest_access_flag
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.website_navigation t
|
|
|
|
|
+ WHERE t.wtid = @target_template_id
|
|
|
|
|
+ AND t.wnccode = 10010
|
|
|
|
|
+ AND NOT EXISTS (
|
|
|
|
|
+ SELECT 1 FROM sp_gzhx_apps_mig_next.website_navigation n
|
|
|
|
|
+ WHERE n.websiteid = @target_website_id AND n.idcard = t.idcard
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ UPDATE sp_gzhx_apps_mig_next.website_navigation n
|
|
|
|
|
+ JOIN sp_gzhx_apps_mig_next.website_navigation t
|
|
|
|
|
+ ON t.wtid = @target_template_id AND t.idcard = n.idcard
|
|
|
|
|
+ SET n.dcode = 61,
|
|
|
|
|
+ n.unitid = @target_unit_id,
|
|
|
|
|
+ n.wnccode = 10000,
|
|
|
|
|
+ n.websiteid = @target_website_id,
|
|
|
|
|
+ n.wtid = NULL,
|
|
|
|
|
+ n.name = t.name,
|
|
|
|
|
+ n.name_assistant = t.name_assistant,
|
|
|
|
|
+ n.title = t.title,
|
|
|
|
|
+ n.`desc` = t.`desc`,
|
|
|
|
|
+ n.wntcode = t.wntcode,
|
|
|
|
|
+ n.wnscode = t.wnscode,
|
|
|
|
|
+ n.wnjtcode = t.wnjtcode,
|
|
|
|
|
+ n.wnlscode = t.wnlscode,
|
|
|
|
|
+ n.uri = t.uri,
|
|
|
|
|
+ n.url = t.url,
|
|
|
|
|
+ n.jump_url = NULL,
|
|
|
|
|
+ n.jump_websiteid = NULL,
|
|
|
|
|
+ n.photo_size_width = t.photo_size_width,
|
|
|
|
|
+ n.photo_size_height = t.photo_size_height,
|
|
|
|
|
+ n.background_image = t.background_image,
|
|
|
|
|
+ n.sort_number = t.sort_number,
|
|
|
|
|
+ n.guest_access_flag = t.guest_access_flag
|
|
|
|
|
+ WHERE n.websiteid = @target_website_id;
|
|
|
|
|
+
|
|
|
|
|
+ UPDATE sp_gzhx_apps_mig_next.website_navigation n
|
|
|
|
|
+ SET n.parent_nid = NULL
|
|
|
|
|
+ WHERE n.websiteid = @target_website_id;
|
|
|
|
|
+
|
|
|
|
|
+ UPDATE sp_gzhx_apps_mig_next.website_navigation child
|
|
|
|
|
+ JOIN sp_gzhx_apps_mig_next.website_navigation template_child
|
|
|
|
|
+ ON template_child.wtid = @target_template_id AND template_child.idcard = child.idcard
|
|
|
|
|
+ JOIN sp_gzhx_apps_mig_next.website_navigation template_parent
|
|
|
|
|
+ ON template_parent.wtid = @target_template_id AND template_parent.navigationid = template_child.parent_nid
|
|
|
|
|
+ JOIN sp_gzhx_apps_mig_next.website_navigation parent
|
|
|
|
|
+ ON parent.websiteid = @target_website_id AND parent.idcard = template_parent.idcard
|
|
|
|
|
+ SET child.parent_nid = parent.navigationid
|
|
|
|
|
+ WHERE child.websiteid = @target_website_id;
|
|
|
|
|
+
|
|
|
|
|
+ -- 源新闻栏目到目标模板栏目的稳定映射。
|
|
|
|
|
+ DROP TEMPORARY TABLE IF EXISTS tmp_hxn_nav_seed;
|
|
|
|
|
+ CREATE TEMPORARY TABLE tmp_hxn_nav_seed (
|
|
|
|
|
+ source_idcard VARCHAR(128) NOT NULL,
|
|
|
|
|
+ source_url VARCHAR(512) NOT NULL,
|
|
|
|
|
+ target_idcard VARCHAR(128) NOT NULL
|
|
|
|
|
+ );
|
|
|
|
|
+ INSERT INTO tmp_hxn_nav_seed VALUES
|
|
|
|
|
+ ('FFKJ_COLLEGE_NEWS', '/xiaoyuanxinwen/', 'FFKJ_NEWS_RED_CAMPUS'),
|
|
|
|
|
+ ('FFKJ_NEWS2026_HOME_MEDIA', '/meiti/', 'FFKJ_NEWS_RED_MEDIA'),
|
|
|
|
|
+ ('FFKJ_COLLEGE_MAJOR', '/gonggao/', 'FFKJ_NEWS_RED_NOTICE'),
|
|
|
|
|
+ ('diy_uSqslipVJsak', '/yixiandongtai/', 'FFKJ_NEWS_RED_FRONTLINE'),
|
|
|
|
|
+ ('JwxoeVKHmrHawdjM', '/xiazai/', 'FFKJ_NEWS_RED_DOWNLOAD'),
|
|
|
|
|
+ ('LjrFSffqEisWxIqZ', '/dianshitai/', 'FFKJ_NEWS_RED_VIDEO'),
|
|
|
|
|
+ ('FFKJ_COLLEGE_SCHOOL_HOME', '/xuexiaoshouye/', 'FFKJ_COLLEGE_SCHOOL_HOME'),
|
|
|
|
|
+ ('FFKJ_COLLEGE_FOOTER_INFO', '/dibujichuxinxi/', 'FFKJ_COLLEGE_FOOTER_INFO'),
|
|
|
|
|
+ ('FFKJ_COLLEGE_FOOTER_LINKS', '/dibuzidingyilanmu/', 'FFKJ_COLLEGE_FOOTER_LINKS'),
|
|
|
|
|
+ ('FFKJ_COLLEGE_HOME_HERO', '/shouyelunbo/', 'FFKJ_NEWS_RED_HERO');
|
|
|
|
|
+
|
|
|
|
|
+ DROP TEMPORARY TABLE IF EXISTS tmp_hxn_nav_map;
|
|
|
|
|
+ CREATE TEMPORARY TABLE tmp_hxn_nav_map AS
|
|
|
|
|
+ SELECT source_nav.navigationid AS source_navigationid,
|
|
|
|
|
+ target_nav.navigationid AS target_navigationid
|
|
|
|
|
+ FROM tmp_hxn_nav_seed seed
|
|
|
|
|
+ JOIN sp_gzhx_apps_mig_next.website_navigation source_nav
|
|
|
|
|
+ ON source_nav.websiteid = @source_website_id
|
|
|
|
|
+ AND source_nav.dcode IN (61, 71)
|
|
|
|
|
+ AND source_nav.wnccode = 10000
|
|
|
|
|
+ AND source_nav.idcard = seed.source_idcard
|
|
|
|
|
+ AND source_nav.url = seed.source_url
|
|
|
|
|
+ JOIN sp_gzhx_apps_mig_next.website_navigation target_nav
|
|
|
|
|
+ ON target_nav.websiteid = @target_website_id
|
|
|
|
|
+ AND target_nav.dcode = 61
|
|
|
|
|
+ AND target_nav.wnccode = 10000
|
|
|
|
|
+ AND target_nav.idcard = seed.target_idcard;
|
|
|
|
|
+
|
|
|
|
|
+ DROP TEMPORARY TABLE IF EXISTS tmp_hxn_nav_map_copy;
|
|
|
|
|
+ CREATE TEMPORARY TABLE tmp_hxn_nav_map_copy LIKE tmp_hxn_nav_map;
|
|
|
|
|
+ INSERT INTO tmp_hxn_nav_map_copy
|
|
|
|
|
+ SELECT * FROM tmp_hxn_nav_map;
|
|
|
|
|
+
|
|
|
|
|
+ SELECT COUNT(*) INTO v_expected_nav_map_count FROM tmp_hxn_nav_seed;
|
|
|
|
|
+ SELECT COUNT(*) INTO v_count FROM tmp_hxn_nav_map;
|
|
|
|
|
+ IF v_count <> v_expected_nav_map_count OR v_count <> 10 THEN
|
|
|
|
|
+ SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = '华夏新闻网栏目映射不完整,停止迁移';
|
|
|
|
|
+ END IF;
|
|
|
|
|
+
|
|
|
|
|
+ SELECT COUNT(*) INTO v_source_article_count
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.article a
|
|
|
|
|
+ JOIN tmp_hxn_nav_map m ON m.source_navigationid = a.navigationid
|
|
|
|
|
+ WHERE a.websiteid = @source_website_id
|
|
|
|
|
+ AND a.dcode = 61
|
|
|
|
|
+ AND a.articleid NOT IN (61405, 61571);
|
|
|
|
|
+ IF v_source_article_count < 1 THEN
|
|
|
|
|
+ SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = '新闻网-2026待迁移文章为空,停止迁移';
|
|
|
|
|
+ END IF;
|
|
|
|
|
+
|
|
|
|
|
+ INSERT INTO sp_gzhx_apps_mig_next.article (
|
|
|
|
|
+ dcode, websiteid, unitid, ascode, navigationid, title, ajtcode, `desc`, source, thumbnail,
|
|
|
|
|
+ sticktop, sticktop_end_time, sticktop_schedulesid, `release`, release_time, release_task_schedulesid,
|
|
|
|
|
+ content, edit_content, url, read_count, create_time, last_change_time, create_pid, last_change_pid,
|
|
|
|
|
+ guest_access_flag, sort_number
|
|
|
|
|
+ )
|
|
|
|
|
+ SELECT 61, @target_website_id, @target_unit_id, a.ascode, m.target_navigationid,
|
|
|
|
|
+ a.title, a.ajtcode, a.`desc`, a.source,
|
|
|
|
|
+ CASE
|
|
|
|
|
+ WHEN a.articleid IN (64627,64687,64725,64734,64738,64739,64743,64759,64760,64761,64762,64763,64764) THEN NULL
|
|
|
|
|
+ WHEN a.thumbnail LIKE '/web/upload/%' THEN CONCAT('/web/upload/huaxia-news/articles/', a.articleid,
|
|
|
|
|
+ '/thumbnail.', CASE WHEN SUBSTRING_INDEX(a.thumbnail, '.', -1) = a.thumbnail THEN 'jpg' ELSE SUBSTRING_INDEX(a.thumbnail, '.', -1) END)
|
|
|
|
|
+ ELSE a.thumbnail
|
|
|
|
|
+ END,
|
|
|
|
|
+ a.sticktop, a.sticktop_end_time, a.sticktop_schedulesid, a.`release`, a.release_time, a.release_task_schedulesid,
|
|
|
|
|
+ CONCAT('/web/upload/huaxia-news/articles/', a.articleid, '/content.html'),
|
|
|
|
|
+ CONCAT('/web/upload/huaxia-news/articles/', a.articleid, '/edit.html'),
|
|
|
|
|
+ a.url, a.read_count, NOW(), NOW(), @operator_pid, @operator_pid,
|
|
|
|
|
+ a.guest_access_flag, a.sort_number
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.article a
|
|
|
|
|
+ JOIN tmp_hxn_nav_map m ON m.source_navigationid = a.navigationid
|
|
|
|
|
+ WHERE a.websiteid = @source_website_id
|
|
|
|
|
+ AND a.dcode = 61
|
|
|
|
|
+ AND a.articleid NOT IN (61405, 61571)
|
|
|
|
|
+ AND NOT EXISTS (
|
|
|
|
|
+ SELECT 1 FROM sp_gzhx_apps_mig_next.article target_article
|
|
|
|
|
+ WHERE target_article.websiteid = @target_website_id
|
|
|
|
|
+ AND target_article.navigationid = m.target_navigationid
|
|
|
|
|
+ AND target_article.url = a.url
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ SELECT COUNT(*) INTO v_target_article_count
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.article target_article
|
|
|
|
|
+ JOIN tmp_hxn_nav_map m ON m.target_navigationid = target_article.navigationid
|
|
|
|
|
+ WHERE target_article.websiteid = @target_website_id
|
|
|
|
|
+ AND target_article.dcode = 61;
|
|
|
|
|
+ IF v_target_article_count < v_source_article_count THEN
|
|
|
|
|
+ SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = '华夏新闻网文章复制数量不足,停止迁移';
|
|
|
|
|
+ END IF;
|
|
|
|
|
+
|
|
|
|
|
+ -- 仅复制站内且两端都已经映射的抄送关系,不复制出站抄送。
|
|
|
|
|
+ INSERT INTO sp_gzhx_apps_mig_next.article_copy (
|
|
|
|
|
+ dcode, articleid, navigationid, create_time, create_pid
|
|
|
|
|
+ )
|
|
|
|
|
+ SELECT 61, target_article.articleid, target_copy_nav.target_navigationid, NOW(), @operator_pid
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.article_copy source_copy
|
|
|
|
|
+ JOIN sp_gzhx_apps_mig_next.article source_article ON source_article.articleid = source_copy.articleid
|
|
|
|
|
+ JOIN tmp_hxn_nav_map source_map ON source_map.source_navigationid = source_article.navigationid
|
|
|
|
|
+ JOIN tmp_hxn_nav_map_copy target_copy_nav ON target_copy_nav.source_navigationid = source_copy.navigationid
|
|
|
|
|
+ JOIN sp_gzhx_apps_mig_next.article target_article
|
|
|
|
|
+ ON target_article.websiteid = @target_website_id
|
|
|
|
|
+ AND target_article.navigationid = source_map.target_navigationid
|
|
|
|
|
+ AND target_article.url = source_article.url
|
|
|
|
|
+ WHERE source_article.websiteid = @source_website_id
|
|
|
|
|
+ AND source_copy.dcode = 61
|
|
|
|
|
+ AND NOT EXISTS (
|
|
|
|
|
+ SELECT 1 FROM sp_gzhx_apps_mig_next.article_copy target_copy
|
|
|
|
|
+ WHERE target_copy.articleid = target_article.articleid
|
|
|
|
|
+ AND target_copy.navigationid = target_copy_nav.target_navigationid
|
|
|
|
|
+ AND target_copy.dcode = 61
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ -- 网站与栏目管理对象沿用新闻网-2026的角色范围。
|
|
|
|
|
+ INSERT INTO sp_gzhx_apps_mig_next.website_manage (
|
|
|
|
|
+ unitid, websiteid, mtcode, objectid, create_time, create_pid
|
|
|
|
|
+ )
|
|
|
|
|
+ SELECT @target_unit_id, @target_website_id, source_manage.mtcode, source_manage.objectid, NOW(), @operator_pid
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.website_manage source_manage
|
|
|
|
|
+ WHERE source_manage.websiteid = @source_website_id
|
|
|
|
|
+ AND NOT EXISTS (
|
|
|
|
|
+ SELECT 1 FROM sp_gzhx_apps_mig_next.website_manage target_manage
|
|
|
|
|
+ WHERE target_manage.websiteid = @target_website_id
|
|
|
|
|
+ AND target_manage.mtcode = source_manage.mtcode
|
|
|
|
|
+ AND target_manage.objectid = source_manage.objectid
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ SET @source_manage_nav_id := NULL;
|
|
|
|
|
+ SELECT navigationid INTO @source_manage_nav_id
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.website_navigation
|
|
|
|
|
+ WHERE websiteid = @source_website_id
|
|
|
|
|
+ AND dcode = 61
|
|
|
|
|
+ AND idcard = 'FFKJ_COLLEGE_HOME_GROUP'
|
|
|
|
|
+ LIMIT 1;
|
|
|
|
|
+
|
|
|
|
|
+ INSERT INTO sp_gzhx_apps_mig_next.website_navigation_manage (
|
|
|
|
|
+ unitid, navigationid, wnmcode, mtcode, objectid, create_time, create_pid
|
|
|
|
|
+ )
|
|
|
|
|
+ SELECT @target_unit_id, target_nav.navigationid, source_manage.wnmcode, source_manage.mtcode,
|
|
|
|
|
+ source_manage.objectid, NOW(), @operator_pid
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.website_navigation target_nav
|
|
|
|
|
+ JOIN sp_gzhx_apps_mig_next.website_navigation_manage source_manage
|
|
|
|
|
+ ON source_manage.navigationid = @source_manage_nav_id
|
|
|
|
|
+ WHERE target_nav.websiteid = @target_website_id
|
|
|
|
|
+ AND target_nav.dcode = 61
|
|
|
|
|
+ AND NOT EXISTS (
|
|
|
|
|
+ SELECT 1 FROM sp_gzhx_apps_mig_next.website_navigation_manage target_manage
|
|
|
|
|
+ WHERE target_manage.navigationid = target_nav.navigationid
|
|
|
|
|
+ AND target_manage.wnmcode = source_manage.wnmcode
|
|
|
|
|
+ AND target_manage.mtcode = source_manage.mtcode
|
|
|
|
|
+ AND target_manage.objectid = source_manage.objectid
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ -- 主站十个新闻网入口统一切换到华夏新闻网。
|
|
|
|
|
+ UPDATE sp_gzhx_apps_mig_next.website_navigation
|
|
|
|
|
+ SET jump_url = CASE
|
|
|
|
|
+ WHEN idcard IN ('FFKJ_SCHOOL_NEWS', 'FFKJ_SCHOOL_HOME_NEWSROOM_NEWS')
|
|
|
|
|
+ THEN CONCAT('https://', @target_domain_host, '/xiaoyuanxinwen/')
|
|
|
|
|
+ WHEN idcard IN ('FFKJ_SCHOOL_MEDIA', 'FFKJ_SCHOOL_HOME_NEWSROOM_MEDIA')
|
|
|
|
|
+ THEN CONCAT('https://', @target_domain_host, '/meiti/')
|
|
|
|
|
+ WHEN idcard IN ('diy_qrSyVVRLLjQS', 'FFKJ_SCHOOL_HOME_NEWSROOM_NOTICE')
|
|
|
|
|
+ THEN CONCAT('https://', @target_domain_host, '/gonggao/')
|
|
|
|
|
+ WHEN idcard = 'diy_AwsSFlhuZzOe'
|
|
|
|
|
+ THEN CONCAT('https://', @target_domain_host, '/rongmeitoutiao/')
|
|
|
|
|
+ WHEN idcard = 'diy_SwvYpJgaQvLI'
|
|
|
|
|
+ THEN CONCAT('https://', @target_domain_host, '/yixiandongtai/')
|
|
|
|
|
+ WHEN idcard = 'FFKJ_SCHOOL_HOME_NEWSROOM_ENTRY'
|
|
|
|
|
+ THEN CONCAT('https://', @target_domain_host, '/')
|
|
|
|
|
+ ELSE REPLACE(jump_url, 'xinwen2026.hxcs.feifan.net', @target_domain_host)
|
|
|
|
|
+ END,
|
|
|
|
|
+ jump_websiteid = CASE WHEN idcard = 'FFKJ_SCHOOL_NEWS_NAV' THEN @target_website_id ELSE jump_websiteid END,
|
|
|
|
|
+ `desc` = REPLACE(IFNULL(`desc`, ''), '新闻网-2026', '华夏新闻网')
|
|
|
|
|
+ WHERE websiteid = 10070
|
|
|
|
|
+ AND dcode = 61
|
|
|
|
|
+ AND (
|
|
|
|
|
+ jump_websiteid = @source_website_id
|
|
|
|
|
+ OR jump_url LIKE '%xinwen2026.hxcs.feifan.net%'
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ SELECT COUNT(*) INTO v_count
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.website_navigation
|
|
|
|
|
+ WHERE websiteid = 10070
|
|
|
|
|
+ AND dcode = 61
|
|
|
|
|
+ AND (
|
|
|
|
|
+ jump_websiteid = @source_website_id
|
|
|
|
|
+ OR jump_url LIKE '%xinwen2026.hxcs.feifan.net%'
|
|
|
|
|
+ );
|
|
|
|
|
+ IF v_count <> 0 THEN
|
|
|
|
|
+ SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = '主站仍有新闻网-2026引用,停止提交';
|
|
|
|
|
+ END IF;
|
|
|
|
|
+
|
|
|
|
|
+ SELECT COUNT(*) INTO v_count
|
|
|
|
|
+ FROM sp_gzhx_apps_mig_next.website_navigation
|
|
|
|
|
+ WHERE websiteid = 10070
|
|
|
|
|
+ AND dcode = 61
|
|
|
|
|
+ AND (
|
|
|
|
|
+ jump_websiteid = @target_website_id
|
|
|
|
|
+ OR jump_url LIKE CONCAT('%', @target_domain_host, '%')
|
|
|
|
|
+ );
|
|
|
|
|
+ IF v_count < 10 THEN
|
|
|
|
|
+ SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = '主站华夏新闻网入口数量不足,停止提交';
|
|
|
|
|
+ END IF;
|
|
|
|
|
+
|
|
|
|
|
+ COMMIT;
|
|
|
|
|
+END//
|
|
|
|
|
+DELIMITER ;
|
|
|
|
|
+
|
|
|
|
|
+CALL sp_hxcs_create_huaxia_news_site();
|
|
|
|
|
+DROP PROCEDURE IF EXISTS sp_hxcs_create_huaxia_news_site;
|