structure.php 13 KB
<?php
/**
 * 应用的数据表结构文件
 * structure.php
 * $Author$
 */
return "
CREATE TABLE IF NOT EXISTS `oa_map_map` (
  `map_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `map_name` varchar(64) NOT NULL DEFAULT '' COMMENT '学习地图名称',
  `ea_id` char(32) NOT NULL DEFAULT '' COMMENT '创建人ID',
  `ea_name` varchar(50) NOT NULL DEFAULT '' COMMENT '创建人姓名',
  `study_time` int(11) NOT NULL DEFAULT '0' COMMENT '学习时间(0代表无限制)',
  `is_step` tinyint(4) NOT NULL DEFAULT '1' COMMENT '是否开启闯关(1=否;2=是)',
  `template_id` int(11) NOT NULL DEFAULT '0' COMMENT '模板ID',
  `is_notice` tinyint(4) NOT NULL DEFAULT '2' COMMENT '消息通知(1=不开启;2=开启)',
  `is_remind` tinyint(4) NOT NULL DEFAULT '1' COMMENT '到期提醒(1=不开启;2=开启)',
  `expire` int(11) NOT NULL DEFAULT '0' COMMENT '到期提醒时间',
  `remind_cron_id` char(32) NOT NULL DEFAULT '' COMMENT '到期提醒计划任务ID',
  `is_medal` tinyint(4) NOT NULL DEFAULT '1' COMMENT '开启勋章激励(1=不开启;2=开启)',
  `medal_id` int(11) NOT NULL DEFAULT '0' COMMENT '勋章ID',
  `map_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '地图状态(1=草稿;2=已发布;3=已终止)',
  `send_time` bigint(20) NOT NULL DEFAULT '0' COMMENT '发布时间',
  `study_total` int(11) NOT NULL DEFAULT '0' COMMENT '已学习人数',
  `unstudy_total` int(11) NOT NULL DEFAULT '0' COMMENT '未学习的人数',
  `user_total` int(11) NOT NULL  DEFAULT '0'COMMENT '可参与人数',
  `stop_remark` varchar(60) NOT NULL DEFAULT '' COMMENT '终止说明',
  `domain` char(32) NOT NULL DEFAULT '' COMMENT '企业域名',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '数据状态(1=新创建;2=已更新;3=已删除)',
  `created` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `updated` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',
  `deleted` bigint(20) NOT NULL DEFAULT '0' COMMENT  '删除时间',
  PRIMARY KEY (`map_id`),
  KEY `map_name` (`map_name`),
  KEY `domain` (`domain`),
  KEY `created` (`created`),
  KEY `updated` (`updated`),
  KEY `send_time` (`send_time`),
  KEY `medal_id` (`medal_id`) USING BTREE,
  KEY `ea_id` (`ea_id`) USING BTREE,
  KEY `ea_name` (`ea_name`) USING BTREE,
  KEY `templet_id` (`template_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='学习地图表';

CREATE TABLE IF NOT EXISTS `oa_map_map_path` (
  `map_path_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `map_id` int(11) NOT NULL DEFAULT '0' COMMENT '地图ID',
  `path_id` int(11) NOT NULL DEFAULT '0' COMMENT '学习路径ID',
  `order` int(11) NOT NULL DEFAULT '0' COMMENT '排序',
  `domain` char(32) NOT NULL DEFAULT '' COMMENT '企业域名',
  `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '数据状态(1=新创建;2=已更新;3=已删除)',
  `created` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `updated` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',
  `deleted` bigint(20) NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`map_path_id`),
  KEY `domain` (`domain`),
  KEY `map_id` (`map_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='学习地图路径关系表';

CREATE TABLE IF NOT EXISTS `oa_map_path` (
  `path_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `path_name` varchar(64) NOT NULL DEFAULT '' COMMENT '路径名称',
  `ea_id` char(32) NOT NULL DEFAULT '' COMMENT '创建人ID',
  `ea_name` varchar(50) NOT NULL DEFAULT '' COMMENT '创建人姓名',
  `is_step` tinyint(4) NOT NULL DEFAULT '1' COMMENT '是否开启闯关(1=未开启;2=已开启)',
  `description` text NOT NULL COMMENT '路径介绍',
  `update_time` bigint(20) NOT NULL DEFAULT '0' COMMENT '最后更新时间',
  `domain` char(32) NOT NULL DEFAULT '' COMMENT '企业域名',
  `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '数据状态(1=新创建;2=已更新;3=已删除)',
  `created` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `updated` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',
  `deleted` bigint(20) NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`path_id`),
  KEY `domain` (`domain`) USING BTREE,
  KEY `path_name` (`path_name`),
  KEY `update_time` (`update_time`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='学习路径主表';

CREATE TABLE IF NOT EXISTS `oa_map_path_content` (
  `path_content_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `path_id` int(11) NOT NULL DEFAULT '0' COMMENT '路径ID',
  `app` varchar(20) NOT NULL DEFAULT '' COMMENT '应用',
  `app_data_id` int(11) NOT NULL DEFAULT '0' COMMENT '应用数据ID',
  `title` varchar(100) NOT NULL DEFAULT '' COMMENT '标题',
  `is_learn` tinyint(4) NOT NULL DEFAULT '1' COMMENT '是否必学(1=否;2=是)',
  `order` int(11) NOT NULL DEFAULT '0' COMMENT '排序',
  `domain` char(32) NOT NULL DEFAULT '' COMMENT '企业域名',
  `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '数据状态(1=新创建;2=已更新;3=已删除)',
  `created` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `updated` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',
  `deleted` bigint(20) NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`path_content_id`),
  KEY `path_id` (`path_id`) USING BTREE,
  KEY `app` (`app`) USING BTREE,
  KEY `app_data_id` (`app_data_id`) USING BTREE,
  KEY `domain` (`domain`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='学习路径内容表';

CREATE TABLE IF NOT EXISTS `oa_map_right` (
  `right_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `map_id` int(11) NOT NULL DEFAULT '0' COMMENT '学习地图ID',
  `obj_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '权限类型(1=全公司;2=部门;3=标签;4=人员;5=职位;6=角色)',
  `obj_id` char(32) NOT NULL DEFAULT '' COMMENT '部门ID、标签ID、人员ID',
  `domain` char(32) NOT NULL DEFAULT '' COMMENT '企业域名',
  `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '数据状态(1=新创建;2=已更新;3=已删除)',
  `created` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `updated` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',
  `deleted` bigint(20) NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`right_id`),
  KEY `map_id` (`map_id`),
  KEY `domain` (`domain`),
  KEY `obj_type` (`obj_type`,`obj_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='学习地图权限表';

CREATE TABLE IF NOT EXISTS `oa_map_setting` (
  `setting_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `key` varchar(255) NOT NULL DEFAULT '' COMMENT '变量名',
  `value` text NOT NULL COMMENT '变量值',
  `type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '缓存类型(0=非数组:1=数组)',
  `comment` text NOT NULL COMMENT '说明',
  `domain` char(32) NOT NULL DEFAULT '' COMMENT '企业域名',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '数据状态(1=新创建;2=已更新;3=已删除)',
  `created` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `updated` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',
  `deleted` bigint(20) NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`setting_id`),
  KEY `key` (`key`) USING BTREE,
  KEY `domain` (`domain`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统配置表';

CREATE TABLE IF NOT EXISTS `oa_map_syscache` (
  `syscache_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键自增id',
  `name` varchar(255) NOT NULL DEFAULT '' COMMENT '缓存文件名',
  `type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '缓存类型(0=非数组;1=数组)',
  `data` mediumblob NOT NULL COMMENT '数据',
  `domain` char(32) NOT NULL DEFAULT '' COMMENT '企业域名',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '数据状态(1=新创建;2=已更新;3=已删除)',
  `created` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `updated` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',
  `deleted` bigint(20) NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`syscache_id`),
  KEY `name` (`name`) USING BTREE,
  KEY `domain` (`domain`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='系统缓存';

CREATE TABLE IF NOT EXISTS `oa_map_user_action` (
  `user_action_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uid` char(32) NOT NULL DEFAULT '' COMMENT '用户ID',
  `map_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '学习地图ID',
  `path_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '学习路径ID',
  `app` varchar(20) NOT NULL DEFAULT '' COMMENT '应用',
  `app_data_id` int(10) NOT NULL DEFAULT '0' COMMENT '数据ID',
  `action_key` varchar(50) NOT NULL DEFAULT '' COMMENT '动作Key',
  `description` varchar(50) NOT NULL DEFAULT '' COMMENT '描述',
  `domain` char(32) NOT NULL DEFAULT '' COMMENT '企业域名',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '数据状态(1=新创建;2=已更新;3=已删除)',
  `created` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `updated` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',
  `deleted` bigint(20) NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`user_action_id`),
  KEY `uid` (`uid`),
  KEY `map_id` (`map_id`),
  KEY `path_id` (`path_id`),
  KEY `app_data_id` (`app_data_id`),
  KEY `domain` (`domain`),
  KEY `action_key` (`action_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学习地图用户动作数据表';

CREATE TABLE IF NOT EXISTS `oa_map_user_map` (
  `user_map_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uid` char(32) NOT NULL DEFAULT '' COMMENT '用户ID',
  `username` varchar(50) NOT NULL DEFAULT '' COMMENT '用户姓名',
  `map_id` int(11) NOT NULL DEFAULT '0' COMMENT '学习地图ID',
  `progress` tinyint(4) NOT NULL DEFAULT '0' COMMENT '完成进度',
  `complete_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '完成状态(1=未完成;2=已完成)',
  `update_time` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',
  `domain` char(32) NOT NULL DEFAULT '' COMMENT '企业域名',
  `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '数据状态(1=新创建;2=已更新;3=已删除)',
  `created` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `updated` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',
  `deleted` bigint(20) NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`user_map_id`),
  KEY `domain` (`domain`),
  KEY `update_time` (`update_time`),
  KEY `uid` (`uid`,`map_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='用户学习地图记录表';

CREATE TABLE IF NOT EXISTS `oa_map_user_path` (
  `user_path_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uid` char(32) NOT NULL DEFAULT '' COMMENT '用户ID',
  `username` varchar(50) NOT NULL DEFAULT '' COMMENT '用户姓名',
  `map_id` int(11) NOT NULL DEFAULT '0' COMMENT '地图ID',
  `path_id` int(11) NOT NULL DEFAULT '0' COMMENT '路径ID',
  `complete_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '完成状态(1=未完成;2=已完成)',
  `study_time` int(11) NOT NULL DEFAULT '0' COMMENT '学习时长(单位:秒)',
  `update_time` bigint(20) NOT NULL DEFAULT '0' COMMENT '最后学习时间',
  `domain` char(32) NOT NULL DEFAULT '' COMMENT '企业域名',
  `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '数据状态(1=新创建;2=已更新;3=已删除)',
  `created` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `updated` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',
  `deleted` bigint(20) NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`user_path_id`),
  UNIQUE KEY `unique` (`uid`,`map_id`,`path_id`) USING BTREE,
  KEY `domain` (`domain`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='用户学习路径记录表';

CREATE TABLE IF NOT EXISTS `oa_map_user_path_content` (
  `user_path_content_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uid` char(32) NOT NULL DEFAULT '' COMMENT '用户ID',
  `username` varchar(50) NOT NULL DEFAULT '' COMMENT '用户姓名',
  `map_id` int(11) NOT NULL DEFAULT '0' COMMENT '学习地图ID',
  `path_id` int(11) NOT NULL DEFAULT '0' COMMENT '学习路径ID',
  `app` varchar(20) NOT NULL DEFAULT '' COMMENT '应用',
  `app_data_id` int(11) NOT NULL DEFAULT '0' COMMENT '应用数据ID',
  `complete_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '完成状态(1=未完成;2=已完成)',
  `study_time` int(11) NOT NULL DEFAULT '0' COMMENT '学习时长(单位:秒)',
  `domain` char(32) NOT NULL DEFAULT '' COMMENT '企业域名',
  `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '数据状态(1=新创建;2=已更新;3=已删除)',
  `created` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `updated` bigint(20) NOT NULL DEFAULT '0' COMMENT '更新时间',
  `deleted` bigint(20) NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`user_path_content_id`) USING BTREE,
  UNIQUE KEY `unique` (`uid`,`map_id`,`path_id`,`app`,`app_data_id`) USING BTREE,
  KEY `domain` (`domain`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='用户学习内容记录表';

";