ALTER TABLE `jjb-saas-zcloud-key-project`.`key_project`
    MODIFY COLUMN `apply_status` int NOT NULL COMMENT '状态,0:暂存,1:未开工,2:开工申请中,3:已超期,4:进行中,5:完工申请中,6:已完工,7:开工申请驳回' AFTER `completed_confirm_date_time`,
    MODIFY COLUMN `project_type` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涉及重点作业属性类型' AFTER `project_name`,
    MODIFY COLUMN `project_type_name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '涉及重点作业属性类型名称' AFTER `project_type`,
    ADD COLUMN `reject_reason` varchar(255) NULL COMMENT '驳回原因' AFTER `apply_status`,
    ADD COLUMN `create_source` int NULL COMMENT '创建来源,1:手动创建,2:自动创建' AFTER `reject_reason`;


CREATE TABLE key_project_penalty_personnel (
  id BIGINT NOT NULL AUTO_INCREMENT,
  key_project_penalty_personnel_id VARCHAR(64) NOT NULL COMMENT '业务主键',
  key_project_id VARCHAR(64) NOT NULL COMMENT '重点作业ID',
  department_id BIGINT COMMENT '处罚人部门ID',
  department_name VARCHAR(64) COMMENT '处罚人部门名称',
  user_id BIGINT COMMENT '处罚人用户ID',
  user_name VARCHAR(64) COMMENT '处罚人用户名称',
  version int DEFAULT NULL COMMENT '乐观锁',
  create_id bigint DEFAULT NULL COMMENT '创建人',
  create_name varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '创建人姓名',
  create_time datetime DEFAULT NULL COMMENT '创建时间',
  update_id bigint DEFAULT NULL COMMENT '更新人',
  update_name varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '修改人名称',
  update_time datetime DEFAULT NULL COMMENT '更新时间',
  remarks varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述',
  delete_enum varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '是否删除',
  tenant_id bigint DEFAULT NULL COMMENT '租户id',
  org_id bigint DEFAULT NULL COMMENT '机构id',
  env varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '环境',
  PRIMARY KEY (`id`) USING BTREE, KEY idx_key_project_id (key_project_id) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='重点作业处罚人员配置';


CREATE TABLE hidden_penalty (
    id BIGINT NOT NULL AUTO_INCREMENT,
    hidden_penalty_id VARCHAR(64) NOT NULL COMMENT '业务主键',
    hidden_id VARCHAR(64) NOT NULL COMMENT '隐患ID',
    key_project_id VARCHAR(64) COMMENT '重点作业ID',
    penalty_desc VARCHAR(1000) COMMENT '处罚说明',
    penalty_amount DECIMAL(18,2) COMMENT '处罚金额',
    penalized_corp_id BIGINT COMMENT '被处罚单位ID',
    penalized_user_id BIGINT COMMENT '被处罚人ID',
    penalty_time DATETIME COMMENT '下发处罚时间',
    fine_flag TINYINT DEFAULT 0 COMMENT '是否罚款 0:否 1:是',
    edit_flag TINYINT DEFAULT 0 COMMENT '是否更改过 0:否 1:是',
    feedback_status TINYINT DEFAULT 0 COMMENT '是否反馈 0:未反馈 1:已反馈',
    version int DEFAULT NULL COMMENT '乐观锁',
    create_id bigint DEFAULT NULL COMMENT '创建人',
    create_name varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '创建人姓名',
    create_time datetime DEFAULT NULL COMMENT '创建时间',
    update_id bigint DEFAULT NULL COMMENT '更新人',
    update_name varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '修改人名称',
    update_time datetime DEFAULT NULL COMMENT '更新时间',
    remarks varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述',
    delete_enum varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '是否删除',
    tenant_id bigint DEFAULT NULL COMMENT '租户id',
    org_id bigint DEFAULT NULL COMMENT '机构id',
    env varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '环境',
    PRIMARY KEY (`id`) USING BTREE, KEY idx_hidden_id (hidden_id) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='隐患处罚记录';


CREATE TABLE hidden_penalty_feedback (
    id BIGINT NOT NULL AUTO_INCREMENT,
    hidden_penalty_feedback_id VARCHAR(64) NOT NULL COMMENT '业务主键',
    hidden_penalty_id VARCHAR(64) NOT NULL COMMENT '处罚ID',
    fine_payment_receipt VARCHAR(500) COMMENT '罚款认缴单(图片URL)',
    feedback_user_id BIGINT COMMENT '处罚反馈人ID',
    feedback_time DATETIME COMMENT '处罚反馈时间',
    version int DEFAULT NULL COMMENT '乐观锁',
    create_id bigint DEFAULT NULL COMMENT '创建人',
    create_name varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '创建人姓名',
    create_time datetime DEFAULT NULL COMMENT '创建时间',
    update_id bigint DEFAULT NULL COMMENT '更新人',
    update_name varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '修改人名称',
    update_time datetime DEFAULT NULL COMMENT '更新时间',
    remarks varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述',
    delete_enum varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '是否删除',
    tenant_id bigint DEFAULT NULL COMMENT '租户id',
    org_id bigint DEFAULT NULL COMMENT '机构id',
    env varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '环境',
    PRIMARY KEY (`id`) USING BTREE, KEY idx_hidden_penalty_id (hidden_penalty_id) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='处罚反馈';