/*==============================================================*/
/* Table:  T_MSPLAN_GTTSOURCE   甘特图数据源    创建人: 喻勇   创建时间: 20220113*/
/*==============================================================*/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_GTTSOURCE') 
CREATE TABLE T_MSPLAN_GTTSOURCE
(
  FID BIGINT DEFAULT 0 NOT NULL,          	
  FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL, 	
  FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL, 	
  FSTATUS NVARCHAR(1) DEFAULT ' ' NOT NULL, 
  FCREATORID BIGINT DEFAULT 0 NOT NULL,   	
  FMODIFIERID BIGINT DEFAULT 0 NOT NULL,  	
  FENABLE NVARCHAR(1) DEFAULT ' ' NOT NULL, 	
  FCREATETIME DATETIME ,                  	
  FMODIFYTIME DATETIME ,                  	
  FMASTERID BIGINT DEFAULT 0 NOT NULL,    	
  FGTENTITYID NVARCHAR(255) DEFAULT ' ' NOT NULL, 	
  FPOSTRALATIONFLAG NVARCHAR(50) DEFAULT ' ' NOT NULL, 	
  FPRERALATIONFLAG NVARCHAR(50) DEFAULT ' ' NOT NULL, 	
  FPOSTRALATIONNAME NVARCHAR(50) DEFAULT ' ' NOT NULL, 	
  FPRERALATIONNAME NVARCHAR(50) DEFAULT ' ' NOT NULL, 	
  FRALATIONENTITYID NVARCHAR(255) DEFAULT ' ' NOT NULL, 	
  FPREENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL, 	
  FPRERALATION NVARCHAR(50) DEFAULT ' ' NOT NULL, 	
  FPOSTENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL, 	
  FPOSTRALATION NVARCHAR(50) DEFAULT ' ' NOT NULL, 	
  FDATAMODELMUTL CHAR(1) DEFAULT '0' NOT NULL
);



/*==============================================================*/
/* Table:  T_MSPLAN_GTTSOURCE   甘特图数据源多语言表    创建人: 喻勇   创建时间: 20220113*/
/*==============================================================*/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_GTTSOURCE_L') 
CREATE TABLE T_MSPLAN_GTTSOURCE_L
(
  FPKID NVARCHAR(255) DEFAULT ' ' NOT NULL, 
  FID BIGINT DEFAULT 0 NOT NULL,          	
  FLOCALEID NVARCHAR(255) DEFAULT ' ' NOT NULL,          	
  FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);



/* Table:  T_MSPLAN_SOUCEVIEWSCHEME   样式方案多选基础资料表    创建人: 喻勇   创建时间: 20220113*/
/*==============================================================*/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_SOUCEVIEWSCHEME') 
CREATE TABLE T_MSPLAN_SOUCEVIEWSCHEME
(
  FPKID BIGINT DEFAULT 0 NOT NULL,          	
  FID BIGINT DEFAULT 0 NOT NULL,          
  FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);

/* Table:  T_MSPLAN_ENTITY   样式方案多选基础资料表_实体选择    创建人: 喻勇   创建时间: 20220113*/
/*==============================================================*/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_ENTITY')
CREATE TABLE T_MSPLAN_ENTITY
(
  FID BIGINT DEFAULT 0 NOT NULL,          	
  FENTRYID BIGINT DEFAULT 0 NOT NULL,     	
  FSEQ INT DEFAULT 0 NOT NULL,            
  FENTITYID NVARCHAR(255) DEFAULT ' ' NOT NULL, 
  FJOINFILTER CHAR(1) DEFAULT '0' NOT NULL, 	
  FFILTER NVARCHAR(255) DEFAULT ' ' NOT NULL, 	
  FFILTER_TAG NCLOB DEFAULT ' ',	 	
  FISMAPPINGENTITY CHAR(1) DEFAULT '0' NOT NULL, 	
  FFILTERTEXT NVARCHAR(50) DEFAULT ' ' NOT NULL, 
  FTIMEFIELD  NVARCHAR(50) DEFAULT ' ' NOT NULL,
  FGROUPFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL, 
  FGANTTTYPE NVARCHAR(5) DEFAULT ' ' NOT NULL, 	
  FUPGROUPFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL, 
  FUPUPGROUPFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL, 
  FGROUPENTITYID NVARCHAR(255) DEFAULT ' ' NOT NULL, 
  FUPGROUPENTITYID NVARCHAR(255) DEFAULT ' ' NOT NULL, 
  FUPUPGROUPENTITYID NVARCHAR(255) DEFAULT ' ' NOT NULL
);



IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MSPLAN_ENTITY' AND KSQL_COL_NAME ='FTIMEFIELD') 
 ALTER TABLE T_MSPLAN_ENTITY ADD (FTIMEFIELD NVARCHAR(50) DEFAULT ' ' NOT NULL );

/*==============================================================*/
/* Table:  T_MSPLAN_CROSSSET   样式方案多选基础资料表_横道配置    创建人: 喻勇   创建时间: 20220113*/
/*==============================================================*/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_CROSSSET')
CREATE TABLE T_MSPLAN_CROSSSET
(
  FID BIGINT DEFAULT 0 NOT NULL,          	
  FENTRYID BIGINT DEFAULT 0 NOT NULL,     	
  FSEQ INT DEFAULT 0 NOT NULL,            
  FCROSSENTITYID NVARCHAR(255) DEFAULT ' ' NOT NULL, 	
  FSTARTDATEFILED NVARCHAR(50) DEFAULT ' ' NOT NULL, 
  FENDDATEFILED NVARCHAR(50) DEFAULT ' ' NOT NULL, 	
  FCROSSFLAGCONTENT NVARCHAR(50) DEFAULT ' ' NOT NULL, 	
  FCROSSFLAGDETAILCONTENT NVARCHAR(50) DEFAULT ' ' NOT NULL, 
  FCROSSOBJ NVARCHAR(5) DEFAULT ' ' NOT NULL, 
  FCROSSTYPEID BIGINT DEFAULT 0 NOT NULL, 
  FFLAGCONNECTOR NVARCHAR(50) DEFAULT ' ' NOT NULL, 
  FFLAGDETAILCONNECTOR NVARCHAR(50) DEFAULT ' ' NOT NULL, 
  FISGROUPCOUNT CHAR(1) DEFAULT '0' NOT NULL, 
  FLANDMARKSFILED NVARCHAR(50) DEFAULT ' ' NOT NULL
);


/*==============================================================*/
/* Table:  T_MSPLAN_FENTRYETY   样式方案多选基础资料表_字段设置    创建人: 喻勇   创建时间: 20220113*/
/*==============================================================*/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_FENTRYETY')
CREATE TABLE T_MSPLAN_FENTRYETY
(
  FID BIGINT DEFAULT 0 NOT NULL,        
  FENTRYID BIGINT DEFAULT 0 NOT NULL,     	
  FSEQ INT DEFAULT 0 NOT NULL,            	
  FENTRYFIELDFLAG NVARCHAR(50) DEFAULT ' ' NOT NULL, 
  FENTRYFIELDNAME NVARCHAR(50) DEFAULT ' ' NOT NULL, 
  FENTRYENTITYNAME NVARCHAR(255) DEFAULT ' ' NOT NULL, 
  FENTRYFIELDALIGN NVARCHAR(50) DEFAULT ' ' NOT NULL
);


/*==============================================================*/
/* Table:  T_MSPLAN_FILTER   样式方案多选基础资料表_过滤实体    创建人: 喻勇   创建时间: 20220113*/
/*==============================================================*/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_FILTER')
CREATE TABLE T_MSPLAN_FILTER
(
  FID BIGINT DEFAULT 0 NOT NULL,          
  FENTRYID BIGINT DEFAULT 0 NOT NULL,     
  FSEQ INT DEFAULT 0 NOT NULL,            
  FENTITYCONDID NVARCHAR(255) DEFAULT ' ' NOT NULL, 
  FENTITYCONDSET NVARCHAR(1000) DEFAULT ' ' NOT NULL, 
  FENTITYCONDALIGN NVARCHAR(50) DEFAULT ' ' NOT NULL, 
  FENTITYCONDFILTER NVARCHAR(255) DEFAULT ' ' NOT NULL, 	
  FENTITYCONDFILTER_TAG NCLOB DEFAULT ' '
);


/*==============================================================*/
/* Table:  T_MSPLAN_FILTERENTRY   样式方案多选基础资料表_过滤条件关联实体    创建人: 喻勇   创建时间: 20220113*/
/*==============================================================*/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_FILTERENTRY')
CREATE TABLE T_MSPLAN_FILTERENTRY
(
  FENTRYID BIGINT DEFAULT 0 NOT NULL,  
  FDETAILID BIGINT DEFAULT 0 NOT NULL,    
  FSEQ INT DEFAULT 0 NOT NULL,    
  FCHILDENTITYFLAG NVARCHAR(255) DEFAULT ' ' NOT NULL, 
  FTOFILTERFLAG NVARCHAR(50) DEFAULT ' ' NOT NULL
);



/*==============================================================*/
/* Table:  T_MSPLAN_SOURCEGROUP   样式方案多选基础资料表_分组字段    创建人: 喻勇   创建时间: 20220113*/
/*==============================================================*/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_SOURCEGROUP')
CREATE TABLE T_MSPLAN_SOURCEGROUP
(
  FID BIGINT DEFAULT 0 NOT NULL,          
  FENTRYID BIGINT DEFAULT 0 NOT NULL,     	
  FSEQ INT DEFAULT 0 NOT NULL,            
  FGROUPENTITYFLAGID NVARCHAR(255) DEFAULT ' ' NOT NULL,
  FGROUPLEVEL INT DEFAULT 0 NOT NULL
);


/*==============================================================*/
/* Table:  T_MSPLAN_CROSSTYPE   横道类型    创建人: 喻勇   创建时间: 20211210  */
/*==============================================================*/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_CROSSTYPE')
CREATE TABLE T_MSPLAN_CROSSTYPE
(
  FID BIGINT DEFAULT 0 NOT NULL,          	
  FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL, 
  FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,   
  FSTATUS NVARCHAR(1) DEFAULT ' ' NOT NULL, 
  FCREATORID BIGINT DEFAULT 0 NOT NULL,   	
  FMODIFIERID BIGINT DEFAULT 0 NOT NULL,  	
  FENABLE NVARCHAR(1) DEFAULT ' ' NOT NULL, 	
  FCREATETIME DATETIME ,                  	
  FMODIFYTIME DATETIME ,                  	
  FMASTERID BIGINT DEFAULT 0 NOT NULL,    	
  FCROSSOBJ NVARCHAR(5) DEFAULT ' ' NOT NULL, 	
  FCROSSTYPE NVARCHAR(5) DEFAULT ' ' NOT NULL, 	
  FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);



/*==============================================================*/
/* Table:  T_MSPLAN_CROSSTYPE_L   横道类型多语言表    创建人: 喻勇   创建时间: 20211210*/
/*==============================================================*/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MSPLAN_CROSSTYPE_L')
CREATE TABLE T_MSPLAN_CROSSTYPE_L
(
  FPKID NVARCHAR(255) DEFAULT ' ' NOT NULL,          	
  FID BIGINT DEFAULT 0 NOT NULL,          	
  FLOCALEID NVARCHAR(255) DEFAULT ' ' NOT NULL,          	
  FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);
