/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\TCCIT_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_APITUDEINFO_S') 
CREATE TABLE T_TCCIT_APITUDEINFO_S (
   FID  BIGINT DEFAULT 0           NOT NULL ,
   FENTRYID  BIGINT     DEFAULT 0           NOT NULL ,
   FSEQ                 BIGINT    DEFAULT 0           NOT NULL ,
   FAPITUDETYPE         VARCHAR(30)  DEFAULT ''        NOT NULL ,
   FCOMPANYTYPE         VARCHAR(30) DEFAULT ''         NOT NULL,
   FEXPORTTYPE          VARCHAR(30)  DEFAULT ''        NOT NULL ,
   FCREDITRATING        VARCHAR(30) DEFAULT ''         NOT NULL ,
   FWORKERTOTAL         BIGINT      DEFAULT 0         NOT NULL ,
   FSOCIETYTYPE         VARCHAR(30)  DEFAULT ''        NOT NULL ,
   FSOCIETYTOTAL        BIGINT       DEFAULT 0        NOT NULL ,
   FSTARTDATE           DATETIME             NULL,
   FENDDATE             DATETIME             NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_ITEM_FETCH') 
CREATE TABLE T_TCCIT_ITEM_FETCH (
   FID                  BIGINT    DEFAULT 0            NOT NULL,
   FENTRYID             BIGINT    DEFAULT 0            NOT NULL ,
   FSEQ                 BIGINT     DEFAULT 0           NOT NULL ,
   FSUBJECT             VARCHAR(36)   DEFAULT ''        NOT NULL,
   FTABLETYPE           VARCHAR(30)   DEFAULT ''        NOT NULL ,
   FDATATYPE            BIGINT        DEFAULT 0       NOT NULL,
   FDATADIRECTION       VARCHAR(30)   DEFAULT ''        NOT NULL ,
   FOPS                 VARCHAR(100)   DEFAULT ''       NOT NULL ,
   FFILTERCONDITION     VARCHAR(4000)  DEFAULT ''       NOT NULL,
   FCONDITIONJSON       VARCHAR(4000)  DEFAULT ''       NOT NULL 
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_PREFERENTIAL_ITEM') 
CREATE TABLE T_TCCIT_PREFERENTIAL_ITEM (
   FID                  BIGINT  DEFAULT 0             NOT NULL ,
   FNUMBER              VARCHAR(60) DEFAULT ''         NOT NULL  ,
   FSTATUS              VARCHAR(30) DEFAULT ''         NOT NULL  ,
   FCREATORID           BIGINT     DEFAULT 0          NOT NULL  ,
   FMODIFIERID          BIGINT     DEFAULT 0          NOT NULL  ,
   FENABLE              VARCHAR(30) DEFAULT ''         NOT NULL  ,
   FCREATETIME          DATETIME             NULL,
   FMODIFYTIME          DATETIME             NULL,
   FMASTERID            BIGINT     DEFAULT 0          NOT NULL  ,
   FORGID               BIGINT    DEFAULT 0           NOT NULL  ,
   FRULETYPE            VARCHAR(30) DEFAULT ''         NOT NULL  ,
   FBUSINESSFEATURE     VARCHAR(30) DEFAULT ''         NOT NULL  ,
   FITEMID              BIGINT     DEFAULT 0          NOT NULL  ,
   FTYPE                VARCHAR(30) DEFAULT ''         NOT NULL 
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_PREFERENTIAL_ITEM_L') 
CREATE TABLE T_TCCIT_PREFERENTIAL_ITEM_L (
   FPKID                VARCHAR(18)  DEFAULT ''        NOT NULL ,
   FID                  BIGINT       DEFAULT 0        NOT NULL ,
   FLOCALEID            VARCHAR(10)  DEFAULT ''        NOT NULL ,
   FNAME                VARCHAR(100) DEFAULT ''        NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCCIT_SEASONAL_POLICY') 
CREATE TABLE T_TCCIT_SEASONAL_POLICY (
   FID                  BIGINT DEFAULT 0               NOT NULL ,
   FREGISTERTYPE        BIGINT DEFAULT 0              NOT NULL ,
   FDECLARETYPE         VARCHAR(30)  DEFAULT ''        NOT NULL ,
   FILLEGAL             CHAR(1)    DEFAULT ''          NOT NULL ,
   FENDDATE             DATETIME             NULL,
   FSTARTDATE           DATETIME             NULL,
   FSTATUS              VARCHAR(30) DEFAULT ''         NOT NULL,
   FORGID               BIGINT      DEFAULT 0         NOT NULL ,
   FPREPAYTYPE          VARCHAR(30)  DEFAULT ''        NOT NULL,
   FSOSPERSONNUM        BIGINT   DEFAULT 0            NOT NULL ,
   FEOSPERSONNUM        BIGINT   DEFAULT 0            NOT NULL ,
   FSOSASSETS           DECIMAL(23,10) DEFAULT 0      NOT NULL ,
   FEOSASSETS           DECIMAL(23,10) DEFAULT 0      NOT NULL 
);


/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\TCCIT_table.sql **/
