USE `cnbg_20240511_001`;

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for sys_impl_plan
-- ----------------------------
DROP TABLE IF EXISTS `sys_impl_plan`;
CREATE TABLE `sys_impl_plan`
(
    `plan_id`      BIGINT AUTO_INCREMENT COMMENT '主键ID',
    `plan_name`    VARCHAR(64)  NOT NULL COMMENT '计划名称',
    `plan_type`    VARCHAR(32)  NOT NULL COMMENT '计划类型',
    `plan_state`   VARCHAR(32)  NOT NULL COMMENT '计划类型',
    `plan_score`   BIGINT       NOT NULL DEFAULT 0 COMMENT '计划值',
    `avail_score`  BIGINT       NOT NULL DEFAULT 0 COMMENT '可用值',
    `plan_issue`   DATE         NOT NULL COMMENT '签发时间',
    `plan_expiry`  DATE         NOT NULL COMMENT '截止日期',
    `parent_id`    BIGINT       NOT NULL COMMENT '父ID',
    `consignor_id` BIGINT       NOT NULL COMMENT '委托人ID',
    `consignee_id` BIGINT       NOT NULL COMMENT '受托人ID',
    `sku_id`       BIGINT       NOT NULL COMMENT '产品ID',
    `ckt_res`      TINYINT(1)   NULL COMMENT '审核结果',
    `ckt_msg`      VARCHAR(255) NULL COMMENT '审核意见',
    `ckt_time`     DATETIME     NULL COMMENT '审核时间',
    `ckt_name`     VARCHAR(64)  NULL COMMENT '审核人用户名',
    `loc_flag`     VARCHAR(1)   NOT NULL COMMENT '锁定标记',
    `del_flag`     VARCHAR(1)   NOT NULL DEFAULT '0' COMMENT '删除标记',
    `create_by`    VARCHAR(64)  NOT NULL COMMENT '创建人',
    `update_by`    VARCHAR(64)  NOT NULL COMMENT '修改人',
    `create_time`  DATETIME     NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time`  DATETIME     NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
    PRIMARY KEY `pk_id` (`plan_id`),
    UNIQUE KEY `uk_name` (`plan_name`, `consignor_id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4
  COLLATE = utf8mb4_general_ci
  ROW_FORMAT = DYNAMIC COMMENT ='执行计划';


-- ----------------------------
-- Records of sys_impl_plan
-- ----------------------------
BEGIN;
COMMIT;


SET FOREIGN_KEY_CHECKS = 1;
