首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

|M| 500分第二贴:求做一个Web系统的权限的编程思想和数据库设计和具体实现(大家看看小弟我设计的表)

2012-03-24 
|M| 500分第二贴:求做一个Web系统的权限的编程思想和数据库设计和具体实现(大家看看我设计的表)Red_angelX

|M| 500分第二贴:求做一个Web系统的权限的编程思想和数据库设计和具体实现(大家看看我设计的表)
Red_angelX(八戒)说:
用户表里面设计1个或者N个权限列,对应每个操作   1   0
这样可以对应每个操作都记录是否有权限-_-#

这样的话只对用户组来说是可以的,但现在我是对用户--> 角色--> 模块得到权限

以下是我的表
模块表
ID       模块名
1         汽车操作
2         火车操作
模块项目表
id       项目名
1         华南汽车票
2         华北汽车票
模块相应命令表
id     模块ID   项目ID     操作命令名
1       1             1               查看
2       1             2               下单

角色表
ID       角色
1         操作员
2         汽车操作员

角色操作设置
ID   角色ID     模块相应命令ID   是否可操作
1     1               1                             1
2     1               2                             0

用户角色设置
ID     用户ID     拥有角色ID
1       107           1
2       107           2

然后用页面命令前用
Authority(模块命令ID)==0?return;


public   static   Authority(Int   模块命令ID)
{
        return   sql查询当前用户相应模块命令ID的值
}

大家看看这样可不可以
我感觉应该可行,
但主要的是当用户权限数据写下来的时候就没有办法更改了


2

[解决办法]
/****** 对象: Table [dbo].[TB_ActionType] 脚本日期: 03/23/2007 15:10:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TB_ActionType](
[ActionTypeID] [smallint] IDENTITY(1,1) NOT NULL,
[ActionName] [nvarchar](10) NOT NULL,
[ActionRemark] [nvarchar](100) NULL,
CONSTRAINT [TB_ActionType_PK] PRIMARY KEY CLUSTERED
(
[ActionTypeID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** 对象: Table [dbo].[TB_FunctionAction] 脚本日期: 03/23/2007 15:10:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TB_FunctionAction](
[FAID] [int] IDENTITY(1,1) NOT NULL,
[ActionTypeID] [smallint] NOT NULL,
[FunID] [varchar](50) NULL,
CONSTRAINT [TB_FunctionAction_PK] PRIMARY KEY CLUSTERED
(
[FAID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** 对象: Table [dbo].[TB_SysFunctions] 脚本日期: 03/23/2007 15:10:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TB_SysFunctions](
[FunID] [varchar](50) NOT NULL,
[FunName] [nvarchar](100) NOT NULL,
[ParentID] [varchar](50) NULL,
[PagePath] [nvarchar](200) NULL,
[IsMenu] [smallint] NULL,
[Remark] [nvarchar](100) NULL,
CONSTRAINT [TB_SysFunctions_PK] PRIMARY KEY CLUSTERED
(
[FunID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]


) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** 对象: Table [dbo].[TB_SysRole] 脚本日期: 03/23/2007 15:10:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TB_SysRole](
[RoleID] [int] IDENTITY(1,1) NOT NULL,
[RoleName] [nvarchar](50) NOT NULL,
[Remark] [nvarchar](100) NULL,
[IsEnabled] [smallint] NOT NULL,
[UserID] [int] NULL,
CONSTRAINT [TB_SysRole_PK] PRIMARY KEY CLUSTERED
(
[RoleID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** 对象: Table [dbo].[TB_SysRoleList] 脚本日期: 03/23/2007 15:10:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TB_SysRoleList](
[RoleListID] [int] IDENTITY(1,1) NOT NULL,
[RoleID] [int] NOT NULL,
[FunID] [varchar](50) NULL,
[Remark] [nvarchar](100) NULL,
CONSTRAINT [TB_SysRoleList_PK] PRIMARY KEY CLUSTERED
(
[RoleListID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** 对象: Table [dbo].[TB_UserRoles] 脚本日期: 03/23/2007 15:10:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TB_UserRoles](
[UserRolesID] [int] IDENTITY(1,1) NOT NULL,
[UserID] [int] NOT NULL,
[RoleID] [int] NOT NULL,
[Remark] [nvarchar](50) NULL,
CONSTRAINT [TB_UserRoles_PK] PRIMARY KEY CLUSTERED
(
[UserRolesID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** 对象: Table [dbo].[TB_Users] 脚本日期: 03/23/2007 15:10:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TB_Users](
[UserID] [int] IDENTITY(1,1) NOT NULL,
[UserCode] [nvarchar](50) NOT NULL,
[TrueName] [nvarchar](20) NOT NULL,
[Sex] [smallint] NOT NULL,
[DepID] [smallint] NOT NULL,
[DutyID] [smallint] NOT NULL,
[GradeID] [int] NOT NULL,
[IDCard] [varchar](20) NOT NULL,
[CTel] [nvarchar](50) NULL,
[Mobile] [nvarchar](50) NULL,
[Address] [nvarchar](200) NULL,
[FamilyTel] [nvarchar](50) NULL,
[Email] [nvarchar](50) NULL,
[MSN] [nvarchar](50) NULL,
[QQ] [varchar](10) NULL,
[BirthDay] [smalldatetime] NOT NULL,
[UrgentUser] [nvarchar](50) NULL,
[UgUserContact] [nvarchar](200) NULL,
[JoinDate] [smalldatetime] NOT NULL,
[ContractEnd] [smalldatetime] NOT NULL,
[LeaveDate] [smalldatetime] NULL,
[LoginID] [nvarchar](20) NOT NULL,
[LoginPassword] [nvarchar](64) NOT NULL,
[UserLoginState] [smallint] NULL CONSTRAINT [DF_TB_Users_UserLoginState] DEFAULT ((2)),
[UserActionTime] [smalldatetime] NULL,
[LastLoginTime] [smalldatetime] NULL,
[LoginTimes] [bigint] NULL CONSTRAINT [DF_TB_Users_LoginTimes] DEFAULT ((0)),
[IsEnabled] [smallint] NOT NULL,
[CreateDate] [smalldatetime] NOT NULL,
[Remark] [nvarchar](100) NULL,
[CreateBy] [int] NOT NULL,
CONSTRAINT [TB_Users_PK] PRIMARY KEY CLUSTERED
(
[UserID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[TB_FunctionAction] WITH CHECK ADD CONSTRAINT [TB_ActionType_TB_FunctionAction_FK1] FOREIGN KEY([ActionTypeID])


REFERENCES [dbo].[TB_ActionType] ([ActionTypeID])
GO
ALTER TABLE [dbo].[TB_FunctionAction] CHECK CONSTRAINT [TB_ActionType_TB_FunctionAction_FK1]
GO
ALTER TABLE [dbo].[TB_FunctionAction] WITH CHECK ADD CONSTRAINT [TB_SysFunctions_TB_FunctionAction_FK1] FOREIGN KEY([FunID])
REFERENCES [dbo].[TB_SysFunctions] ([FunID])
GO
ALTER TABLE [dbo].[TB_FunctionAction] CHECK CONSTRAINT [TB_SysFunctions_TB_FunctionAction_FK1]
GO
ALTER TABLE [dbo].[TB_SysRole] WITH CHECK ADD CONSTRAINT [TB_Users_TB_SysRole_FK1] FOREIGN KEY([UserID])
REFERENCES [dbo].[TB_Users] ([UserID])
GO
ALTER TABLE [dbo].[TB_SysRole] CHECK CONSTRAINT [TB_Users_TB_SysRole_FK1]
GO
ALTER TABLE [dbo].[TB_SysRoleList] WITH CHECK ADD CONSTRAINT [TB_SysFunctions_TB_SysRoleList_FK1] FOREIGN KEY([FunID])
REFERENCES [dbo].[TB_SysFunctions] ([FunID])
GO
ALTER TABLE [dbo].[TB_SysRoleList] CHECK CONSTRAINT [TB_SysFunctions_TB_SysRoleList_FK1]
GO
ALTER TABLE [dbo].[TB_SysRoleList] WITH CHECK ADD CONSTRAINT [TB_SysRole_TB_SysRoleList_FK1] FOREIGN KEY([RoleID])
REFERENCES [dbo].[TB_SysRole] ([RoleID])
GO
ALTER TABLE [dbo].[TB_SysRoleList] CHECK CONSTRAINT [TB_SysRole_TB_SysRoleList_FK1]
GO
ALTER TABLE [dbo].[TB_UserRoles] WITH CHECK ADD CONSTRAINT [TB_SysRole_TB_UserRoles_FK1] FOREIGN KEY([RoleID])
REFERENCES [dbo].[TB_SysRole] ([RoleID])
GO
ALTER TABLE [dbo].[TB_UserRoles] CHECK CONSTRAINT [TB_SysRole_TB_UserRoles_FK1]
GO
ALTER TABLE [dbo].[TB_UserRoles] WITH CHECK ADD CONSTRAINT [TB_Users_TB_UserRoles_FK1] FOREIGN KEY([UserID])
REFERENCES [dbo].[TB_Users] ([UserID])
GO
ALTER TABLE [dbo].[TB_UserRoles] CHECK CONSTRAINT [TB_Users_TB_UserRoles_FK1]
GO
ALTER TABLE [dbo].[TB_Users] WITH CHECK ADD CONSTRAINT [TB_Department_TB_Users_FK1] FOREIGN KEY([DepID])
REFERENCES [dbo].[TB_Department] ([DepID])
GO
ALTER TABLE [dbo].[TB_Users] CHECK CONSTRAINT [TB_Department_TB_Users_FK1]
GO
ALTER TABLE [dbo].[TB_Users] WITH CHECK ADD CONSTRAINT [TB_Duty_TB_Users_FK1] FOREIGN KEY([DutyID])
REFERENCES [dbo].[TB_Duty] ([DutyID])
GO
ALTER TABLE [dbo].[TB_Users] CHECK CONSTRAINT [TB_Duty_TB_Users_FK1]


[解决办法]
但主要的是当用户权限数据写下来的时候就没有办法更改了===> 不明白?为什么不可以更改?
[解决办法]
//--权限控制到 页面按钮.
TB_Users 本系统用户表
TB_UserRoles 用户角色表
TB_SysRole 系统角色表
TB_SysRoleList 系统角色权限表
TB_SysFunctions 系统功能模块表(操作页面)
TB_FunctionAction 模块操作表(页面功能)
TB_ActionType 功能操作类型表

[解决办法]
以上的结构 可以随时 修改 基础权限 及用户的权限
可以将用户按 角色组 分
也可以将用户 定义具体的操作集合
[解决办法]
up
[解决办法]
数据库建上外键.只要操作有使用,就不会被删除.
[解决办法]
一看数据库就头大,特别是那么一大堆存储过程,想下思路先...
[解决办法]
如果你已经执行上面的代码 那么将你的test数据库删除 重新建
执行去掉
ALTER TABLE [dbo].[TB_Users] CHECK CONSTRAINT [TB_Department_TB_Users_FK1]
GO
ALTER TABLE [dbo].[TB_Users] WITH CHECK ADD CONSTRAINT [TB_Duty_TB_Users_FK1] FOREIGN KEY([DutyID])
REFERENCES [dbo].[TB_Duty] ([DutyID])
GO
ALTER TABLE [dbo].[TB_Users] CHECK CONSTRAINT [TB_Duty_TB_Users_FK1]

最后这几行
即可
[解决办法]
好复杂,只能帮顶了
------解决方案--------------------


/****** 对象: Table [dbo].[TB_ActionType] 脚本日期: 03/23/2007 15:10:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TB_ActionType](
[ActionTypeID] [smallint] IDENTITY(1,1) NOT NULL,
[ActionName] [nvarchar](10) NOT NULL,
[ActionRemark] [nvarchar](100) NULL,
CONSTRAINT [TB_ActionType_PK] PRIMARY KEY CLUSTERED
(
[ActionTypeID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** 对象: Table [dbo].[TB_FunctionAction] 脚本日期: 03/23/2007 15:10:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TB_FunctionAction](
[FAID] [int] IDENTITY(1,1) NOT NULL,
[ActionTypeID] [smallint] NOT NULL,
[FunID] [varchar](50) NULL,
CONSTRAINT [TB_FunctionAction_PK] PRIMARY KEY CLUSTERED
(
[FAID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** 对象: Table [dbo].[TB_SysFunctions] 脚本日期: 03/23/2007 15:10:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TB_SysFunctions](
[FunID] [varchar](50) NOT NULL,
[FunName] [nvarchar](100) NOT NULL,
[ParentID] [varchar](50) NULL,
[PagePath] [nvarchar](200) NULL,
[IsMenu] [smallint] NULL,
[Remark] [nvarchar](100) NULL,
CONSTRAINT [TB_SysFunctions_PK] PRIMARY KEY CLUSTERED
(
[FunID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** 对象: Table [dbo].[TB_SysRole] 脚本日期: 03/23/2007 15:10:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TB_SysRole](
[RoleID] [int] IDENTITY(1,1) NOT NULL,
[RoleName] [nvarchar](50) NOT NULL,
[Remark] [nvarchar](100) NULL,
[IsEnabled] [smallint] NOT NULL,
[UserID] [int] NULL,
CONSTRAINT [TB_SysRole_PK] PRIMARY KEY CLUSTERED
(
[RoleID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** 对象: Table [dbo].[TB_SysRoleList] 脚本日期: 03/23/2007 15:10:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TB_SysRoleList](
[RoleListID] [int] IDENTITY(1,1) NOT NULL,
[RoleID] [int] NOT NULL,
[FunID] [varchar](50) NULL,
[Remark] [nvarchar](100) NULL,
CONSTRAINT [TB_SysRoleList_PK] PRIMARY KEY CLUSTERED
(
[RoleListID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** 对象: Table [dbo].[TB_UserRoles] 脚本日期: 03/23/2007 15:10:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TB_UserRoles](
[UserRolesID] [int] IDENTITY(1,1) NOT NULL,
[UserID] [int] NOT NULL,
[RoleID] [int] NOT NULL,
[Remark] [nvarchar](50) NULL,
CONSTRAINT [TB_UserRoles_PK] PRIMARY KEY CLUSTERED
(
[UserRolesID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]


) ON [PRIMARY]

GO
/****** 对象: Table [dbo].[TB_Users] 脚本日期: 03/23/2007 15:10:32 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TB_Users](
[UserID] [int] IDENTITY(1,1) NOT NULL,
[UserCode] [nvarchar](50) NOT NULL,
[TrueName] [nvarchar](20) NOT NULL,
[Sex] [smallint] NOT NULL,
[DepID] [smallint] NOT NULL,
[DutyID] [smallint] NOT NULL,
[GradeID] [int] NOT NULL,
[IDCard] [varchar](20) NOT NULL,
[CTel] [nvarchar](50) NULL,
[Mobile] [nvarchar](50) NULL,
[Address] [nvarchar](200) NULL,
[FamilyTel] [nvarchar](50) NULL,
[Email] [nvarchar](50) NULL,
[MSN] [nvarchar](50) NULL,
[QQ] [varchar](10) NULL,
[BirthDay] [smalldatetime] NOT NULL,
[UrgentUser] [nvarchar](50) NULL,
[UgUserContact] [nvarchar](200) NULL,
[JoinDate] [smalldatetime] NOT NULL,
[ContractEnd] [smalldatetime] NOT NULL,
[LeaveDate] [smalldatetime] NULL,
[LoginID] [nvarchar](20) NOT NULL,
[LoginPassword] [nvarchar](64) NOT NULL,
[UserLoginState] [smallint] NULL CONSTRAINT [DF_TB_Users_UserLoginState] DEFAULT ((2)),
[UserActionTime] [smalldatetime] NULL,
[LastLoginTime] [smalldatetime] NULL,
[LoginTimes] [bigint] NULL CONSTRAINT [DF_TB_Users_LoginTimes] DEFAULT ((0)),
[IsEnabled] [smallint] NOT NULL,
[CreateDate] [smalldatetime] NOT NULL,
[Remark] [nvarchar](100) NULL,
[CreateBy] [int] NOT NULL,
CONSTRAINT [TB_Users_PK] PRIMARY KEY CLUSTERED
(
[UserID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[TB_FunctionAction] WITH CHECK ADD CONSTRAINT [TB_ActionType_TB_FunctionAction_FK1] FOREIGN KEY([ActionTypeID])
REFERENCES [dbo].[TB_ActionType] ([ActionTypeID])
GO
ALTER TABLE [dbo].[TB_FunctionAction] CHECK CONSTRAINT [TB_ActionType_TB_FunctionAction_FK1]
GO
ALTER TABLE [dbo].[TB_FunctionAction] WITH CHECK ADD CONSTRAINT [TB_SysFunctions_TB_FunctionAction_FK1] FOREIGN KEY([FunID])
REFERENCES [dbo].[TB_SysFunctions] ([FunID])
GO
ALTER TABLE [dbo].[TB_FunctionAction] CHECK CONSTRAINT [TB_SysFunctions_TB_FunctionAction_FK1]
GO
ALTER TABLE [dbo].[TB_SysRole] WITH CHECK ADD CONSTRAINT [TB_Users_TB_SysRole_FK1] FOREIGN KEY([UserID])
REFERENCES [dbo].[TB_Users] ([UserID])
GO
ALTER TABLE [dbo].[TB_SysRole] CHECK CONSTRAINT [TB_Users_TB_SysRole_FK1]
GO
ALTER TABLE [dbo].[TB_SysRoleList] WITH CHECK ADD CONSTRAINT [TB_SysFunctions_TB_SysRoleList_FK1] FOREIGN KEY([FunID])
REFERENCES [dbo].[TB_SysFunctions] ([FunID])
GO
ALTER TABLE [dbo].[TB_SysRoleList] CHECK CONSTRAINT [TB_SysFunctions_TB_SysRoleList_FK1]
GO
ALTER TABLE [dbo].[TB_SysRoleList] WITH CHECK ADD CONSTRAINT [TB_SysRole_TB_SysRoleList_FK1] FOREIGN KEY([RoleID])
REFERENCES [dbo].[TB_SysRole] ([RoleID])
GO
ALTER TABLE [dbo].[TB_SysRoleList] CHECK CONSTRAINT [TB_SysRole_TB_SysRoleList_FK1]
GO
ALTER TABLE [dbo].[TB_UserRoles] WITH CHECK ADD CONSTRAINT [TB_SysRole_TB_UserRoles_FK1] FOREIGN KEY([RoleID])
REFERENCES [dbo].[TB_SysRole] ([RoleID])
GO
ALTER TABLE [dbo].[TB_UserRoles] CHECK CONSTRAINT [TB_SysRole_TB_UserRoles_FK1]
GO
ALTER TABLE [dbo].[TB_UserRoles] WITH CHECK ADD CONSTRAINT [TB_Users_TB_UserRoles_FK1] FOREIGN KEY([UserID])
REFERENCES [dbo].[TB_Users] ([UserID])
GO
ALTER TABLE [dbo].[TB_UserRoles] CHECK CONSTRAINT [TB_Users_TB_UserRoles_FK1]
GO
ALTER TABLE [dbo].[TB_Users] WITH CHECK ADD CONSTRAINT [TB_Department_TB_Users_FK1] FOREIGN KEY([DepID])
REFERENCES [dbo].[TB_Department] ([DepID])


GO
ALTER TABLE [dbo].[TB_Users] CHECK CONSTRAINT [TB_Department_TB_Users_FK1]
GO
ALTER TABLE [dbo].[TB_Users] WITH CHECK ADD CONSTRAINT [TB_Duty_TB_Users_FK1] FOREIGN KEY([DutyID])
REFERENCES [dbo].[TB_Duty] ([DutyID])
GO
ALTER TABLE [dbo].[TB_Users] CHECK CONSTRAINT [TB_Duty_TB_Users_FK1]

这位大哥太强了
这么复杂

热点排行