-- 接口调用日志
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_API_ApiCallLog')
Create Table CT_API_ApiCallLog ( FCreatorID VARCHAR(44),FCreateTime DateTime,FLastUpdateUserID VARCHAR(44),FLastUpdateTime DateTime,FControlUnitID VARCHAR(44),FNumber NVARCHAR(80),FBizDate DateTime,FHandlerID VARCHAR(44),FDescription NVARCHAR(80),FHasEffected INT,FAuditorID VARCHAR(44),FSourceBillID NVARCHAR(80),FSourceFunction NVARCHAR(80),FID VARCHAR(44) DEFAULT '' NOT NULL ,FFivouchered INT,CFPlatform NVARCHAR(100),CFApiPath NVARCHAR(500),CFHttpMethod NVARCHAR(50),CFRequestUrl NVARCHAR(500),CFRequestParams NVARCHAR(2000),CFRequestIp NVARCHAR(50),CFResponseBody NVARCHAR(2000),CFHttpStatusCode INT,CFSuccess INT,CFErrorMsg NVARCHAR(2000),CFCostTime INT,CONSTRAINT CPK_API_ApiCLIDhi3 PRIMARY KEY (FID));

-- 接口注册单
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_API_ApiRegistryBill')
Create Table CT_API_ApiRegistryBill ( FName_l1 NVARCHAR(255),FName_l2 NVARCHAR(255),FName_l3 NVARCHAR(255),FNumber NVARCHAR(80),FDescription_l1 NVARCHAR(255),FDescription_l2 NVARCHAR(255),FDescription_l3 NVARCHAR(255),FSimpleName NVARCHAR(80),FID VARCHAR(44) DEFAULT '' NOT NULL ,FCreatorID VARCHAR(44),FCreateTime DateTime,FLastUpdateUserID VARCHAR(44),FLastUpdateTime DateTime,FControlUnitID VARCHAR(44) DEFAULT '11111111-1111-1111-1111-111111111111CCE7AED4',CFApiPath NVARCHAR(100),CFApiDesc NVARCHAR(2000),CFIsAuthRequired INT,CFHttpMethod NVARCHAR(20),CFIsSkipCallLog INT,CONSTRAINT CPK_API_ApiRBIDacg PRIMARY KEY (FID));

-- 开放平台授权单
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_API_OpenPlatformAuthBill')
Create Table CT_API_OpenPlatformAuthBill ( FName_l1 NVARCHAR(255),FName_l2 NVARCHAR(255),FName_l3 NVARCHAR(255),FNumber NVARCHAR(80),FDescription_l1 NVARCHAR(255),FDescription_l2 NVARCHAR(255),FDescription_l3 NVARCHAR(255),FSimpleName NVARCHAR(80),FID VARCHAR(44) DEFAULT '' NOT NULL ,FCreatorID VARCHAR(44),FCreateTime DateTime,FLastUpdateUserID VARCHAR(44),FLastUpdateTime DateTime,FControlUnitID VARCHAR(44) DEFAULT '11111111-1111-1111-1111-111111111111CCE7AED4',CFState VARCHAR(100),CFPlatform NVARCHAR(100),CFAppSecret NVARCHAR(255),CFExpireDate DateTime,CONSTRAINT CPK_API_OpenPAB5c2 PRIMARY KEY (FID));

-- api分录
If not exists (select 1 from KSQL_USERTABLES where KSQL_TABNAME='CT_API_OpenPABAE')
Create Table CT_API_OpenPABAE ( FID VARCHAR(44) DEFAULT '' NOT NULL ,FSeq INT DEFAULT 0 NOT NULL ,FParentID VARCHAR(44) DEFAULT '' NOT NULL ,CFSeq INT,CFApiID VARCHAR(44),CONSTRAINT CPK_API_OpenPABkia PRIMARY KEY (FID));
