/*
 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:36
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for safe_compliance_issue
-- ----------------------------
DROP TABLE IF EXISTS `safe_compliance_issue`;
CREATE TABLE `safe_compliance_issue`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '合规问题ID',
  `item_id` bigint NULL DEFAULT NULL COMMENT '合规项ID（后补）',
  `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '问题标题',
  `description` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '问题描述',
  `source_type` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '来源类型：danger_report/inspection/manual/system',
  `source_id` bigint NOT NULL COMMENT '来源业务ID（如 safe_danger_report.id）',
  `status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'open' COMMENT '状态：todo/doing/done',
  `responsible_officer_id` bigint NULL DEFAULT NULL COMMENT '整改责任安全员ID',
  `due_time` datetime NULL DEFAULT NULL COMMENT '整改截止时间',
  `evidence_url` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '整改证据URL',
  `close_time` datetime NULL DEFAULT NULL COMMENT '关闭时间',
  `close_result` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '关闭说明',
  `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_0900_ai_ci NULL DEFAULT '' COMMENT '创建者',
  `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者',
  `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
  `tenant_id` int NULL DEFAULT NULL COMMENT '租户ID',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '安全合规问题' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;
