/*
 Navicat Premium Dump SQL

 Source Server         : 119.96.62.56_MES
 Source Server Type    : MySQL
 Source Server Version : 80020 (8.0.20)
 Source Host           : 119.96.62.56:3306
 Source Schema         : yjh_mes_test_latest

 Target Server Type    : MySQL
 Target Server Version : 80020 (8.0.20)
 File Encoding         : 65001

 Date: 26/01/2026 13:49:13
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for safe_danger_report
-- ----------------------------
DROP TABLE IF EXISTS `safe_danger_report`;
CREATE TABLE `safe_danger_report`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '隐患ID',
  `discoverer` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '发现人',
  `danger_source_id` bigint NOT NULL DEFAULT 0 COMMENT '危险源ID',
  `danger_source` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '危险员信息',
  `discover_time` datetime NOT NULL COMMENT '发现时间',
  `location` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '隐患位置',
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '问题描述',
  `safety_officer` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '安全员',
  `status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending' COMMENT '状态：pending-待处理，processing-处理中，completed-已处理，closed-已关闭',
  `images` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '现场照片JSON数组',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
  `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
  `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
  `tenant_id` int NULL DEFAULT NULL COMMENT '租户',
  `item_id` bigint NULL DEFAULT NULL COMMENT '安全合规Id',
  `item_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '安全合规项name',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_discoverer`(`discoverer` ASC) USING BTREE,
  INDEX `idx_safety_officer`(`safety_officer` ASC) USING BTREE,
  INDEX `idx_discover_time`(`discover_time` ASC) USING BTREE,
  INDEX `idx_status`(`status` ASC) USING BTREE,
  INDEX `idx_create_time`(`create_time` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 54 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '隐患上报表' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;
