-- 栏目管理表
CREATE TABLE IF NOT EXISTS `pap_column` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` int(11) DEFAULT '0' COMMENT '父级ID，0为顶级',
  `name` varchar(100) NOT NULL COMMENT '栏目名称',
  `key` varchar(50) DEFAULT '' COMMENT '栏目标识，用于路由',
  `icon` varchar(50) DEFAULT '' COMMENT '图标名称(Element Plus图标)',
  `type` varchar(20) DEFAULT '' COMMENT '内容类型：article/image/text/page/person/form/donation/job',
  `is_single_page` tinyint(1) DEFAULT '0' COMMENT '一级栏目类型：1=单页面(二级为模块), 0=多页面(二级为独立页面)',
  `sort` int(11) DEFAULT '1' COMMENT '排序',
  `visible` tinyint(1) DEFAULT '1' COMMENT '显示状态：1=显示, 0=隐藏',
  `link` varchar(500) DEFAULT '' COMMENT '外部链接',
  `seo_title` varchar(200) DEFAULT '' COMMENT 'SEO标题',
  `seo_keywords` varchar(300) DEFAULT '' COMMENT 'SEO关键词',
  `seo_description` text COMMENT 'SEO描述',
  `slug` varchar(100) DEFAULT '' COMMENT 'URL别名',
  `form_config` text COMMENT '表单配置JSON',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP,
  `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_deleted` tinyint(1) DEFAULT '0' COMMENT '0=正常, 1=删除',
  PRIMARY KEY (`id`),
  KEY `idx_parent_id` (`parent_id`),
  KEY `idx_sort` (`sort`),
  KEY `idx_key` (`key`),
  KEY `idx_is_deleted` (`is_deleted`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='栏目管理';

-- 如果表已存在，添加字段
-- ALTER TABLE `pap_column` ADD COLUMN `key` varchar(50) DEFAULT '' COMMENT '栏目标识，用于路由' AFTER `name`;
-- ALTER TABLE `pap_column` ADD COLUMN `icon` varchar(50) DEFAULT '' COMMENT '图标名称(Element Plus图标)' AFTER `key`;
-- ALTER TABLE `pap_column` ADD COLUMN `is_single_page` tinyint(1) DEFAULT '0' COMMENT '一级栏目类型：1=单页面(二级为模块), 0=多页面(二级为独立页面)' AFTER `type`;

-- 初始数据
INSERT INTO `pap_column` (`id`, `parent_id`, `name`, `key`, `icon`, `type`, `is_single_page`, `sort`, `visible`) VALUES
(1, 0, '首页', 'home', 'HomeFilled', '', 1, 1, 1),
(2, 1, 'Banner轮播', 'home-banner', '', 'image', 0, 1, 1),
(3, 1, '数据看板', 'home-data', '', 'donation', 0, 2, 1),
(4, 1, '药品援助公示', 'home-medicine', '', 'text', 0, 3, 1),
(5, 1, '公益项目', 'home-project', '', 'article', 0, 4, 1),
(6, 1, '新闻动态', 'home-news', '', 'article', 0, 5, 1),
(7, 1, '合作伙伴', 'home-partner', '', 'image', 0, 6, 1),
(10, 0, '关于我们', 'about', 'OfficeBuilding', '', 0, 2, 1),
(11, 10, '基金会简介', 'about-intro', '', 'page', 0, 1, 1),
(12, 10, '组织架构', 'about-org', '', 'page', 0, 2, 1),
(13, 10, '理事会&监事', 'about-council', '', 'person', 0, 3, 1),
(14, 10, '资质证书', 'about-cert', '', 'image', 0, 4, 1),
(15, 10, '联系我们', 'about-contact', '', 'page', 0, 5, 1),
(20, 0, '公益项目', 'project', 'Present', 'article', 0, 3, 1),
(21, 20, '妇幼健康促进', 'proj-1', '', 'article', 0, 1, 1),
(22, 20, '"安心医"患者关爱', 'proj-2', '', 'article', 0, 2, 1),
(23, 20, '卫生健康促进', 'proj-3', '', 'article', 0, 3, 1),
(24, 20, '医疗科普公益', 'proj-4', '', 'article', 0, 4, 1),
(25, 20, '品牌建设与传播', 'proj-5', '', 'article', 0, 5, 1),
(30, 0, '党建专栏', 'party', 'Flag', '', 0, 4, 1),
(31, 30, '党建规章', 'party-rule', '', 'text', 0, 1, 1),
(32, 30, '党建活动', 'party-act', '', 'article', 0, 2, 1),
(33, 30, '党建学习', 'party-study', '', 'article', 0, 3, 1),
(40, 0, '信息公示', 'disclosure', 'Document', 'text', 0, 5, 1),
(41, 40, '管理制度', 'disc-rule', '', 'text', 0, 1, 1),
(42, 40, '机构年报', 'disc-annual', '', 'text', 0, 2, 1),
(43, 40, '审计报告', 'disc-audit', '', 'text', 0, 3, 1),
(44, 40, '财务报告', 'disc-finance', '', 'text', 0, 4, 1),
(45, 40, '关联方信息', 'disc-related', '', 'text', 0, 5, 1),
(46, 40, '项目执行报告', 'disc-exec', '', 'text', 0, 6, 1),
(50, 0, '新闻中心', 'news', 'Notification', 'article', 0, 6, 1),
(51, 50, '基金会动态', 'news-found', '', 'article', 0, 1, 1),
(52, 50, '行业资讯', 'news-indust', '', 'article', 0, 2, 1),
(53, 50, '通知公告', 'news-notice', '', 'article', 0, 3, 1),
(60, 0, '联系我们', 'contact', 'Phone', '', 0, 7, 1),
(61, 60, '基本信息', 'ct-info', '', 'page', 0, 1, 1),
(62, 60, '关注我们', 'ct-follow', '', 'page', 0, 2, 1),
(63, 60, '人才招聘', 'ct-job', '', 'job', 0, 3, 1),
(64, 60, '志愿者中心', 'ct-volunteer', '', 'form', 0, 4, 1),
(65, 60, '合作申请', 'ct-coop', '', 'form', 0, 5, 1);
