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

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for safe_compliance_item
-- ----------------------------
DROP TABLE IF EXISTS `safe_compliance_item`;
CREATE TABLE `safe_compliance_item`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '合规项ID（主键）',
  `code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '合规项编码（唯一标识，如 AQ-001）。对外展示时优先使用',
  `name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '规则名称。如：隐患必须在7日内整改',
  `category` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '合规类别。如：隐患整改、隐患排查、重大危险源',
  `deadline_days` int NULL DEFAULT NULL COMMENT '整改期限（天）。当某隐患违反本规则时，用于计算整改截止时间 due_time（create_time + deadline_days）',
  `evidence_required` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否必须上传整改证据：1-必须，0-不必须。用于校验整改是否合规',
  `status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'enabled' COMMENT '规则状态：enabled-启用，disabled-停用',
  `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 '0-未删除，1-已删除',
  `tenant_id` int NULL DEFAULT NULL COMMENT '租户ID',
  `risk_level` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '风险等级（danger：高，warning：中，success：低）',
  `attachments` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '附件上传地址',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '安全合规项表' ROW_FORMAT = DYNAMIC;

SET FOREIGN_KEY_CHECKS = 1;
