重新写级联删除用户功能,使用存储过程
This commit is contained in:
parent
7c1f96bca3
commit
61c49e4609
|
@ -103,25 +103,19 @@ namespace Bootstrap.DataAccess
|
|||
{
|
||||
bool ret = false;
|
||||
if (string.IsNullOrEmpty(ids) || ids.Contains("'")) return ret;
|
||||
using (TransactionPackage transaction = DBAccessManager.SqlDBAccess.BeginTransaction())
|
||||
try
|
||||
{
|
||||
try
|
||||
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.StoredProcedure, "Proc_DeleteUsers"))
|
||||
{
|
||||
string sql = string.Format(CultureInfo.InvariantCulture, "Delete from Users where ID in ({0})", ids);
|
||||
sql += string.Format("delete from UserRole where UserID in ({0});", ids);
|
||||
sql += string.Format("delete from UserGroup where UserID in ({0});", ids);
|
||||
using (DbCommand cmd = DBAccessManager.SqlDBAccess.CreateCommand(CommandType.Text, sql))
|
||||
{
|
||||
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd);
|
||||
}
|
||||
CacheCleanUtility.ClearCache(userIds: ids);
|
||||
ret = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExceptionManager.Publish(ex);
|
||||
transaction.RollbackTransaction();
|
||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@ids", ids, ParameterDirection.Input));
|
||||
DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd);
|
||||
}
|
||||
CacheCleanUtility.ClearCache(userIds: ids);
|
||||
ret = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ExceptionManager.Publish(ex);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sql", "sql", "{87319AF5-7C4
|
|||
ProjectSection(SolutionItems) = preProject
|
||||
DatabaseScripts\InitData.sql = DatabaseScripts\InitData.sql
|
||||
DatabaseScripts\Install.sql = DatabaseScripts\Install.sql
|
||||
DatabaseScripts\Procedures.sql = DatabaseScripts\Procedures.sql
|
||||
DatabaseScripts\Readme.txt = DatabaseScripts\Readme.txt
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
|
|
@ -8,17 +8,13 @@ ALTER DATABASE [BootstrapAdmin] SET AUTO_SHRINK ON
|
|||
GO
|
||||
USE [BootstrapAdmin]
|
||||
GO
|
||||
|
||||
/****** Object: Table [dbo].[Users] Script Date: 11/06/2016 15:23:21 ******/
|
||||
/****** Object: Table [dbo].[Users] Script Date: 11/07/2016 11:45:40 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
|
||||
SET ANSI_PADDING ON
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[Users](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[UserName] [varchar](50) NOT NULL,
|
||||
|
@ -32,111 +28,35 @@ CREATE TABLE [dbo].[Users](
|
|||
[ID] 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
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'用户名' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'UserName'
|
||||
GO
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'密码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'Password'
|
||||
GO
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'密码盐' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'PassSalt'
|
||||
GO
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'显示名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'DisplayName'
|
||||
GO
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'注册时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'RegisterTime'
|
||||
GO
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'批复时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Users', @level2type=N'COLUMN',@level2name=N'ApprovedTime'
|
||||
GO
|
||||
|
||||
/****** Object: Table [dbo].[Groups] Script Date: 10/22/2016 09:44:03 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[Groups](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[GroupName] [nvarchar](50) NULL,
|
||||
[Description] [nvarchar](500) NULL,
|
||||
CONSTRAINT [PK_Groups] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] 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
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Groups', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'部门名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Groups', @level2type=N'COLUMN',@level2name=N'GroupName'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'描述' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Groups', @level2type=N'COLUMN',@level2name=N'Description'
|
||||
GO
|
||||
|
||||
/****** Object: Table [dbo].[Roles] Script Date: 10/22/2016 09:44:03 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[Roles](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[RoleName] [nvarchar](50) NULL,
|
||||
[Description] [nvarchar](500) NULL,
|
||||
CONSTRAINT [PK_Roles] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] 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
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Roles', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'角色名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Roles', @level2type=N'COLUMN',@level2name=N'RoleName'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'描述' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Roles', @level2type=N'COLUMN',@level2name=N'Description'
|
||||
GO
|
||||
|
||||
/****** Object: Table [dbo].[UserGroup] Script Date: 10/22/2016 09:44:03 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[UserGroup](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[UserID] [int] NOT NULL,
|
||||
[GroupID] [int] NOT NULL,
|
||||
CONSTRAINT [PK_UserGroup] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] 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
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'UserGroup', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'用户ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'UserGroup', @level2type=N'COLUMN',@level2name=N'UserID'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'部门ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'UserGroup', @level2type=N'COLUMN',@level2name=N'GroupID'
|
||||
GO
|
||||
|
||||
/****** Object: Table [dbo].[UserRole] Script Date: 10/22/2016 09:44:03 ******/
|
||||
/****** Object: Table [dbo].[UserRole] Script Date: 11/07/2016 11:45:40 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[UserRole](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[UserID] [int] NOT NULL,
|
||||
[RoleID] [int] NOT NULL,
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[UserID] [int] NOT NULL,
|
||||
[RoleID] [int] NOT NULL,
|
||||
CONSTRAINT [PK_UserRole] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] ASC
|
||||
[ID] 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
|
||||
|
@ -146,19 +66,60 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'用户ID' , @l
|
|||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'角色ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'UserRole', @level2type=N'COLUMN',@level2name=N'RoleID'
|
||||
GO
|
||||
|
||||
/****** Object: Table [dbo].[RoleGroup] Script Date: 10/22/2016 09:44:03 ******/
|
||||
/****** Object: Table [dbo].[UserGroup] Script Date: 11/07/2016 11:45:40 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[UserGroup](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[UserID] [int] NOT NULL,
|
||||
[GroupID] [int] NOT NULL,
|
||||
CONSTRAINT [PK_UserGroup] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] 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
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'UserGroup', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'用户ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'UserGroup', @level2type=N'COLUMN',@level2name=N'UserID'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'部门ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'UserGroup', @level2type=N'COLUMN',@level2name=N'GroupID'
|
||||
GO
|
||||
/****** Object: Table [dbo].[Roles] Script Date: 11/07/2016 11:45:40 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[Roles](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[RoleName] [nvarchar](50) NULL,
|
||||
[Description] [nvarchar](500) NULL,
|
||||
CONSTRAINT [PK_Roles] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] 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
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Roles', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'角色名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Roles', @level2type=N'COLUMN',@level2name=N'RoleName'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'描述' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Roles', @level2type=N'COLUMN',@level2name=N'Description'
|
||||
GO
|
||||
/****** Object: Table [dbo].[RoleGroup] Script Date: 11/07/2016 11:45:40 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[RoleGroup](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[RoleID] [int] NOT NULL,
|
||||
[GroupID] [int] NOT NULL,
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[RoleID] [int] NOT NULL,
|
||||
[GroupID] [int] NOT NULL,
|
||||
CONSTRAINT [PK_RoleGroup] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] ASC
|
||||
[ID] 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
|
||||
|
@ -168,46 +129,51 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'角色ID' , @l
|
|||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'部门ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'RoleGroup', @level2type=N'COLUMN',@level2name=N'GroupID'
|
||||
GO
|
||||
|
||||
/****** Object: Table [dbo].[Dicts] Script Date: 2016/11/2 星期三 16:57:31 ******/
|
||||
/****** Object: Table [dbo].[Navigations] Script Date: 11/07/2016 11:45:40 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
SET ANSI_PADDING ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[Navigations](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[ParentId] [int] NOT NULL,
|
||||
[Name] [nvarchar](50) NOT NULL,
|
||||
[Order] [int] NOT NULL,
|
||||
[Icon] [varchar](50) NULL,
|
||||
[Url] [varchar](50) NULL,
|
||||
[Category] [nvarchar](50) NOT NULL,
|
||||
CONSTRAINT [PK_Navigations] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] 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
|
||||
/****** Object: Table [dbo].[NavigationRole] Script Date: 11/07/2016 11:45:40 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[NavigationRole](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[NavigationID] [int] NOT NULL,
|
||||
[RoleID] [int] NOT NULL,
|
||||
CONSTRAINT [PK_NavigationRole] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] 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
|
||||
/****** Object: Table [dbo].[Logs] Script Date: 11/07/2016 11:45:40 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[Dicts](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[Category] [nvarchar](50) NOT NULL,
|
||||
[Name] [nvarchar](50) NOT NULL,
|
||||
[Code] [nvarchar](50) NOT NULL,
|
||||
[Define] [int] NOT NULL,
|
||||
CONSTRAINT [PK_dbo.Dict] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] 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
|
||||
ALTER TABLE [dbo].[Dicts] ADD CONSTRAINT [DF_Dicts_Define] DEFAULT ((1)) FOR [Define]
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Dicts', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典种类' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Dicts', @level2type=N'COLUMN',@level2name=N'Category'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Dicts', @level2type=N'COLUMN',@level2name=N'Name'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Dicts', @level2type=N'COLUMN',@level2name=N'Code'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0表示系统使用,1表示自定义' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Dicts', @level2type=N'COLUMN',@level2name=N'Define'
|
||||
GO
|
||||
/****** Object: Table [dbo].[Logs] Script Date: 11/05/2016 14:17:40 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
|
||||
SET ANSI_PADDING ON
|
||||
GO
|
||||
|
||||
CREATE TABLE [dbo].[Logs](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[CRUD] [varchar](50) NOT NULL,
|
||||
|
@ -221,54 +187,73 @@ CREATE TABLE [dbo].[Logs](
|
|||
[ID] 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
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Logs', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Logs', @level2type=N'COLUMN',@level2name=N'CRUD'
|
||||
GO
|
||||
/****** Object: Table [dbo].[Navigations] ******/
|
||||
CREATE TABLE [dbo].[Navigations](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[ParentId] [int] NOT NULL,
|
||||
[Name] [nvarchar](50) NOT NULL,
|
||||
[Order] [int] NOT NULL,
|
||||
[Icon] [varchar](50) NULL,
|
||||
[Url] [varchar](50) NULL,
|
||||
[Category] [nvarchar](50) NOT NULL,
|
||||
CONSTRAINT [PK_Navigations] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] 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
|
||||
/****** Object: Table [dbo].[NavigationRole] Script Date: 10/28/2016 15:14:35 ******/
|
||||
/****** Object: Table [dbo].[Groups] Script Date: 11/07/2016 11:45:40 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[NavigationRole](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[NavigationID] [int] NOT NULL,
|
||||
[RoleID] [int] NOT NULL,
|
||||
CONSTRAINT [PK_NavigationRole] PRIMARY KEY CLUSTERED
|
||||
CREATE TABLE [dbo].[Groups](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[GroupName] [nvarchar](50) NULL,
|
||||
[Description] [nvarchar](500) NULL,
|
||||
CONSTRAINT [PK_Groups] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] ASC
|
||||
[ID] 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
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Groups', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'部门名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Groups', @level2type=N'COLUMN',@level2name=N'GroupName'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'描述' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Groups', @level2type=N'COLUMN',@level2name=N'Description'
|
||||
GO
|
||||
/****** Object: Table [dbo].[Dicts] Script Date: 11/07/2016 11:45:40 ******/
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
CREATE TABLE [dbo].[Dicts](
|
||||
[ID] [int] IDENTITY(1,1) NOT NULL,
|
||||
[Category] [nvarchar](50) NOT NULL,
|
||||
[Name] [nvarchar](50) NOT NULL,
|
||||
[Code] [nvarchar](50) NOT NULL,
|
||||
[Define] [int] NOT NULL,
|
||||
CONSTRAINT [PK_dbo.Dict] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[ID] 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
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Dicts', @level2type=N'COLUMN',@level2name=N'ID'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典种类' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Dicts', @level2type=N'COLUMN',@level2name=N'Category'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Dicts', @level2type=N'COLUMN',@level2name=N'Name'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'字典代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Dicts', @level2type=N'COLUMN',@level2name=N'Code'
|
||||
GO
|
||||
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0表示系统使用,1表示自定义' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Dicts', @level2type=N'COLUMN',@level2name=N'Define'
|
||||
GO
|
||||
/****** Object: Default [DF_Dicts_Define] Script Date: 11/07/2016 11:45:40 ******/
|
||||
ALTER TABLE [dbo].[Dicts] ADD CONSTRAINT [DF_Dicts_Define] DEFAULT ((1)) FOR [Define]
|
||||
GO
|
||||
/****** Object: Default [DF_Navigations_ParentId] Script Date: 11/07/2016 11:45:40 ******/
|
||||
ALTER TABLE [dbo].[Navigations] ADD CONSTRAINT [DF_Navigations_ParentId] DEFAULT ((0)) FOR [ParentId]
|
||||
GO
|
||||
/****** Object: Default [DF_Navigations_Order] Script Date: 11/07/2016 11:45:40 ******/
|
||||
ALTER TABLE [dbo].[Navigations] ADD CONSTRAINT [DF_Navigations_Order] DEFAULT ((0)) FOR [Order]
|
||||
GO
|
||||
/****** Object: Default [DF_Navigations_Icon] Script Date: 11/07/2016 11:45:40 ******/
|
||||
ALTER TABLE [dbo].[Navigations] ADD CONSTRAINT [DF_Navigations_Icon] DEFAULT ('none') FOR [Icon]
|
||||
GO
|
||||
/****** Object: Default [DF_Navigations_Category] Script Date: 11/07/2016 11:45:40 ******/
|
||||
ALTER TABLE [dbo].[Navigations] ADD CONSTRAINT [DF_Navigations_Category] DEFAULT ((0)) FOR [Category]
|
||||
GO
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
Drop PROCEDURE Proc_DeleteUsers
|
||||
GO
|
||||
-- =============================================
|
||||
-- Author: Argo Zhang
|
||||
-- Create date: 2016-09-06
|
||||
-- Description:
|
||||
-- =============================================
|
||||
Create PROCEDURE Proc_DeleteUsers
|
||||
-- Add the parameters for the stored procedure here
|
||||
@ids varchar(max)
|
||||
WITH ENCRYPTION
|
||||
AS
|
||||
BEGIN
|
||||
-- SET NOCOUNT ON added to prevent extra result sets from
|
||||
-- interfering with SELECT statements.
|
||||
SET NOCOUNT ON;
|
||||
SET XACT_ABORT ON;
|
||||
-- Insert statements for procedure here
|
||||
declare @sql varchar(max)
|
||||
set @sql = 'Delete from UserRole where UserID in (' + @ids + ');'
|
||||
set @sql += 'delete from UserGroup where UserID in (' + @ids + ');'
|
||||
set @sql += 'delete from Users where ID in (' + @ids + ');'
|
||||
exec(@sql)
|
||||
END
|
||||
GO
|
Loading…
Reference in New Issue