
/** 权限部分表格原先放在hbss，因地铁新执行顺序问题，必须移到hrcs **/


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_PERMORGENTRY') 
 CREATE TABLE T_HBSS_PERMORGENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FADMINORGID BIGINT DEFAULT 0 NOT NULL,
FCONTAINSSUB CHAR(1) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FUSERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_PERMFILEGRPMEMBER') 
 CREATE TABLE T_HBSS_PERMFILEGRPMEMBER (
FID BIGINT DEFAULT 0 NOT NULL,
FGROUPID BIGINT DEFAULT 0 NOT NULL,
FPERMFILEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_ROLEEMPGRPPERM') 
 CREATE TABLE T_HBSS_ROLEEMPGRPPERM (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FROLEID VARCHAR(18) DEFAULT ' ' NOT NULL,
FHREMPGRPID BIGINT DEFAULT 0 NOT NULL,
FPERMFILEID BIGINT DEFAULT 0 NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_ROLEORGEXCLUDE') 
 CREATE TABLE T_HBSS_ROLEORGEXCLUDE (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_PERMROLE') 
 CREATE TABLE T_HBSS_PERMROLE (
FENTRYID VARCHAR(18) DEFAULT ' ' NOT NULL,
FPROPERTY CHAR(1) DEFAULT ' ' NOT NULL,
FID VARCHAR(18) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_PERMROLEGRP') 
 CREATE TABLE T_HBSS_PERMROLEGRP (
FID VARCHAR(18) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_PERMFILEGRP') 
 CREATE TABLE T_HBSS_PERMFILEGRP (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FPARENTID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FLONGNUMBER VARCHAR(512) DEFAULT ' ' NOT NULL,
FLEVEL INT DEFAULT 0 NOT NULL,
FISLEAF CHAR(1) DEFAULT '1' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FSTATUS VARCHAR(2) 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,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_PERMFILES') 
 CREATE TABLE T_HBSS_PERMFILES (
FID BIGINT DEFAULT 0 NOT NULL,
FUSERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(2) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_ROLEORG') 
 CREATE TABLE T_HBSS_ROLEORG (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FROLEID VARCHAR(18) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCONTAINSSUB CHAR(1) DEFAULT ' ' NOT NULL,
FPERMFILEID BIGINT DEFAULT 0 NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FORGTYPE VARCHAR(2) DEFAULT ' ' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_ROLEBUCAFUNC') 
 CREATE TABLE T_HBSS_ROLEBUCAFUNC (
FID BIGINT DEFAULT 0 NOT NULL,
FROLEID VARCHAR(18) DEFAULT ' ' NOT NULL,
FBUCAFUNCID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_HRROLEBU') 
 CREATE TABLE T_HBSS_HRROLEBU (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCONTAINSSUB CHAR(1) DEFAULT ' ' NOT NULL,
FID VARCHAR(18) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FBUCAFUNCID BIGINT DEFAULT 0 NOT NULL,
FHRBUCAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_ROLEBUEXT') 
 CREATE TABLE T_HBSS_ROLEBUEXT (
FID BIGINT DEFAULT 0 NOT NULL,
FUSERROLEID BIGINT DEFAULT 0 NOT NULL,
FHRBUCAID BIGINT DEFAULT 0 NOT NULL,
FCONTAINSSUB CHAR(1) DEFAULT ' ' NOT NULL,
FBUCAFUNCID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_USERROLE') 
 CREATE TABLE T_HBSS_USERROLE (
FID BIGINT DEFAULT 0 NOT NULL,
FPERMFILEID BIGINT DEFAULT 0 NOT NULL,
FROLEID VARCHAR(18) DEFAULT ' ' NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FISINCLUDESUBORG CHAR(1) DEFAULT '0' NOT NULL,
FCUSTOMENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FUSERID BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_PERMAUTHCONFIG') 
 CREATE TABLE T_HBSS_PERMAUTHCONFIG (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' 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,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FINDEX BIGINT DEFAULT 0 NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FPAGETYPE VARCHAR(20) DEFAULT ' ' NOT NULL,
FENTITYNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FQUERYENTITYNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FISCONTROLADMINORG CHAR(1) DEFAULT ' ' NOT NULL,
FADMINORGFILTERFIELD VARCHAR(50) DEFAULT ' ' NOT NULL,
FISCONTROLEMPGRP CHAR(1) DEFAULT ' ' NOT NULL,
FEMPGRPFILTERFIELD VARCHAR(50) DEFAULT ' ' NOT NULL,
FISCONTROLBU CHAR(1) DEFAULT ' ' NOT NULL,
FBUFILTERFIELD VARCHAR(50) DEFAULT ' ' NOT NULL,
FISADMINORGFILTERENABLED CHAR(1) DEFAULT ' ' NOT NULL,
FFILTERSCOPE CHAR(1) DEFAULT '3' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_PERMF7IGNORE') 
 CREATE TABLE T_HBSS_PERMF7IGNORE (
FID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FBDPROPKEY VARCHAR(50) DEFAULT ' ' NOT NULL
);





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