CREATE TABLE `portal_app_link`  (
  `app_link_id` bigint NOT NULL COMMENT '主键id',
  `design_id` bigint NULL DEFAULT NULL COMMENT '门户设计id',
  `link_category_id` bigint NULL DEFAULT NULL COMMENT '所属链接分类id',
  `link_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '链接名称',
  `link_icon_file_id` bigint NULL DEFAULT NULL COMMENT '链接图标的文件id',
  `redirect_type` tinyint NULL DEFAULT NULL COMMENT '跳转方式：1-内部路由，2-外部链接',
  `redirect_url` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '跳转路由',
  `open_type` tinyint NULL DEFAULT NULL COMMENT '打开方式：1-本页面打开，2-新标签打开',
  `fld_sort` decimal(10, 2) NULL DEFAULT 100.00 COMMENT '排序',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'N' COMMENT '是否删除：Y-删除，N-未删除',
  `version_flag` bigint NULL DEFAULT NULL COMMENT '乐观锁',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
  PRIMARY KEY (`app_link_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '应用链接' ROW_FORMAT = Dynamic;

CREATE TABLE `portal_app_link_category`  (
  `category_id` bigint NOT NULL COMMENT '主键id',
  `design_id` bigint NULL DEFAULT NULL COMMENT '门户设计id',
  `category_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '应用链接分类名称',
  `fld_sort` decimal(10, 2) NULL DEFAULT NULL COMMENT '类别的顺序',
  `version_flag` bigint NULL DEFAULT NULL COMMENT '乐观锁',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'N' COMMENT '是否删除：Y-删除，N-未删除',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
  PRIMARY KEY (`category_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '应用链接的分类' ROW_FORMAT = Dynamic;

CREATE TABLE `portal_design`  (
  `design_id` bigint NOT NULL COMMENT '门户设计id',
  `design_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '门户设计名称',
  `design_logo` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '封面图logo，存前端图标的编码',
  `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述',
  `design_status` int NOT NULL COMMENT '门户设计的状态：10-启用，20-下架',
  `design_layout_json` json NULL COMMENT '门户拖拽设计的布局，json结构',
  `fld_sort` decimal(10, 2) NULL DEFAULT NULL COMMENT '门户的排序',
  `version_flag` bigint NULL DEFAULT NULL COMMENT '乐观锁',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'N' COMMENT '是否删除：Y-删除，N-未删除',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
  PRIMARY KEY (`design_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '门户设计配置' ROW_FORMAT = Dynamic;

CREATE TABLE `portal_design_manager`  (
  `id` bigint NOT NULL COMMENT '主键id',
  `design_id` bigint NULL DEFAULT NULL COMMENT '门户设计id',
  `manager_user_id` bigint NULL DEFAULT NULL COMMENT '管理员用户id',
  `auth_type_list` json NULL COMMENT '管理员权限列表，数组，包含：design-拖拽布局配置，content-新闻、轮播图和应用链接维护，admin-管理员权限',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '门户设计管理员' ROW_FORMAT = Dynamic;

CREATE TABLE `portal_design_permission`  (
  `permission_id` bigint NOT NULL COMMENT '主键id',
  `design_id` bigint NULL DEFAULT NULL COMMENT '门户设计id',
  `link_scope_type` tinyint NULL DEFAULT NULL COMMENT '关联类型：10-机构，20-人员',
  `link_business_id` bigint NULL DEFAULT NULL COMMENT '关联的业务id，例如，类型是10就是机构id',
  `scope_type` tinyint NULL DEFAULT NULL COMMENT '范围类型：1-指定范围，2-指定部门及以下',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
  PRIMARY KEY (`permission_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '门户设计生效范围' ROW_FORMAT = Dynamic;

CREATE TABLE `portal_news`  (
  `news_id` bigint NOT NULL COMMENT '新闻id',
  `design_id` bigint NULL DEFAULT NULL COMMENT '门户设计id',
  `news_category_id` bigint NULL DEFAULT NULL COMMENT '新闻所属的分类id',
  `news_title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '新闻标题',
  `news_summary` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '新闻摘要',
  `news_content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '新闻内容',
  `show_publish_time` datetime NULL DEFAULT NULL COMMENT '显示的发布时间',
  `show_publish_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '显示的发布人',
  `show_photo_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '显示的摄影人',
  `cover_file_id` bigint NULL DEFAULT NULL COMMENT '缩略图封面的文件id',
  `news_status` tinyint NULL DEFAULT NULL COMMENT '新闻状态：1-草稿，2-发布',
  `news_top_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'N' COMMENT '是否置顶：Y-置顶，N-不置顶',
  `news_sort` decimal(10, 2) NULL DEFAULT NULL COMMENT '新闻排序',
  `news_type` int NULL DEFAULT NULL COMMENT '文章类型：10-文本文章，20-外部链接',
  `link_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '外部链接地址',
  `version_flag` bigint NULL DEFAULT NULL COMMENT '乐观锁',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'N' COMMENT '是否删除：Y-删除，N-未删除',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
  PRIMARY KEY (`news_id`) USING BTREE,
  INDEX `pk_category`(`news_category_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '新闻' ROW_FORMAT = Dynamic;

CREATE TABLE `portal_news_category`  (
  `category_id` bigint NOT NULL COMMENT '主键id',
  `design_id` bigint NULL DEFAULT NULL COMMENT '门户设计id',
  `parent_id` bigint NULL DEFAULT NULL COMMENT '父级分类id',
  `parent_id_list` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '父级分类id集合',
  `category_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类别的名称',
  `fld_sort` decimal(10, 2) NULL DEFAULT NULL COMMENT '类别的顺序',
  `version_flag` bigint NULL DEFAULT NULL COMMENT '乐观锁',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'N' COMMENT '是否删除：Y-删除，N-未删除',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
  PRIMARY KEY (`category_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '新闻的分类' ROW_FORMAT = Dynamic;

CREATE TABLE `portal_slideshow`  (
  `slideshow_id` bigint NOT NULL COMMENT '轮播图id',
  `design_id` bigint NULL DEFAULT NULL COMMENT '门户设计id',
  `slideshow_title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '轮播图标题',
  `slideshow_cover_file_id` bigint NULL DEFAULT NULL COMMENT '轮播图文件id',
  `slideshow_redirect_type` tinyint NULL DEFAULT NULL COMMENT '轮播图跳转类型：5-无跳转，10-跳转到新闻，20-跳转到指定URL',
  `slideshow_news_id` bigint NULL DEFAULT NULL COMMENT '轮播图关联的新闻文章id',
  `slideshow_redirect_url` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '轮播图外部URL地址',
  `fld_sort` decimal(10, 2) NULL DEFAULT NULL COMMENT '轮播图排序',
  `version_flag` bigint NULL DEFAULT NULL COMMENT '乐观锁',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'N' COMMENT '是否删除：Y-删除，N-未删除',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `create_user` bigint NULL DEFAULT NULL COMMENT '创建人',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `update_user` bigint NULL DEFAULT NULL COMMENT '修改人',
  `tenant_id` bigint NULL DEFAULT NULL COMMENT '租户id',
  PRIMARY KEY (`slideshow_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '轮播图' ROW_FORMAT = Dynamic;

CREATE TABLE `portal_calendar` (
  `id` bigint NOT NULL COMMENT '主键id',
  `user_id` bigint DEFAULT NULL COMMENT '日历所属用户',
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '日历标题',
  `description` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '日历描述',
  `calendar_date` date DEFAULT NULL COMMENT '日历记录的指定日期',
  `start_time` datetime DEFAULT NULL COMMENT '开始时间，年月日时分秒',
  `end_time` datetime DEFAULT NULL COMMENT '开始时间，年月日时分秒',
  `urgency_type` tinyint DEFAULT NULL COMMENT '紧急程度：10-普通，20-紧急',
  `version_flag` bigint DEFAULT NULL COMMENT '乐观锁',
  `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'N' COMMENT '是否删除：Y-删除，N-未删除',
  `create_time` datetime DEFAULT NULL COMMENT '创建日期',
  `create_user` bigint DEFAULT NULL COMMENT '创建人',
  `update_time` datetime DEFAULT NULL COMMENT '更新日期',
  `update_user` bigint DEFAULT NULL COMMENT '更新人',
  `tenant_id` bigint DEFAULT NULL COMMENT '租户id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='门户个人日历';