USE hnqzx;

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for sys_ent_rel
-- ----------------------------
DROP TABLE IF EXISTS `sys_ent_rel`;
CREATE TABLE `sys_ent_rel`
(
    `rel_id`      INT(20) AUTO_INCREMENT COMMENT 'id',
    `ent_id`      INT(20)    NOT NULL COMMENT '企业id',
    `e_type`      VARCHAR(8) NOT NULL COMMENT '租户类型',
    `pro_line`    VARCHAR(8) NOT NULL COMMENT '产品线',
    `e_level`     VARCHAR(8) NOT NULL COMMENT '租户层级',
    `parent_id`   INT(20)    NOT NULL COMMENT '父级id',
    `root_id`     INT(20)    NOT NULL COMMENT '顶层id',
    `create_time` DATETIME   NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` DATETIME   NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    PRIMARY KEY `pk_id` (`rel_id`) USING BTREE,
    INDEX `idx_type` (`e_type`) USING BTREE,
    INDEX `idx_pro_line` (`pro_line`) USING BTREE,
    INDEX `idx_pid` (`parent_id`) USING BTREE,
    INDEX `idx_level` (`e_level`) USING BTREE,
    INDEX `idx_rid` (`root_id`) USING BTREE
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4 COMMENT ='企业层级关系表';

-- ----------------------------
-- Records of sys_tenant_rel
-- ----------------------------
BEGIN;
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;