INSERT INTO center_authority (id,server_code,module_code,permission,description,hidden,sort_string,create_at,update_at) VALUES
    (289087445859827888,'iot-user-center','system','iot-user-center.system.authority-module','模块管理',1,'9999999999',1654568087181,1658371945661);
INSERT INTO center_authority (id,server_code,module_code,permission,description,hidden,sort_string,create_at,update_at) VALUES
    (289087445859828888,'iot-user-center','system','iot-user-center.system.authority-module.page','权限模板分页查询',1,'9999999999',1654568087181,1658371945661);
INSERT INTO center_authority (id,server_code,module_code,permission,description,hidden,sort_string,create_at,update_at) VALUES
    (289087445859828889,'iot-user-center','system','iot-user-center.system.authority-module.createOrUpdate','添加或更新权限模板',1,'9999999999',1654568087181,1658371945661);
INSERT INTO center_authority (id,server_code,module_code,permission,description,hidden,sort_string,create_at,update_at) VALUES
    (289087445859828890,'iot-user-center','system','iot-user-center.system.authority-module.get','根据id获取权限模板',1,'9999999999',1654568087181,1658371945661);
INSERT INTO center_authority (id,server_code,module_code,permission,description,hidden,sort_string,create_at,update_at) VALUES
    (289087445859828891,'iot-user-center','system','iot-user-center.system.authority-module.getByServerName','根据serverName获取权限模板列表',1,'9999999999',1654568087181,1658371945661);
INSERT INTO center_authority (id,server_code,module_code,permission,description,hidden,sort_string,create_at,update_at) VALUES
    (289087445859828892,'iot-user-center','system','iot-user-center.system.authority-module.delete','删除权限模板',1,'9999999999',1654568087181,1658371945661);
INSERT INTO center_authority (id,server_code,module_code,permission,description,hidden,sort_string,create_at,update_at) VALUES
    (289087445859828893,'iot-user-center','system','iot-user-center.system.authority-module.export','导出权限模板',1,'9999999999',1654568087181,1658371945661);
INSERT INTO center_authority (id,server_code,module_code,permission,description,hidden,sort_string,create_at,update_at) VALUES
    (289087445859828894,'iot-user-center','system','iot-user-center.system.authority-module.import','导入权限模板',1,'9999999999',1654568087181,1658371945661);
insert into center_tenant_authority_rel (id,tenant_id,authority_id,application_id,create_at,update_at) values
    (289087445859828895, 0, 289087445859827888,281905070042251264, now(), now());
insert into center_tenant_authority_rel (id,tenant_id,authority_id,application_id,create_at,update_at) values
    (289087445859828896, 0, 289087445859828888,281905070042251264, now(), now());
insert into center_tenant_authority_rel (id,tenant_id,authority_id,application_id,create_at,update_at) values
    (289087445859828897, 0, 289087445859828889,281905070042251264, now(), now());
insert into center_tenant_authority_rel (id,tenant_id,authority_id,application_id,create_at,update_at) values
    (289087445859828898, 0, 289087445859828890,281905070042251264, now(), now());
insert into center_tenant_authority_rel (id,tenant_id,authority_id,application_id,create_at,update_at) values
    (289087445859828899, 0, 289087445859828891,281905070042251264, now(), now());
insert into center_tenant_authority_rel (id,tenant_id,authority_id,application_id,create_at,update_at) values
    (289087445859828900, 0, 289087445859828892,281905070042251264, now(), now());
insert into center_tenant_authority_rel (id,tenant_id,authority_id,application_id,create_at,update_at) values
    (289087445859828901, 0, 289087445859828893,281905070042251264, now(), now());
insert into center_tenant_authority_rel (id,tenant_id,authority_id,application_id,create_at,update_at) values
    (289087445859828902, 0, 289087445859828894,281905070042251264, now(), now());


INSERT INTO center_authority (id,server_code,module_code,permission,description,hidden,sort_string,create_at,update_at) VALUES
    (289087445859827892,'device-manage','device-operate-manage','device-manage.device-operate-manage.operation-device','运维设备',0,'9999999999',1660905222515,1714043854314);
insert into center_tenant_authority_rel (id,tenant_id,authority_id,application_id,create_at,update_at) values
    (289087445859828903, 0, 289087445859827892,288827602469126144, now(), now());

INSERT INTO center_menu (id,server_code,permission,title,icon,authority_id,hidden,sort,parent_id,route_json,model_wrap,create_at,update_at) VALUES
    (289087445859827888,'iot-user-center','iot-user-center.system.authority-module','模块管理',NULL,289087445859827888,0,155,0,'{"path":"","meta":{},"component":"Layout","children":[{"id":"289087445859827888","sort":155,"path":"module","component":"module-manager/index","redirect":"","alwaysShow":false,"name":"ModuleManager","hidden":false,"meta":{"title":"模块管理","icon":"ali-icon icon-apply","noCache":false,"breadcrumb":false,"affix":false,"activeMenu":""},"children":[],"custom":false}]}',0,1715653571839,1715653699331);

INSERT INTO center_menu (id,server_code,permission,title,icon,authority_id,hidden,sort,parent_id,route_json,model_wrap,create_at,update_at) VALUES
    (289087445859827892,'device-manage','device-manage.device-operate-manage.operation-device','运维设备',NULL,289087445859827892,0,-1,315667317046378496,'{"id":"289087445859827892","sort":9,"path":"operation-device","component":"device-OPS-manager/operation-device/index","redirect":"","alwaysShow":false,"name":"OperationDevice","hidden":false,"meta":{"title":"运维设备","icon":"ali-icon icon-device","noCache":true,"breadcrumb":true,"affix":false,"activeMenu":""},"children":[],"custom":true}',0,1715669650941,1715669700282);

INSERT INTO center_menu (`id`, `server_code`, `permission`, `title`, `icon`, `authority_id`, `hidden`, `sort`, `parent_id`, `route_json`, `model_wrap`, `create_at`, `update_at`) VALUES (555572291023405064, 'device-assistant', 'device-assistant.personalization-manager.sys-manager', '应用个性化设置', NULL, 555572291023405064, b'0', 3, 452291486910775296, '{\"id\":\"555572291023405064\",\"sort\":3,\"path\":\"diyManager\",\"component\":\"system/diyManager/index\",\"redirect\":\"\",\"alwaysShow\":false,\"name\":\"diyManager\",\"hidden\":false,\"meta\":{\"title\":\"应用个性化设置\",\"icon\":\"\",\"group\":1,\"noCache\":true,\"breadcrumb\":true,\"affix\":false,\"activeMenu\":\"\"},\"children\":[],\"custom\":true}', b'0', now(), now());
INSERT INTO center_authority (`id`, `server_code`, `module_code`, `permission`, `description`, `hidden`, `sort_string`, `create_at`, `update_at`) VALUES (555572291023405064, 'device-assistant', 'sys-manager', 'device-assistant.personalization-manager.sys-manager', '应用个性化设置', 0, '9999999999', now(), now());
insert into center_tenant_authority_rel (id,tenant_id,authority_id,application_id,create_at,update_at) values
    (289087445859828904, 0, 555572291023405064,481890906165739520, now(), now());


CREATE TABLE `center_authority_module` (
                                           `id` bigint(20) unsigned NOT NULL COMMENT '主键ID',
                                           `module_name` varchar(200) NOT NULL COMMENT '模块名称',
                                           `module_identify` varchar(200) NOT NULL COMMENT '模块标识，服务英文简称 +两位数字编号',
                                           `server_name` varchar(200) NOT NULL COMMENT '服务名称',
                                           `required` tinyint(1) NOT NULL COMMENT '是否必选 0非必选 1必选',
                                           `remark` varchar(255) DEFAULT NULL COMMENT '模块描述',
                                           `default_authority_id` bigint(20) NOT NULL COMMENT '默认权限id',
                                           `create_at` bigint(20) DEFAULT NULL COMMENT '创建时间',
                                           `update_at` bigint(20) DEFAULT NULL COMMENT '更新时间',
                                           `authority_num` int(11) DEFAULT NULL COMMENT '权限数量',
                                           PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE = utf8mb3_bin COMMENT ='模块表' ROW_FORMAT=DYNAMIC;


CREATE TABLE `center_authority_module_rel` (
                                               `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                               `authority_module_id` bigint(20) NOT NULL COMMENT '权限模块id',
                                               `authority_id` bigint(20) NOT NULL COMMENT '权限id',
                                               `create_at` bigint(20) DEFAULT NULL COMMENT '创建时间',
                                               `update_at` bigint(20) DEFAULT NULL COMMENT '更新时间',
                                               PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=545305345283588252 DEFAULT CHARSET=utf8mb3 COLLATE = utf8mb3_bin COMMENT ='模块权限关系表' ROW_FORMAT=DYNAMIC;


CREATE TABLE `center_tenant_module_rel` (
                                            `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
                                            `authority_module_id` bigint(20) NOT NULL COMMENT '权限模块id',
                                            `tenant_id` bigint(20) NOT NULL COMMENT '租户id',
                                            `create_at` bigint(20) DEFAULT NULL COMMENT '创建时间',
                                            `update_at` bigint(20) DEFAULT NULL COMMENT '更新时间',
                                            `application_id` bigint(20) DEFAULT NULL COMMENT '应用id',
                                            `type` tinyint(1) DEFAULT '0' COMMENT '是否为默认板块 1：是 0：不是',
                                            PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=545305534853545985 DEFAULT CHARSET=utf8mb3  COLLATE = utf8mb3_bin COMMENT ='模块租户关系表'  ROW_FORMAT=DYNAMIC;




-- 监控租户初始数据
INSERT INTO `center_tenant`(`id`, `tenant_name`, `remark`, `tenant_super`, `super_tenant_flag`, `create_at`, `update_at`) VALUES (1, '设备监控专用', NULL, 0, 2, 1715072212518, NULL);
INSERT INTO `center_user`(`id`, `tenant_id`, `user_name`, `password`, `phone_number`, `locked`, `email`, `user_center_super`, `create_at`, `update_at`, `avatar`, `real_name`) VALUES (1100, 1, 'monitor', '$2a$10$bRpdCdU/2mmL1s.Dz4h3JuZmnpqndNOf9XYMzI0jESYpINrpXp1KG', '', 0, '1234@qq.com', 0, 1715072212592, NULL, NULL, NULL);
INSERT INTO `center_user_role_rel`(`id`, `user_id`, `role_id`, `tenant_id`, `application_id`, `create_at`, `update_at`) VALUES (542862022220447745, 1100, 542861988426940418, 1, NULL, 1715072660874, NULL);
INSERT INTO `center_server_application_rel`(`id`, `tenant_id`, `server_code`, `application_name`, `application_icon`, `application_validity`, `application_status`, `application_url`, `sort`, `subdomains`, `remark`, `logo_url`, `adcode`, `address`, `lng`, `lat`, `create_at`, `update_at`) VALUES (542861988171087872, 1, 'device-assistant', '设备自动注册监控', NULL, '2039-12-31 00:00:00', 1, NULL, 999, '', NULL, NULL, NULL, NULL, NULL, NULL, 1715072652817, 1716172711351);
INSERT INTO `center_application_user_rel`(`id`, `tenant_id`, `user_id`, `application_id`, `application_super`, `create_at`, `update_at`) VALUES (542862022161727488, 1, 1100, 542861988171087872, 1, 1715072660860, NULL);



-- 个性化表
CREATE TABLE `personalization` (
                                   `id` bigint(20) NOT NULL COMMENT 'id',
                                   `user_id` bigint(20) DEFAULT NULL COMMENT '用户id',
                                   `name` varchar(255) NOT NULL COMMENT '应用系统名称',
                                   `remark` varchar(500) DEFAULT NULL COMMENT '应用系统介绍',
                                   `system_pic_url` varchar(255) DEFAULT NULL COMMENT '应用系统图标',
                                   `desk_pic_url` varchar(255) DEFAULT NULL COMMENT '应用桌面图标',
                                   `application_id` bigint(20) DEFAULT NULL COMMENT '应用id',
                                   `create_time` datetime DEFAULT NULL COMMENT '创建时间',
                                   `update_time` datetime DEFAULT NULL COMMENT '更新时间',
                                   PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 ROW_FORMAT=DYNAMIC COMMENT='个性化表';


update center_tenant set super_tenant_flag = 1 where id = 0;

update center_menu set permission = 'device-assistant.user-manager.sys-manager' where id = '452291486914969704';
update center_menu set permission = 'device-assistant.role-manager.sys-manager' where id = '452291486914969666';
update center_authority set permission = 'device-assistant.role-manager.sys-manager' where id = '452291486914969666';
update center_authority set permission = 'device-assistant.user-manager.sys-manager' where id = '452291486914969704';
