Files
RuoYi-Vue/sql/contact_page.sql

96 lines
4.8 KiB
MySQL
Raw Permalink Normal View History

-- 小程序“关注我们”页面配置及后台菜单。
CREATE TABLE IF NOT EXISTS `app_contact_page` (
`id` bigint NOT NULL COMMENT '配置主键,固定为1',
`avatar_url` varchar(500) DEFAULT NULL COMMENT '头像地址',
`nickname` varchar(100) NOT NULL COMMENT '昵称',
`bio` varchar(500) DEFAULT NULL COMMENT '个人简介',
`background_url` varchar(500) DEFAULT NULL COMMENT '背景图地址,为空使用页面渐变背景',
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小程序联系页面配置';
CREATE TABLE IF NOT EXISTS `app_contact_item` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '联系方式主键',
`type` varchar(30) NOT NULL DEFAULT 'custom' COMMENT '类型:qq/wechat/email/blog/custom',
`label` varchar(50) NOT NULL COMMENT '显示名称',
`contact_value` varchar(500) NOT NULL COMMENT '联系方式内容',
`icon_url` varchar(500) DEFAULT NULL COMMENT '自定义图标地址',
`qr_code_url` varchar(500) DEFAULT NULL COMMENT '二维码地址',
`action_type` varchar(20) NOT NULL DEFAULT 'copy' COMMENT '操作:copy/qrcode',
`status` char(1) NOT NULL DEFAULT '0' COMMENT '状态:0启用,1停用',
`sort` int NOT NULL DEFAULT 0 COMMENT '显示排序',
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `idx_app_contact_item_status_sort` (`status`, `sort`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小程序联系方式';
INSERT INTO `app_contact_page`
(`id`, `avatar_url`, `nickname`, `bio`, `background_url`, `create_by`, `create_time`, `update_by`, `update_time`)
SELECT
1,
'https://img.yidaima.cn/%E5%A4%B4%E5%83%8F/9b889964f97e4d0c8f52f7b9ec0d04da.jpg',
'Nan Yin', '如果爱意难平,那就把它藏在心底吧!', NULL, 'admin', NOW(), '', NULL
WHERE NOT EXISTS (SELECT 1 FROM `app_contact_page` WHERE `id` = 1);
SET @contact_seed_needed := (SELECT COUNT(*) = 0 FROM `app_contact_item`);
INSERT INTO `app_contact_item`
(`type`, `label`, `contact_value`, `icon_url`, `qr_code_url`, `action_type`, `status`, `sort`, `create_by`, `create_time`)
SELECT 'qq', 'QQ', '594458910', NULL, 'https://img.yidaima.cn/feast/qq_qrcode.jpg', 'qrcode', '0', 10, 'admin', NOW()
WHERE @contact_seed_needed = 1;
INSERT INTO `app_contact_item`
(`type`, `label`, `contact_value`, `icon_url`, `qr_code_url`, `action_type`, `status`, `sort`, `create_by`, `create_time`)
SELECT 'wechat', '微信', 'forfeastcoding', NULL, 'https://img.yidaima.cn/feast/wx_qrcode.jpg', 'qrcode', '0', 20, 'admin', NOW()
WHERE @contact_seed_needed = 1;
INSERT INTO `app_contact_item`
(`type`, `label`, `contact_value`, `icon_url`, `qr_code_url`, `action_type`, `status`, `sort`, `create_by`, `create_time`)
SELECT 'email', '邮箱', '594458910@qq.com', NULL, NULL, 'copy', '0', 30, 'admin', NOW()
WHERE @contact_seed_needed = 1;
INSERT INTO `app_contact_item`
(`type`, `label`, `contact_value`, `icon_url`, `qr_code_url`, `action_type`, `status`, `sort`, `create_by`, `create_time`)
SELECT 'blog', '博客', 'http://www.yidaima.cn/', NULL, NULL, 'copy', '0', 40, 'admin', NOW()
WHERE @contact_seed_needed = 1;
SET @contact_parent_id := COALESCE(
(SELECT parent_id FROM sys_menu WHERE perms = 'app:resource:list' LIMIT 1),
(SELECT parent_id FROM sys_menu WHERE perms = 'app:article:list' LIMIT 1),
0
);
SET @contact_order_num := COALESCE(
(SELECT MAX(order_num) + 1 FROM sys_menu WHERE parent_id = @contact_parent_id),
1
);
INSERT INTO sys_menu
(menu_name, parent_id, order_num, path, component, query, is_frame, is_cache,
menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT
'联系页面配置', @contact_parent_id, @contact_order_num,
'contact', 'app/contact/index', '', 1, 0,
'C', '0', '0', 'app:contact:query', 'phone', 'admin', NOW(), '', NULL,
'维护小程序关注页面资料和联系方式'
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'app:contact:query');
SET @contact_menu_id := (
SELECT menu_id FROM sys_menu WHERE perms = 'app:contact:query' LIMIT 1
);
INSERT INTO sys_menu
(menu_name, parent_id, order_num, path, component, query, is_frame, is_cache,
menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '联系页面修改', @contact_menu_id, 1, '', '', '', 1, 0,
'F', '0', '0', 'app:contact:edit', '#', 'admin', NOW(), '', NULL, ''
WHERE @contact_menu_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'app:contact:edit');