/*
 Navicat Premium Data Transfer

 Source Server         : 公司服务
 Source Server Type    : MySQL
 Source Server Version : 80029
 Source Host           : 192.168.3.233:3306
 Source Schema         : joylink

 Target Server Type    : MySQL
 Target Server Version : 80029
 File Encoding         : 65001

 Date: 28/10/2022 16:45:36
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for rts_distribute
-- ----------------------------
DROP TABLE IF EXISTS `rts_distribute`;
CREATE TABLE `rts_distribute`  (
                                   `id` bigint NOT NULL AUTO_INCREMENT,
                                   `map_id` bigint NULL DEFAULT NULL COMMENT '地图id',
                                   `source_subject_id` bigint NULL DEFAULT NULL COMMENT '来源主体id',
                                   `forever` tinyint(1) NULL DEFAULT NULL COMMENT '是否永久：true/false',
                                   `status` int NULL DEFAULT NULL COMMENT '权限分发状态,1-有效，2-无效',
                                   `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                   `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
                                   `start_time` datetime NULL DEFAULT NULL COMMENT '开始时间',
                                   `end_time` datetime NULL DEFAULT NULL COMMENT '结束时间',
                                   `creator_id` bigint NULL DEFAULT NULL COMMENT '创建者id',
                                   `dsc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注描述',
                                   PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for rts_permission
-- ----------------------------
DROP TABLE IF EXISTS `rts_permission`;
CREATE TABLE `rts_permission`  (
                                   `id` bigint NOT NULL AUTO_INCREMENT COMMENT '权限id,对功能(system_ability)的管理',
                                   `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '权限名称',
                                   `des` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '权限描述',
                                   `creator_id` bigint NULL DEFAULT NULL COMMENT '创建者id',
                                   `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                   `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
                                   PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 26 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for rts_permission_distribute_ref
-- ----------------------------
DROP TABLE IF EXISTS `rts_permission_distribute_ref`;
CREATE TABLE `rts_permission_distribute_ref`  (
                                                  `id` bigint NOT NULL AUTO_INCREMENT,
                                                  `distribute_id` bigint NULL DEFAULT NULL COMMENT '分发id',
                                                  `permission_id` bigint NULL DEFAULT NULL COMMENT '权限id',
                                                  `amount` int NULL DEFAULT NULL COMMENT '总数量',
                                                  `remains` int NULL DEFAULT NULL COMMENT '剩余数量',
                                                  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 28 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for rts_permission_subject
-- ----------------------------
DROP TABLE IF EXISTS `rts_permission_subject`;
CREATE TABLE `rts_permission_subject`  (
                                           `id` bigint NOT NULL AUTO_INCREMENT COMMENT '权限主体id',
                                           `permission_id` bigint NULL DEFAULT NULL COMMENT '访问权限id',
                                           `subject_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '主体类型(user,org)',
                                           `subject_id` bigint NULL DEFAULT NULL COMMENT '主体id',
                                           `amount` int NULL DEFAULT NULL COMMENT '主体对该权限的总数量',
                                           `remains` int NULL DEFAULT NULL COMMENT '主体对该权限的剩余数量',
                                           `status` int NULL DEFAULT NULL COMMENT '权限主体状态,1（Valid）-有效，2（InValid）-无效',
                                           `forever` tinyint(1) NULL DEFAULT NULL COMMENT '是否永久：1-true/0-false',
                                           `start_time` datetime NULL DEFAULT NULL COMMENT '开始时间',
                                           `end_time` datetime NULL DEFAULT NULL COMMENT '结束时间',
                                           `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                           `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
                                           `distribute_id` bigint NOT NULL COMMENT '来自对应的分发id(rts_permission_distribute)',
                                           `parent_id` bigint NULL DEFAULT NULL COMMENT '父级id 数据来源rts_permission_distribute表source_subject_id字段',
                                           PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for rts_permission_system_ability
-- ----------------------------
DROP TABLE IF EXISTS `rts_permission_system_ability`;
CREATE TABLE `rts_permission_system_ability`  (
                                                  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '权限功能关联记录id',
                                                  `permission_id` bigint NULL DEFAULT NULL COMMENT '权限id',
                                                  `system_ability_id` bigint NULL DEFAULT NULL COMMENT '功能(system_ability)的id',
                                                  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;
