-- 分派控制调整审批记录表
CREATE TABLE BS_PASM_APPRV (
    ID NUMBER(20) NOT NULL,
    PASM_ID NUMBER(20) NOT NULL,
    APPROVAL_NODE NUMBER(10) NOT NULL,
    APPROVAL_NODE_NAME VARCHAR2(100),
    AUDITOR_ID NUMBER(20) NOT NULL,
    AUDITOR_NAME VARCHAR2(100),
    AUDIT_RESULT NUMBER(10) NOT NULL,
    AUDIT_REMARK VARCHAR2(500),
    AUDIT_TIME DATE,
    IS_DELETED NUMBER(10) DEFAULT 0,
    STATUS NUMBER(1,0) DEFAULT 0,
    CREATE_USER NUMBER(20),
    CREATE_TIME DATE,
    UPDATE_USER NUMBER(20),
    UPDATE_TIME DATE,
    CONSTRAINT PK_PASM_APPRV PRIMARY KEY (ID)
);

-- 添加表注释
COMMENT ON TABLE BS_PASM_APPRV IS '分派控制调整审批记录表';
COMMENT ON COLUMN BS_PASM_APPRV.ID IS '主键ID';
COMMENT ON COLUMN BS_PASM_APPRV.PASM_ID IS '调整单ID';
COMMENT ON COLUMN BS_PASM_APPRV.APPROVAL_NODE IS '审批节点：1-一级审批，2-二级审批';
COMMENT ON COLUMN BS_PASM_APPRV.APPROVAL_NODE_NAME IS '审批节点名称';
COMMENT ON COLUMN BS_PASM_APPRV.AUDITOR_ID IS '审批人ID';
COMMENT ON COLUMN BS_PASM_APPRV.AUDITOR_NAME IS '审批人姓名';
COMMENT ON COLUMN BS_PASM_APPRV.AUDIT_RESULT IS '审批结果：1-通过，2-驳回';
COMMENT ON COLUMN BS_PASM_APPRV.AUDIT_REMARK IS '审批意见';
COMMENT ON COLUMN BS_PASM_APPRV.AUDIT_TIME IS '审批时间';
COMMENT ON COLUMN BS_PASM_APPRV.IS_DELETED IS '是否删除：0-未删除，1-已删除';
COMMENT ON COLUMN BS_PASM_APPRV.STATUS IS '状态';
COMMENT ON COLUMN BS_PASM_APPRV.CREATE_USER IS '创建人';
COMMENT ON COLUMN BS_PASM_APPRV.CREATE_TIME IS '创建时间';
COMMENT ON COLUMN BS_PASM_APPRV.UPDATE_USER IS '更新人';
COMMENT ON COLUMN BS_PASM_APPRV.UPDATE_TIME IS '更新时间';

-- 创建索引（标识符不超过30字符）
CREATE INDEX IDX_PASM_APPRV_PID ON BS_PASM_APPRV(PASM_ID);
CREATE INDEX IDX_PASM_APPRV_AID ON BS_PASM_APPRV(AUDITOR_ID);
CREATE INDEX IDX_PASM_APPRV_NODE ON BS_PASM_APPRV(APPROVAL_NODE);

-- 创建序列（标识符不超过30字符）
CREATE SEQUENCE SEQ_PASM_APPRV_ID
START WITH 1
INCREMENT BY 1
NOCACHE
NOCYCLE;
