-
- create table res_permission
- (
- roleid INTEGER,
- resourceid varchar2(30),
- operationid integer,
- primary key(roleid,resourceid,operationid)
- )
-
-
-
- create table res_role
- (
- roleid INTEGER,
- rolename varchar2(30),
- roledesc varchar2(100),
- primary key(roleid)
- )
-
-
- create table res_userrole
- (
- roleid INTEGER,
- userid varchar2(30),
- primary key(roleid,userid)
- )
-
-
- create table res_resource
- (
- resourceid varchar2(20),
- resourcename varchar2(30),
- resourcedesc varchar2(100),
- primary key(resourceid)
- )
-
- create table res_operation
- (
- operationid varchar2(20),
- operationname varchar2(30),
- operationdesc varchar2(100),
- primary key(operationid)
- )
-
- create sequence res_operation_seq;
-
- create sequence res_role_seq;
-
- create sequence soperationid increment by 1 start with 1 nomaxvalue minvalue 1;
- create sequence sroleid increment by 1 start with 1 nomaxvalue minvalue 1;
-
--表設計的原理
--根據交叉法來匹配權限
--1:根據用戶表中的用戶id關聯到res_userrole的userid,而後再關聯到res_role,查出用戶對應的全部權限,存放到list中
--2:根據資源和操做查詢出用戶能夠操做的全部許可res_permission,存放到list中
--3:經過同時遍歷兩個list,查詢出是否存在交叉,若是存在就是有權限,不然爲無權限css