/**Begin D:\PDM_UPGRADE\PDM1\TCTB_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_JTGZ_RULES') 
 CREATE TABLE T_TCTB_JTGZ_RULES (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(500) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FRULETYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FRULEPURPOSE VARCHAR(50) DEFAULT ' ' NOT NULL,
FISSYSTEM VARCHAR(50) DEFAULT ' ' NOT NULL,
FPROVISTONITEM BIGINT DEFAULT 0 NOT NULL,
FDATASOURCE BIGINT DEFAULT 0 NOT NULL,
FGENERATECONDITION VARCHAR(50) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(500) DEFAULT ' ' NOT NULL,
FFILTERJSON VARCHAR(255) DEFAULT ' ' NOT NULL,
FFILTERJSON_TAG NCLOB,
FTAXTYPE BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_JTGZ_RULES_ENTRY') 
 CREATE TABLE T_TCTB_JTGZ_RULES_ENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBIZNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FTABLE BIGINT DEFAULT 0 NOT NULL,
FABSOLUTE CHAR(1) DEFAULT '0' NOT NULL,
FDATATYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FDATADIRECTION VARCHAR(50) DEFAULT ' ' NOT NULL,
FFILTERCONDITION VARCHAR(2000) DEFAULT ' ' NOT NULL,
FADVANCEDCONF VARCHAR(2000) DEFAULT ' ' NOT NULL,
FFCONDITIONJSON VARCHAR(2000) DEFAULT ' ' NOT NULL,
FADVANCEDCONFJSON VARCHAR(2000) DEFAULT ' ' NOT NULL,
FVATRATE DECIMAL(23,2) DEFAULT 0 NOT NULL,
FBASEDATATYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FAMOUNTFIELD BIGINT DEFAULT 0 NOT NULL,
FCOMPOSITE CHAR(1) DEFAULT '0' NOT NULL,
FCOMPOSITEJSON VARCHAR(255) DEFAULT ' ' NOT NULL,
FCOMPOSITEJSON_TAG NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_JTGZ_RULES_L') 
 CREATE TABLE T_TCTB_JTGZ_RULES_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_JTGZ_SHAREPLAN') 
 CREATE TABLE T_TCTB_JTGZ_SHAREPLAN (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(40) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_JTGZ_SHAREPLAN_L') 
 CREATE TABLE T_TCTB_JTGZ_SHAREPLAN_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(40) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_JTGZSHARE_ORGS') 
 CREATE TABLE T_TCTB_JTGZSHARE_ORGS (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FORG BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_JTGZSHARE_RULES') 
 CREATE TABLE T_TCTB_JTGZSHARE_RULES (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FRULE BIGINT DEFAULT 0 NOT NULL
);



/**End D:\PDM_UPGRADE\PDM1\TCTB_table.sql **/
