use 4dkankan_v4;
DELETE FROM sys_menu WHERE rec_status = 'I';

DELETE from sys_menu WHERE id = 225;
DELETE from sys_menu WHERE id = 99;
DELETE from sys_menu WHERE id = 104;
DELETE from sys_menu WHERE id = 16;
DELETE from sys_menu WHERE id = 23;
DELETE from sys_menu WHERE id = 21;
DELETE from sys_menu WHERE id = 96;
DELETE from sys_menu WHERE id = 247;
DELETE from sys_menu WHERE id = 18;
DELETE from sys_menu WHERE id = 24;
DELETE from sys_menu WHERE id = 20;

CREATE TEMPORARY TABLE temp_menu AS
SELECT id from sys_menu WHERE rec_status = 'A';
DELETE from sys_menu  WHERE parent_id not in (SELECT id from temp_menu);
DROP TEMPORARY TABLE temp_menu;

CREATE TEMPORARY TABLE temp_menu AS
SELECT id from sys_menu WHERE rec_status = 'A';
DELETE from sys_menu  WHERE parent_id not in (SELECT id from temp_menu);
DROP TEMPORARY TABLE temp_menu;

CREATE TEMPORARY TABLE temp_menu AS
SELECT id from sys_menu WHERE rec_status = 'A';
DELETE from sys_menu  WHERE parent_id not in (SELECT id from temp_menu);
DROP TEMPORARY TABLE temp_menu;


DELETE from sys_role_menu WHERE menu_id not in (SELECT id from sys_menu WHERE rec_status = 'A');


ALTER TABLE `4dkankan_v4`.`jy_scene_auth`
    ADD COLUMN `case_id` int NULL AFTER `update_time`;


ALTER TABLE `4dkankan_v4`.`jy_scene_user_auth`
    ADD COLUMN `case_id` int NULL AFTER `update_time`;


UPDATE t_scene_plus_ext set thumb = '/oss/loading/thumb.jpg' WHERE thumb LIKE '%https://4dkk.4dage.com/loading/thumb.jpg%'

DROP TABLE IF EXISTS `t_common_upload`;
CREATE TABLE `t_common_upload`  (
                                    `id` int NOT NULL AUTO_INCREMENT,
                                    `file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
                                    `file_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
                                    `file_size` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
                                    `new_file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
                                    `file_type_str` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
                                    `file_format` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
                                    `result_file_format` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
                                    `rec_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'A',
                                    `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
                                    `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                                    `status` int NULL DEFAULT 0,
                                    `unzip_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
                                    `file_type` int NULL DEFAULT NULL,
                                    `wgs84` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
                                    `gcj02` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
                                    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 590 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_dict
-- ----------------------------
DROP TABLE IF EXISTS `t_dict`;
CREATE TABLE `t_dict`  (
                           `id` int NOT NULL AUTO_INCREMENT,
                           `dict_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
                           `dict_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
                           `sort` int NULL DEFAULT 1,
                           `rec_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'A',
                           `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
                           `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                           `sys_user_id` int NULL DEFAULT NULL,
                           `parent_id` int NULL DEFAULT NULL,
                           PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 115 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_dict_file
-- ----------------------------
DROP TABLE IF EXISTS `t_dict_file`;
CREATE TABLE `t_dict_file`  (
                                `id` int NOT NULL AUTO_INCREMENT,
                                `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
                                `type_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
                                `dict_id` int NULL DEFAULT NULL,
                                `rec_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'A',
                                `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
                                `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                                `sys_user_id` int NULL DEFAULT NULL,
                                `upload_id` int NULL DEFAULT NULL,
                                PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 585 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

DROP TABLE IF EXISTS `jy_move_scene_log`;
CREATE TABLE `jy_move_scene_log`  (
                                      `id` int NOT NULL AUTO_INCREMENT,
                                      `num` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
                                      `new_user_id` int NULL DEFAULT NULL,
                                      `old_user_id` int NULL DEFAULT NULL,
                                      `sys_user_id` int NULL DEFAULT NULL,
                                      `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
                                      `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                                      PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;



USE fdkk_laser;

SET GLOBAL character_set_server = 'utf8mb4';
SET GLOBAL character_set_database = 'utf8mb4';
SET GLOBAL collation_server = 'utf8mb4_0900_ai_ci';

SELECT
    CONCAT('ALTER TABLE `', table_name, '` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;') AS alter_sql
FROM
    information_schema.TABLES
WHERE
        table_schema = 'fdkk_laser';

