1 /******************************************/ 2 /* 名称:权限管理 */ 3 /* 编写日期:2010.5.20 */ 4 /* 开发者:dangqinghua */ 5 /*****************************************/ 6 --Create database Grop 7 --go 8 use Grop 9 go 10 -----创建用户表 11 Create table Users 12 ( 13 U_ID int identity(1,1) primary key, 14 Uname varchar(50) not null, 15 ) 16 go 17 ----创建角色表 18 Create table Roles 19 ( 20 Role_ID int identity(1,1) primary key, 21 Role_Name varchar(100) not null, 22 Rloe_Description varchar(400) null, /*角色备注*/ 23 ) 24 go 25 ----创建权限表 26 Create table Fun 27 ( 28 Fun_ID int identity(1,1) primary key, 29 Fun_Name varchar(50)not null, 30 ) 31 go 32 ---创建用户角色表 33 Create table UsersRole 34 ( 35 Users_Role int identity(1,1) primary key, 36 U_ID int foreign key references Users(U_ID), 37 Role_ID int foreign key references Roles(Role_ID), 38 ) 39 go 40 ----创建角色权限表 41 Create table FunRole 42 ( 43 FunRole_ID int identity(1,1) primary key, 44 Fun_ID int foreign key references Fun(Fun_ID), 45 Role_ID int foreign key references Roles(Role_ID), 46 ) 47 go 48 insert into Users values('111') 49 insert into Users values('张三') 50 insert into Users values('李四') 51 insert into UsersRole values(1,1) 52 insert into UsersRole values(2,1) 53 insert into Roles values('系统用户','栏目管理') 54 insert into Roles values('管理员','管理后台') 55 insert into Roles values('超级管理','所以权限') 56 insert into FunRole values(1,1) 57 insert into FunRole values(2,2) 58 insert into Fun values('新增') 59 insert into Fun values('编辑') 60 insert into FunRole values(1,1) 61 insert into FunRole values(1,2) 62 select * from Roles 63 select * from UsersRole 64 select * from users 65 select * from fun 66 select * from funRole 67 收藏于 2010-07-14