|
@@ -0,0 +1,315 @@
|
|
|
|
|
+-- Ensure HXCS main site and its red fullscreen template have maintainable top custom links.
|
|
|
|
|
+
|
|
|
|
|
+SET NAMES utf8mb4;
|
|
|
|
|
+USE sp_gzhx_apps;
|
|
|
|
|
+
|
|
|
|
|
+START TRANSACTION;
|
|
|
|
|
+
|
|
|
|
|
+SET @operator_pid := 10000;
|
|
|
|
|
+SET @top_link_nav_idcard := 'FFKJ_SCHOOL_TOP_CUSTOM_LINKS';
|
|
|
|
|
+SET @top_link_source := '全屏风顶部自定义链接';
|
|
|
|
|
+SET @top_link_name := '首页顶部自定义链接';
|
|
|
|
|
+SET @top_link_desc := '首页顶部右上角快捷入口链接,文章标题控制显示文字,文章链接控制跳转地址。';
|
|
|
|
|
+SET @top_link_uri := 'shouyedingbuzidingyilianjie';
|
|
|
|
|
+SET @top_link_url := '/shouyedingbuzidingyilianjie/';
|
|
|
|
|
+SET @top_link_content_path := '/web/upload/ffkj-template/content/portal-demo.html';
|
|
|
|
|
+
|
|
|
|
|
+SET @screen_red_template_id := (
|
|
|
|
|
+ SELECT wtid
|
|
|
|
|
+ FROM website_template
|
|
|
|
|
+ WHERE config = 'ffkjscreen02'
|
|
|
|
|
+ AND dcode = 61
|
|
|
|
|
+ ORDER BY wtid
|
|
|
|
|
+ LIMIT 1
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
|
|
+SET @target_website_id := (
|
|
|
|
|
+ SELECT w.websiteid
|
|
|
|
|
+ FROM website w
|
|
|
|
|
+ WHERE w.dcode = 61
|
|
|
|
|
+ AND w.name = '广州华夏职业学院'
|
|
|
|
|
+ AND w.wtid = @screen_red_template_id
|
|
|
|
|
+ AND FIND_IN_SET(
|
|
|
|
|
+ 'hxcs.feifan.net',
|
|
|
|
|
+ REPLACE(TRIM(BOTH ';' FROM IFNULL(w.domains, '')), ';', ',')
|
|
|
|
|
+ ) > 0
|
|
|
|
|
+ ORDER BY w.websiteid
|
|
|
|
|
+ LIMIT 1
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
|
|
+SET @target_unit_id := (
|
|
|
|
|
+ SELECT unitid
|
|
|
|
|
+ FROM website
|
|
|
|
|
+ WHERE websiteid = @target_website_id
|
|
|
|
|
+ LIMIT 1
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
|
|
+SET @template_home_group_id := (
|
|
|
|
|
+ SELECT navigationid
|
|
|
|
|
+ FROM website_navigation
|
|
|
|
|
+ WHERE wtid = @screen_red_template_id
|
|
|
|
|
+ AND websiteid IS NULL
|
|
|
|
|
+ AND dcode = 61
|
|
|
|
|
+ AND wnccode = 10010
|
|
|
|
|
+ AND idcard = 'FFKJ_SCHOOL_HOME_GROUP'
|
|
|
|
|
+ ORDER BY navigationid
|
|
|
|
|
+ LIMIT 1
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
|
|
+SET @site_home_group_id := (
|
|
|
|
|
+ SELECT navigationid
|
|
|
|
|
+ FROM website_navigation
|
|
|
|
|
+ WHERE websiteid = @target_website_id
|
|
|
|
|
+ AND dcode = 61
|
|
|
|
|
+ AND wnccode = 10000
|
|
|
|
|
+ AND idcard = 'FFKJ_SCHOOL_HOME_GROUP'
|
|
|
|
|
+ ORDER BY navigationid
|
|
|
|
|
+ LIMIT 1
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
|
|
+SET @guard_sql := IF(
|
|
|
|
|
+ @screen_red_template_id IS NOT NULL
|
|
|
|
|
+ AND @target_website_id IS NOT NULL
|
|
|
|
|
+ AND @target_unit_id IS NOT NULL
|
|
|
|
|
+ AND @template_home_group_id IS NOT NULL
|
|
|
|
|
+ AND @site_home_group_id IS NOT NULL,
|
|
|
|
|
+ 'SELECT 1',
|
|
|
|
|
+ 'SELECT * FROM __hxcs_screen_top_links_target_guard_failed__'
|
|
|
|
|
+);
|
|
|
|
|
+PREPARE guard_stmt FROM @guard_sql;
|
|
|
|
|
+EXECUTE guard_stmt;
|
|
|
|
|
+DEALLOCATE PREPARE guard_stmt;
|
|
|
|
|
+
|
|
|
|
|
+SET @template_top_link_nav_id := (
|
|
|
|
|
+ SELECT navigationid
|
|
|
|
|
+ FROM website_navigation
|
|
|
|
|
+ WHERE wtid = @screen_red_template_id
|
|
|
|
|
+ AND websiteid IS NULL
|
|
|
|
|
+ AND idcard = @top_link_nav_idcard
|
|
|
|
|
+ ORDER BY (dcode = 61) DESC, navigationid
|
|
|
|
|
+ LIMIT 1
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
|
|
+INSERT INTO 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,
|
|
|
|
|
+ sort_number, create_time, create_pid, id_code, guest_access_flag
|
|
|
|
|
+)
|
|
|
|
|
+SELECT
|
|
|
|
|
+ 61, 10000, 10010, NULL, @screen_red_template_id, @top_link_nav_idcard,
|
|
|
|
|
+ @top_link_name, 'Top Links', @top_link_name, @top_link_desc,
|
|
|
|
|
+ 10010, 10030, 10010, 10000, @top_link_uri, @top_link_url,
|
|
|
|
|
+ NULL, NULL, @template_home_group_id, 4, NOW(), @operator_pid, NULL, 0
|
|
|
|
|
+WHERE @template_top_link_nav_id IS NULL;
|
|
|
|
|
+
|
|
|
|
|
+SET @template_top_link_nav_id := (
|
|
|
|
|
+ SELECT navigationid
|
|
|
|
|
+ FROM website_navigation
|
|
|
|
|
+ WHERE wtid = @screen_red_template_id
|
|
|
|
|
+ AND websiteid IS NULL
|
|
|
|
|
+ AND idcard = @top_link_nav_idcard
|
|
|
|
|
+ ORDER BY (dcode = 61) DESC, navigationid
|
|
|
|
|
+ LIMIT 1
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
|
|
+UPDATE website_navigation
|
|
|
|
|
+SET dcode = 61,
|
|
|
|
|
+ unitid = 10000,
|
|
|
|
|
+ wnccode = 10010,
|
|
|
|
|
+ websiteid = NULL,
|
|
|
|
|
+ wtid = @screen_red_template_id,
|
|
|
|
|
+ name = @top_link_name,
|
|
|
|
|
+ name_assistant = 'Top Links',
|
|
|
|
|
+ title = @top_link_name,
|
|
|
|
|
+ `desc` = @top_link_desc,
|
|
|
|
|
+ wntcode = 10010,
|
|
|
|
|
+ wnscode = 10030,
|
|
|
|
|
+ wnjtcode = 10010,
|
|
|
|
|
+ wnlscode = 10000,
|
|
|
|
|
+ uri = @top_link_uri,
|
|
|
|
|
+ url = @top_link_url,
|
|
|
|
|
+ jump_url = NULL,
|
|
|
|
|
+ jump_websiteid = NULL,
|
|
|
|
|
+ parent_nid = @template_home_group_id,
|
|
|
|
|
+ sort_number = 4,
|
|
|
|
|
+ guest_access_flag = 0
|
|
|
|
|
+WHERE navigationid = @template_top_link_nav_id;
|
|
|
|
|
+
|
|
|
|
|
+SET @site_top_link_nav_id := (
|
|
|
|
|
+ SELECT navigationid
|
|
|
|
|
+ FROM website_navigation
|
|
|
|
|
+ WHERE websiteid = @target_website_id
|
|
|
|
|
+ AND idcard = @top_link_nav_idcard
|
|
|
|
|
+ ORDER BY (dcode = 61) DESC, navigationid
|
|
|
|
|
+ LIMIT 1
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
|
|
+INSERT INTO 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,
|
|
|
|
|
+ sort_number, create_time, create_pid, id_code, guest_access_flag
|
|
|
|
|
+)
|
|
|
|
|
+SELECT
|
|
|
|
|
+ 61, @target_unit_id, 10000, @target_website_id, NULL, @top_link_nav_idcard,
|
|
|
|
|
+ @top_link_name, 'Top Links', @top_link_name, @top_link_desc,
|
|
|
|
|
+ 10010, 10030, 10010, 10000, @top_link_uri, @top_link_url,
|
|
|
|
|
+ NULL, NULL, @site_home_group_id, 4, NOW(), @operator_pid, NULL, 0
|
|
|
|
|
+WHERE @site_top_link_nav_id IS NULL;
|
|
|
|
|
+
|
|
|
|
|
+SET @site_top_link_nav_id := (
|
|
|
|
|
+ SELECT navigationid
|
|
|
|
|
+ FROM website_navigation
|
|
|
|
|
+ WHERE websiteid = @target_website_id
|
|
|
|
|
+ AND idcard = @top_link_nav_idcard
|
|
|
|
|
+ ORDER BY (dcode = 61) DESC, navigationid
|
|
|
|
|
+ LIMIT 1
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
|
|
+UPDATE website_navigation
|
|
|
|
|
+SET dcode = 61,
|
|
|
|
|
+ unitid = @target_unit_id,
|
|
|
|
|
+ wnccode = 10000,
|
|
|
|
|
+ websiteid = @target_website_id,
|
|
|
|
|
+ wtid = NULL,
|
|
|
|
|
+ name = @top_link_name,
|
|
|
|
|
+ name_assistant = 'Top Links',
|
|
|
|
|
+ title = @top_link_name,
|
|
|
|
|
+ `desc` = @top_link_desc,
|
|
|
|
|
+ wntcode = 10010,
|
|
|
|
|
+ wnscode = 10030,
|
|
|
|
|
+ wnjtcode = 10010,
|
|
|
|
|
+ wnlscode = 10000,
|
|
|
|
|
+ uri = @top_link_uri,
|
|
|
|
|
+ url = @top_link_url,
|
|
|
|
|
+ jump_url = NULL,
|
|
|
|
|
+ jump_websiteid = NULL,
|
|
|
|
|
+ parent_nid = @site_home_group_id,
|
|
|
|
|
+ sort_number = 4,
|
|
|
|
|
+ guest_access_flag = 0
|
|
|
|
|
+WHERE navigationid = @site_top_link_nav_id;
|
|
|
|
|
+
|
|
|
|
|
+INSERT INTO website_navigation_manage (
|
|
|
|
|
+ unitid, navigationid, wnmcode, mtcode, objectid, create_time, create_pid
|
|
|
|
|
+)
|
|
|
|
|
+SELECT @target_unit_id, @site_top_link_nav_id, parent_manage.wnmcode, parent_manage.mtcode,
|
|
|
|
|
+ parent_manage.objectid, NOW(), parent_manage.create_pid
|
|
|
|
|
+FROM website_navigation_manage parent_manage
|
|
|
|
|
+WHERE parent_manage.navigationid = @site_home_group_id
|
|
|
|
|
+ AND NOT EXISTS (
|
|
|
|
|
+ SELECT 1
|
|
|
|
|
+ FROM website_navigation_manage existing_manage
|
|
|
|
|
+ WHERE existing_manage.navigationid = @site_top_link_nav_id
|
|
|
|
|
+ AND existing_manage.wnmcode = parent_manage.wnmcode
|
|
|
|
|
+ AND existing_manage.mtcode = parent_manage.mtcode
|
|
|
|
|
+ AND existing_manage.objectid = parent_manage.objectid
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+DROP TEMPORARY TABLE IF EXISTS tmp_hxcs_screen_top_link_seed;
|
|
|
|
|
+CREATE TEMPORARY TABLE tmp_hxcs_screen_top_link_seed (
|
|
|
|
|
+ title VARCHAR(256) NOT NULL,
|
|
|
|
|
+ link_url VARCHAR(512) NOT NULL,
|
|
|
|
|
+ summary VARCHAR(2048) NOT NULL,
|
|
|
|
|
+ sort_number INT NOT NULL,
|
|
|
|
|
+ PRIMARY KEY (title)
|
|
|
|
|
+) ENGINE=Memory DEFAULT CHARSET=utf8mb4;
|
|
|
|
|
+
|
|
|
|
|
+INSERT INTO tmp_hxcs_screen_top_link_seed (title, link_url, summary, sort_number) VALUES
|
|
|
|
|
+('OA', '/', '维护顶部快捷入口“OA”的跳转地址。', 1),
|
|
|
|
|
+('校友', 'http://xg.gzhxtc.edu.cn/xywz/#/xywz/article', '维护顶部快捷入口“校友”的跳转地址。', 2),
|
|
|
|
|
+('教职工', 'http://xg.gzhxtc.edu.cn:4106/#/index1', '维护顶部快捷入口“教职工”的跳转地址。', 3),
|
|
|
|
|
+('学生', 'http://xg.gzhxtc.edu.cn:4106/#/index2', '维护顶部快捷入口“学生”的跳转地址。', 4);
|
|
|
|
|
+
|
|
|
|
|
+INSERT INTO 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, 10010, @site_top_link_nav_id,
|
|
|
|
|
+ seed.title, 10020, seed.summary, @top_link_source,
|
|
|
|
|
+ NULL, 0, NULL, NULL, 1, DATE_SUB(NOW(), INTERVAL seed.sort_number DAY),
|
|
|
|
|
+ NULL, @top_link_content_path, @top_link_content_path, seed.link_url,
|
|
|
|
|
+ 1, NOW(), NOW(), @operator_pid, @operator_pid, 0, seed.sort_number
|
|
|
|
|
+FROM tmp_hxcs_screen_top_link_seed seed
|
|
|
|
|
+WHERE NOT EXISTS (
|
|
|
|
|
+ SELECT 1
|
|
|
|
|
+ FROM article existing_article
|
|
|
|
|
+ WHERE existing_article.websiteid = @target_website_id
|
|
|
|
|
+ AND existing_article.navigationid = @site_top_link_nav_id
|
|
|
|
|
+ AND existing_article.title = seed.title
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
|
|
+UPDATE article target_article
|
|
|
|
|
+JOIN tmp_hxcs_screen_top_link_seed seed ON seed.title = target_article.title
|
|
|
|
|
+SET target_article.dcode = 61,
|
|
|
|
|
+ target_article.websiteid = @target_website_id,
|
|
|
|
|
+ target_article.unitid = @target_unit_id,
|
|
|
|
|
+ target_article.ascode = 10010,
|
|
|
|
|
+ target_article.navigationid = @site_top_link_nav_id,
|
|
|
|
|
+ target_article.ajtcode = 10020,
|
|
|
|
|
+ target_article.`desc` = seed.summary,
|
|
|
|
|
+ target_article.source = @top_link_source,
|
|
|
|
|
+ target_article.thumbnail = NULL,
|
|
|
|
|
+ target_article.sticktop = 0,
|
|
|
|
|
+ target_article.sticktop_end_time = NULL,
|
|
|
|
|
+ target_article.sticktop_schedulesid = NULL,
|
|
|
|
|
+ target_article.`release` = 1,
|
|
|
|
|
+ target_article.release_time = COALESCE(target_article.release_time, DATE_SUB(NOW(), INTERVAL seed.sort_number DAY)),
|
|
|
|
|
+ target_article.release_task_schedulesid = NULL,
|
|
|
|
|
+ target_article.content = @top_link_content_path,
|
|
|
|
|
+ target_article.edit_content = @top_link_content_path,
|
|
|
|
|
+ target_article.url = seed.link_url,
|
|
|
|
|
+ target_article.read_count = COALESCE(target_article.read_count, 1),
|
|
|
|
|
+ target_article.last_change_time = NOW(),
|
|
|
|
|
+ target_article.last_change_pid = @operator_pid,
|
|
|
|
|
+ target_article.guest_access_flag = 0,
|
|
|
|
|
+ target_article.sort_number = seed.sort_number
|
|
|
|
|
+WHERE target_article.websiteid = @target_website_id
|
|
|
|
|
+ AND target_article.navigationid = @site_top_link_nav_id;
|
|
|
|
|
+
|
|
|
|
|
+SELECT COUNT(*) INTO @template_top_link_count
|
|
|
|
|
+FROM website_navigation
|
|
|
|
|
+WHERE navigationid = @template_top_link_nav_id
|
|
|
|
|
+ AND wtid = @screen_red_template_id
|
|
|
|
|
+ AND websiteid IS NULL
|
|
|
|
|
+ AND dcode = 61
|
|
|
|
|
+ AND wnccode = 10010
|
|
|
|
|
+ AND idcard = @top_link_nav_idcard
|
|
|
|
|
+ AND parent_nid = @template_home_group_id;
|
|
|
|
|
+
|
|
|
|
|
+SELECT COUNT(*) INTO @site_top_link_count
|
|
|
|
|
+FROM website_navigation
|
|
|
|
|
+WHERE navigationid = @site_top_link_nav_id
|
|
|
|
|
+ AND websiteid = @target_website_id
|
|
|
|
|
+ AND dcode = 61
|
|
|
|
|
+ AND wnccode = 10000
|
|
|
|
|
+ AND idcard = @top_link_nav_idcard
|
|
|
|
|
+ AND parent_nid = @site_home_group_id;
|
|
|
|
|
+
|
|
|
|
|
+SELECT COUNT(DISTINCT seed.title) INTO @seed_article_count
|
|
|
|
|
+FROM tmp_hxcs_screen_top_link_seed seed
|
|
|
|
|
+JOIN article a ON a.websiteid = @target_website_id
|
|
|
|
|
+ AND a.navigationid = @site_top_link_nav_id
|
|
|
|
|
+ AND a.title = seed.title
|
|
|
|
|
+ AND a.url = seed.link_url
|
|
|
|
|
+ AND a.dcode = 61
|
|
|
|
|
+ AND a.ascode = 10010
|
|
|
|
|
+ AND a.ajtcode = 10020
|
|
|
|
|
+ AND a.`release` = 1;
|
|
|
|
|
+
|
|
|
|
|
+SET @guard_sql := IF(
|
|
|
|
|
+ @template_top_link_count = 1
|
|
|
|
|
+ AND @site_top_link_count = 1
|
|
|
|
|
+ AND @seed_article_count = 4,
|
|
|
|
|
+ 'SELECT 1',
|
|
|
|
|
+ 'SELECT * FROM __hxcs_screen_top_links_verify_failed__'
|
|
|
|
|
+);
|
|
|
|
|
+PREPARE guard_stmt FROM @guard_sql;
|
|
|
|
|
+EXECUTE guard_stmt;
|
|
|
|
|
+DEALLOCATE PREPARE guard_stmt;
|
|
|
|
|
+
|
|
|
|
|
+DROP TEMPORARY TABLE IF EXISTS tmp_hxcs_screen_top_link_seed;
|
|
|
|
|
+
|
|
|
|
|
+COMMIT;
|