权限表的设计。
/* date:2012-03-25 create by : xl_chao */
create database Dv_Mis
use Dv_Mis;
go
/** 用户表 **/
create Table Dv_Sys_User
(
Dv_Sys_UserId int primary key identity(1,1),
Dv_Sys_User_UserName varchar(50),
Dv_Sys_User_UserPwd varchar(50),
Dv_Sys_User_CreateId int,
Dv_Sys_User_CreateDate datetime,
Dv_Sys_User_ModifyId int,
Dv_Sys_User_ModifyDate datetime
)
/** 角色表 **/
Create table Dv_Sys_Role
(
Dv_Sys_Role_Id int primary key identity(1,1),
Dv_Sys_Role_Name varchar(50),
Dv_Sys_Role_CreateId int,
Dv_Sys_Role_CreateDate datetime,
Dv_Sys_Role_ModifyId int,
Dv_Sys_Role_ModifyDate varchar(50)
)
/**角色用户表**/
Create table Dv_Sys_UserRole
(
Dv_Sys_UserRole_Id int primary key identity(1,1),
Dv_Sys_UserRole_UserId int,
Dv_Sys_UserRole_RoleId int,
Dv_Sys_UserRole_CreateId int,
Dv_Sys_UserRole_CreateDate datetime,
Dv_Sys_UserRole_ModifyId int,
Dv_Sys_UserRole_ModifyDate datetime ,
Constraint UserId_Check foreign key(Dv_Sys_UserRole_UserId) references Dv_Sys_User(Dv_Sys_UserId),
Constraint RoleId_Check foreign key(Dv_Sys_UserRole_RoleId) references Dv_Sys_Role(Dv_Sys_Role_Id)
)
/**权限表**/
Create table DV_Sys_RoleAction
(
DV_Sys_RoleAction_Id int primary key identity(1,1),
DV_Sys_RoleAction_RoleId int,
DV_Sys_RoleAction_ActionId int,
Dv_Sys_RoleAction_HasPerMissin bit,
DV_Sys_RoleAction_CreateId int,
DV_Sys_RoleAction_CreateDate datetime,
DV_Sys_RoleAction_ModifyId int,
DV_Sys_RoleAction_ModifyDate datetime
constraint RoleActionId_Check foreign key(DV_Sys_RoleAction_RoleId) references Dv_Sys_Role(Dv_Sys_Role_Id),
Constraint Action_Check Foreign key(DV_Sys_RoleAction_ActionId)references Dv_Sys_Action(Dv_Sys_Action_Id)
)
/**用户特殊权限表**/
drop table DV_Sys_UserAction
Create table DV_Sys_UserAction
(
DV_Sys_UserAction_Id int primary key identity(1,1),
DV_Sys_UserAction_UserId int,
DV_Sys_UserAction_ActionId int,
DV_Sys_UserAction_HasPerMissin bit,
DV_Sys_UserAction_CreateId int,
DV_Sys_UserAction_CreateDate datetime,
DV_Sys_UserAction_ModifyId int,
DV_Sys_UserAction_ModifyDate datetime,
Constraint UserAction_Check Foreign key(DV_Sys_UserAction_ActionId)references Dv_Sys_Action(Dv_Sys_Action_Id)
)
/**功能表 **/
create table Dv_Sys_Action
(
Dv_Sys_Action_Id int identity(1,1) primary key ,
Dv_Sys_Action_Name varchar(50) ,
Dv_Sys_Action_Code Varchar(50),
Dv_Sys_Action_CreateId int,
Dv_Sys_Action_CreateDate datetime,
Dv_Sys_Action_ModifyId int,
Dv_Sys_Action_ModifyDate datetime
)