-- 任务分解实体表
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_TASKDECOMPOSE')
CREATE TABLE T_EB_TASKDECOMPOSE (
FID BIGINT DEFAULT 0 NOT NULL,
FORG BIGINT DEFAULT 0 NOT NULL,
FSTATUS NVARCHAR(1) DEFAULT '0' NOT NULL,
FTASK BIGINT DEFAULT 0 NOT NULL,
FMANAGER BIGINT DEFAULT 0 NOT NULL,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FORGVIEWID BIGINT DEFAULT 0 NOT NULL,
FPARENTDECOMPOSE BIGINT DEFAULT 0 NOT NULL,
FLONGNUMBER NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FCREATER BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME
);

-- 主键
EXEC P_ALTERPK 'PK_EB_TASKDECOMPOSE', 'T_EB_TASKDECOMPOSE', 'FID', '1';

-- 任务分解执行人
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_TASKDEC_EXECUTOR')
CREATE TABLE T_EB_TASKDEC_EXECUTOR (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);

-- 主键
EXEC P_ALTERPK 'PK_EB_TASKDEC_EXECUTOR', 'T_EB_TASKDEC_EXECUTOR', 'FPKID', '1';

-- 任务分解监督人
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_TASKDEC_SUPERVISOR')
CREATE TABLE T_EB_TASKDEC_SUPERVISOR (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);

-- 主键
EXEC P_ALTERPK 'PK_EB_TASKDEC_SUPERVISOR', 'T_EB_TASKDEC_SUPERVISOR', 'FPKID', '1';
