IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MAL_GOODS') 
 CREATE TABLE T_MAL_GOODS (
FID BIGINT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FMAINPIC VARCHAR(255) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(80) DEFAULT ' ' NOT NULL,
FCLASSID BIGINT DEFAULT 0 NOT NULL,
FMODEL NCLOB,
FBRANDID BIGINT DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FSOURCE CHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL
);

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MAL_GOODS' AND KSQL_COL_NAME ='FMODEL') 
 ALTER TABLE T_MAL_GOODS ADD (FMODEL NCLOB );


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MAL_GOODS_PRICE') 
 CREATE TABLE T_MAL_GOODS_PRICE (
FID BIGINT DEFAULT 0 NOT NULL,
FMALLGOODSID BIGINT DEFAULT 0 NOT NULL,
FDISCOUNTRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMALLPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FNAKEDPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MAL_GOODS_STATUS') 
 CREATE TABLE T_MAL_GOODS_STATUS (
FID BIGINT DEFAULT 0 NOT NULL,
FMALLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FSALEABLE CHAR(1) DEFAULT ' ' NOT NULL,
FMALLGOODSID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);

