-- 请按如下分类提交sql！！！
-- Version V3.5.50.xxxx
-- uat 2025-xx-xx
-- prod 2025-xx-xx

------------------------------------
-- 表结构
------------------------------------
CREATE TABLE `zh_quality_inspection`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `tid` int(11) NOT NULL COMMENT '标段id',
  `code` varchar(255) NOT NULL COMMENT '编号',
  `status` tinyint(2) NOT NULL COMMENT '审批状态',
  `times` tinyint(2) NOT NULL DEFAULT 1 COMMENT '审批次数',
  `uid` int(11) NOT NULL COMMENT '创建人id',
  `check_item` varchar(1000) NULL DEFAULT '' COMMENT '检查项',
  `check_situation` varchar(1000) NULL DEFAULT '' COMMENT '检查情况',
  `action` varchar(1000) NULL DEFAULT '' COMMENT '处理要求及措施',
  `check_date` datetime NULL DEFAULT NULL COMMENT '检查日期',
  `inspector` varchar(255) NULL COMMENT '检查人',
  `rectification_item` varchar(1000) NULL DEFAULT '' COMMENT '整改内容',
  `rectification_date` datetime NULL DEFAULT NULL COMMENT '整改日期',
  `rectification_uid` int(11) NULL DEFAULT NULL COMMENT '整改人id',
  `create_time` datetime NOT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT = '质量巡检单表';

CREATE TABLE `zh_quality_inspection_audit`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tid` int(11) NOT NULL COMMENT '标段id',
  `qiid` int(11) NOT NULL COMMENT '质量巡检id',
  `aid` int(11) NOT NULL COMMENT '审批人id',
  `order` int(11) NOT NULL COMMENT '审批顺序',
  `times` tinyint(2) NOT NULL COMMENT '审批次数',
  `status` tinyint(2) NOT NULL COMMENT '审批状态',
  `begin_time` datetime NULL DEFAULT NULL COMMENT '开始审批时间',
  `end_time` datetime NULL DEFAULT NULL COMMENT '结束审批时间',
  `opinion` varchar(1000) NULL COMMENT '审批意见',
  `is_rectification` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否是整改人',
  `is_old` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '是否为旧流程(用于管理员修改流程时旧数据保留但不影响新流程)',
  `audit_type` tinyint(4) UNSIGNED NOT NULL DEFAULT 1 COMMENT '审批类型(1个人，2会签，3或签)',
  `audit_order` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '审批顺序',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT = '质量巡检审批表';

CREATE TABLE `zh_quality_inspection_attachment`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tid` int(11) NOT NULL COMMENT '标段id',
  `qiid` int(11) NOT NULL COMMENT '巡检id',
  `uid` int(11) NOT NULL COMMENT '上传者id',
  `filename` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '文件名称',
  `fileext` varchar(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '文件后缀',
  `filesize` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '文件大小',
  `filepath` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '文件存储路径',
  `upload_time` datetime NOT NULL COMMENT '上传时间',
  `extra_upload` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否为审核通过后再次上传的文件，0为否',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_cid`(`qiid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_unicode_ci COMMENT = '质量巡检附件表' ROW_FORMAT = Dynamic;

ALTER TABLE `zh_s2b_spec_pull`
ADD COLUMN `extra_option` varchar(1000) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '{}' COMMENT '额外配置' AFTER `pull_class`,
ADD COLUMN `check_api` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'api验证方法' AFTER `extra_option`;

------------------------------------
-- 表数据
------------------------------------
