日期:2014-05-17  浏览次数:20478 次

SQL TREE
SQL code

CREATE TABLE [dbo].[tblAdminNavigation](
    [NavID] [int] IDENTITY(1,1) NOT NULL,
    [NavName] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
    [ParentID] [int] NULL,
    [IsNav] [bit] NULL,
    [NavUrl] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL,
    [Sort] [int] NULL,
    [Remark] [nvarchar](200) COLLATE Chinese_PRC_CI_AS NULL,
    [PermissionCode] [int] NULL,
    [PermissionFile] [varchar](200) COLLATE Chinese_PRC_CI_AS NULL,
 CONSTRAINT [PK_tblAdminNavigation] PRIMARY KEY CLUSTERED 
(
    [NavID] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'导航' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'tblAdminNavigation', @level2type=N'COLUMN',@level2name=N'NavID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'导航名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'tblAdminNavigation', @level2type=N'COLUMN',@level2name=N'NavName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'父节点ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'tblAdminNavigation', @level2type=N'COLUMN',@level2name=N'ParentID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否为导航' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'tblAdminNavigation', @level2type=N'COLUMN',@level2name=N'IsNav'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'导航链接' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'tblAdminNavigation', @level2type=N'COLUMN',@level2name=N'NavUrl'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'导航排序' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'tblAdminNavigation', @level2type=N'COLUMN',@level2name=N'Sort'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'备注' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'tblAdminNavigation', @level2type=N'COLUMN',@level2name=N'Remark'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'权限代码(取枚举类型)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'tblAdminNavigation', @level2type=N'COLUMN',@level2name=N'PermissionCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'权限对应的文件路径' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'tblAdminNavigation', @level2type=N'COLUMN',@level2name=N'PermissionFile'



测试数据如下
SQL code

SET IDENTITY_INSERT [dbo].[tblAdminNavigation] ON
INSERT [dbo].[tblAdminNavigation] ([NavID], [NavName], [ParentID], [IsNav], [NavUrl], [Sort], [Remark], [PermissionCode], [PermissionFile]) VALUES (1, N'学员管理', 0, 1, N'', 1, N'', 0, N'')
INSERT [dbo].[tblAdminNavigation] ([NavID], [NavName], [ParentID], [IsNav], [NavUrl], [Sort], [Remark], [PermissionCode], [PermissionFile]) VALUES (2, N'学员列表', 1, 1, N'../Student/List', 12, N'', 0, N'')
INSERT [dbo].[tblAdminNavigation] ([NavID], [NavName], [ParentID], [IsNav], [NavUrl], [Sort], [Remark], [PermissionCode], [PermissionFile]) VALUES (3, N'教务管理', 0, 1, N'', 2, N'', 0, N'')
INSERT [dbo].[tblAdminNavigation] ([NavID], [NavName], [ParentID], [IsNav], [NavUrl], [Sort], [Remark], [PermissionCode], [PermissionFile]) VALUES (4, N'班级列表', 3, 1, N'../Student/List', 2, N'', 0, N'')
INSERT [dbo].[tblAdminNavigation] ([NavID], [NavName], [ParentID], [IsNav], [NavUrl], [Sort], [Remark], [PermissionCode], [PermissionFile]) VALUES (5, N'新增学员', 1, 1, N'../ServiceLog/List', 13, N'', 0, N'')
INSERT [dbo].[tblAdminNavig