create table BPIP_ATT
(
  ID         VARCHAR2(20) not null,
  FLOWID     VARCHAR2(50),
  FORMID     VARCHAR2(50),
  FILEID     VARCHAR2(20),
  FILENAME   VARCHAR2(200),
  FILESIZE   NUMBER(18),
  FILEPATH   VARCHAR2(200),
  FILEUSERNO VARCHAR2(16),
  ENTERDATE  DATE,
  AID        VARCHAR2(50),
  YNAME      VARCHAR2(200)
);

alter table BPIP_ATT
  add constraint PK_BPIP_ATT primary key (ID);



create table BPIP_FIELD
(
  FIELDID     VARCHAR2(8) not null,
  TABLEID     VARCHAR2(4),
  FIELDNAME   VARCHAR2(30),
  FIELDTAG    VARCHAR2(2),
  CHINESENAME VARCHAR2(60),
  FIELDTYPE   VARCHAR2(1),
  FIELDLENGTH NUMBER(4),
  ISNULL      VARCHAR2(1),
  DICTTABLE   VARCHAR2(30),
  DESCRIPTION VARCHAR2(255),
  TAGEXT      NUMBER(1),
  AUTO1       VARCHAR2(8),
  AUTO2       VARCHAR2(8),
  AUTO3       VARCHAR2(8),
  BLOBSIZE    NUMBER(8),
  QFIELD      VARCHAR2(200),
  ISKEY       VARCHAR2(1)
)
;

alter table BPIP_FIELD
  add constraint PK_BPIP_FIELD primary key (FIELDID);


create table BPIP_HANDSET
(
  ID         VARCHAR2(20) not null,
  USERNO     VARCHAR2(16),
  MOBILE     VARCHAR2(20),
  CONTENT    VARCHAR2(500),
  SENDDATE   DATE,
  FINISHDATE DATE,
  TYPEBOX    NUMBER(1),
  SENDTYPE   VARCHAR2(2),
  MONTH      NUMBER(4),
  WEEK       NUMBER(4),
  DAY        NUMBER(4),
  HOUR       NUMBER(4),
  MINUTE     NUMBER(4),
  ISSEND     CHAR(1),
  TTABLEID   VARCHAR2(50),
  SUSERNO    VARCHAR2(16)
)
;
alter table BPIP_HANDSET
  add constraint PK_BPIP_HANDSET primary key (ID);


create table BPIP_MENU
(
  MENUNO   VARCHAR2(9) not null,
  MENUNAME VARCHAR2(50),
  ISPOWER  CHAR(1),
  URL      VARCHAR2(300),
  ISOPEN   CHAR(1),
  FLAG     CHAR(1),
  MNCODE   VARCHAR2(9)
)
;
alter table BPIP_MENU
  add constraint PK_BPIP_MENU primary key (MENUNO);


create table BPIP_MSGCONTENT
(
  CUSERNO  VARCHAR2(16),
  CONTENT  VARCHAR2(500),
  SENDDATE DATE,
  ISCK     VARCHAR2(1)
)
;


create table BPIP_ROLE
(
  ROLEID      NUMBER not null,
  ROLENAME    VARCHAR2(30) not null,
  DESCRIPTION VARCHAR2(100)
)
;
alter table BPIP_ROLE
  add constraint PK_BPIP_ROLE primary key (ROLEID);

create table BPIP_ROLE_RERMISSISSON
(
  ROLEID NUMBER,
  MENUNO VARCHAR2(9) not null
)
;


create table BPIP_TABLE
(
  TABLEID     VARCHAR2(4) not null,
  TABLENAME   VARCHAR2(30),
  CHINESENAME VARCHAR2(60),
  TABLESPACE  VARCHAR2(30),
  DESCRIPTION VARCHAR2(255),
  TABLETYPE   VARCHAR2(1),
  PRIMARYKEY  VARCHAR2(30),
  TITLE       VARCHAR2(30)
)
;
alter table BPIP_TABLE
  add constraint PK_BPIP_TABLE primary key (TABLEID);


create table BPIP_TABLESPACE
(
  ID          VARCHAR2(2) not null,
  CHINESENAME VARCHAR2(60),
  DESCRIPTION VARCHAR2(255),
  DTABLE      VARCHAR2(200)
)
;
alter table BPIP_TABLESPACE
  add constraint PK_BPIP_TABLESPACE primary key (ID);


create table BPIP_UNIT
(
  UNITID    VARCHAR2(12) not null,
  UNITNAME  VARCHAR2(100),
  STATE     VARCHAR2(1),
  ORDERCODE VARCHAR2(4)
)
;
alter table BPIP_UNIT
  add constraint PK_BPIP_UNIT primary key (UNITID);


create table BPIP_USER
(
  USERID     VARCHAR2(16) not null,
  LOGINID    VARCHAR2(20),
  LOGINPW    VARCHAR2(32),
  USERSTATE  VARCHAR2(1),
  NAME       VARCHAR2(30),
  LCODE      VARCHAR2(6),
  UNITID     VARCHAR2(12),
  SEX        VARCHAR2(1),
  BIRTHDAY   DATE,
  PHONE      VARCHAR2(30),
  MOBILE     VARCHAR2(100),
  EMAIL      VARCHAR2(50),
  USERIMAGE  VARCHAR2(3),
  LOGINTIME  NUMBER(10),
  PAGESIZE   NUMBER(3),
  WINDOWTYPE VARCHAR2(1),
  DEPTINSIDE CHAR(1),
  ORBERCODE  VARCHAR2(6),
  ONLINEDATE DATE
)
;
alter table BPIP_USER
  add constraint PK_BPIP_USER primary key (USERID);


create table BPIP_USER_IDEA
(
  ID      VARCHAR2(8) not null,
  USER_NO VARCHAR2(16),
  CONTENT VARCHAR2(200)
)
;
alter table BPIP_USER_IDEA
  add constraint PK_BPIP_USER_IDEA primary key (ID);


CREATE TABLE BPIP_USER_PHOTO
(	USERID VARCHAR2(16) NOT NULL, 
	USERPHOTO BLOB, 
	USERIMAGE VARCHAR2(3), 
	IDIOGRAPH BLOB
)
;
alter table BPIP_USER_PHOTO
  add constraint PK_BPIP_USER_PHOTO primary key (USERID);


create table BPIP_USER_REMOVE
(
  ID         NUMBER(10) not null,
  MOVETIME   DATE,
  USERID     VARCHAR2(16),
  BEFOREUNIT VARCHAR2(100),
  AFTERUNIT  VARCHAR2(100),
  MOVEREASON VARCHAR2(255)
)
;
alter table BPIP_USER_REMOVE
  add constraint PK_BPIP_USER_REMOVE primary key (ID);


create table BPIP_USER_ROLE
(
  USERID VARCHAR2(16),
  ROLEID NUMBER,
  UNITID VARCHAR2(12)
)
;


