2015-10-28 22:49:59 +08:00
|
|
|
|
/*==============================================================*/
|
|
|
|
|
/* DBMS name: Microsoft SQL Server 2008 */
|
2015-11-19 22:47:56 +08:00
|
|
|
|
/* Created on: 2015/11/19 21:52:04 */
|
2015-10-28 22:49:59 +08:00
|
|
|
|
/*==============================================================*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if exists (select 1
|
|
|
|
|
from sysobjects
|
|
|
|
|
where id = object_id('Module')
|
|
|
|
|
and type = 'U')
|
|
|
|
|
drop table Module
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1
|
|
|
|
|
from sysobjects
|
2015-11-15 23:06:43 +08:00
|
|
|
|
where id = object_id('ModuleElement')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
and type = 'U')
|
2015-11-15 23:06:43 +08:00
|
|
|
|
drop table ModuleElement
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1
|
|
|
|
|
from sysobjects
|
2015-11-15 23:06:43 +08:00
|
|
|
|
where id = object_id('ModuleElementGrant')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
and type = 'U')
|
2015-11-15 23:06:43 +08:00
|
|
|
|
drop table ModuleElementGrant
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1
|
|
|
|
|
from sysobjects
|
2015-11-15 23:06:43 +08:00
|
|
|
|
where id = object_id('ModuleRole')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
and type = 'U')
|
2015-11-15 23:06:43 +08:00
|
|
|
|
drop table ModuleRole
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1
|
|
|
|
|
from sysobjects
|
2015-11-15 23:06:43 +08:00
|
|
|
|
where id = object_id('Org')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
and type = 'U')
|
2015-11-15 23:06:43 +08:00
|
|
|
|
drop table Org
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1
|
|
|
|
|
from sysobjects
|
|
|
|
|
where id = object_id('Role')
|
|
|
|
|
and type = 'U')
|
|
|
|
|
drop table Role
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1
|
|
|
|
|
from sysobjects
|
|
|
|
|
where id = object_id('[User]')
|
|
|
|
|
and type = 'U')
|
|
|
|
|
drop table [User]
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1
|
|
|
|
|
from sysobjects
|
|
|
|
|
where id = object_id('UserCfg')
|
|
|
|
|
and type = 'U')
|
|
|
|
|
drop table UserCfg
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1
|
|
|
|
|
from sysobjects
|
|
|
|
|
where id = object_id('UserExt')
|
|
|
|
|
and type = 'U')
|
|
|
|
|
drop table UserExt
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1
|
|
|
|
|
from sysobjects
|
|
|
|
|
where id = object_id('UserModule')
|
|
|
|
|
and type = 'U')
|
|
|
|
|
drop table UserModule
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1
|
|
|
|
|
from sysobjects
|
|
|
|
|
where id = object_id('UserOrg')
|
|
|
|
|
and type = 'U')
|
|
|
|
|
drop table UserOrg
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1
|
|
|
|
|
from sysobjects
|
|
|
|
|
where id = object_id('UserRole')
|
|
|
|
|
and type = 'U')
|
|
|
|
|
drop table UserRole
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
/* Table: Module */
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
create table Module (
|
|
|
|
|
Id int identity,
|
|
|
|
|
CascadeId varchar(255) not null default ' ',
|
|
|
|
|
Name varchar(255) not null default ' ',
|
|
|
|
|
Url varchar(255) not null default ' ',
|
|
|
|
|
HotKey varchar(255) not null default ' ',
|
|
|
|
|
ParentId int not null default 0,
|
|
|
|
|
IsLeaf bit not null default 1,
|
|
|
|
|
IsAutoExpand bit not null default 0,
|
|
|
|
|
IconName varchar(255) not null default ' ',
|
|
|
|
|
Status int not null default 1,
|
|
|
|
|
ParentName varchar(255) not null default ' ',
|
|
|
|
|
Vector varchar(255) not null default ' ',
|
|
|
|
|
SortNo int not null default 0
|
|
|
|
|
)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1 from sys.extended_properties
|
|
|
|
|
where major_id = object_id('Module') and minor_id = 0)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Module')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Id')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'Id'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'Id'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Module')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'CascadeId')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'CascadeId'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'CascadeId'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Module')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Name')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'Name'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'Name'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Module')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Url')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'Url'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD>URL',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'Url'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Module')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'HotKey')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'HotKey'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>ȼ<EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'HotKey'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Module')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'ParentId')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'ParentId'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'ParentId'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Module')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'IsLeaf')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'IsLeaf'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>Ƿ<EFBFBD>Ҷ<EFBFBD>ӽڵ<EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'IsLeaf'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Module')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'IsAutoExpand')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'IsAutoExpand'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>Ƿ<EFBFBD><EFBFBD>Զ<EFBFBD>չ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'IsAutoExpand'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Module')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'IconName')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'IconName'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>ڵ<EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'IconName'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Module')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Status')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'Status'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ǰ״̬',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'Status'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Module')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'ParentName')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'ParentName'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'ParentName'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Module')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Vector')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'Vector'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'ʸ<EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'Vector'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Module')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'SortNo')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'SortNo'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Module', 'column', 'SortNo'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
alter table Module
|
|
|
|
|
add constraint PK_aos_sys_module primary key nonclustered (Id)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
/*==============================================================*/
|
2015-11-15 23:06:43 +08:00
|
|
|
|
/* Table: ModuleElement */
|
2015-10-28 22:49:59 +08:00
|
|
|
|
/*==============================================================*/
|
2015-11-15 23:06:43 +08:00
|
|
|
|
create table ModuleElement (
|
2015-10-28 22:49:59 +08:00
|
|
|
|
Id int identity,
|
2015-11-15 23:06:43 +08:00
|
|
|
|
DomId varchar(255) not null default ' ',
|
2015-10-28 22:49:59 +08:00
|
|
|
|
Name varchar(255) not null default ' ',
|
|
|
|
|
Type int not null default 0,
|
2015-11-15 23:06:43 +08:00
|
|
|
|
ModuleId int not null default 0,
|
|
|
|
|
Remark varchar(4000) not null default ' '
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1 from sys.extended_properties
|
2015-11-15 23:06:43 +08:00
|
|
|
|
where major_id = object_id('ModuleElement') and minor_id = 0)
|
2015-10-28 22:49:59 +08:00
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElement'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-19 21:49:39 +08:00
|
|
|
|
'ģ<EFBFBD><EFBFBD>Ԫ<EFBFBD>ر<EFBFBD>(<28><>ҪȨ<D2AA><EFBFBD><DEBF>Ƶİ<C6B5>ť)',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElement'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleElement')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Id')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElement', 'column', 'Id'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElement', 'column', 'Id'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleElement')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'DomId')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElement', 'column', 'DomId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'DOM ID',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElement', 'column', 'DomId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleElement')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Name')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElement', 'column', 'Name'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElement', 'column', 'Name'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleElement')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Type')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElement', 'column', 'Type'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElement', 'column', 'Type'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleElement')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'ModuleId')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElement', 'column', 'ModuleId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-19 21:49:39 +08:00
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>Id',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElement', 'column', 'ModuleId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleElement')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Remark')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElement', 'column', 'Remark'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD>ע',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElement', 'column', 'Remark'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
2015-11-15 23:06:43 +08:00
|
|
|
|
alter table ModuleElement
|
|
|
|
|
add constraint PK_MODULEELEMENT primary key (Id)
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
2015-11-15 23:06:43 +08:00
|
|
|
|
/*==============================================================*/
|
|
|
|
|
/* Table: ModuleElementGrant */
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
create table ModuleElementGrant (
|
|
|
|
|
Id int identity,
|
|
|
|
|
ElementId int not null default 0,
|
|
|
|
|
UserId int not null default 0,
|
|
|
|
|
RoleId int not null default 0,
|
|
|
|
|
GrantType int not null default 0
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
go
|
|
|
|
|
|
2015-11-15 23:06:43 +08:00
|
|
|
|
if exists (select 1 from sys.extended_properties
|
|
|
|
|
where major_id = object_id('ModuleElementGrant') and minor_id = 0)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElementGrant'
|
|
|
|
|
|
|
|
|
|
end
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
|
2015-11-15 23:06:43 +08:00
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElementGrant'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleElementGrant')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Id')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElementGrant', 'column', 'Id'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElementGrant', 'column', 'Id'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleElementGrant')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'ElementId')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElementGrant', 'column', 'ElementId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-19 21:49:39 +08:00
|
|
|
|
'Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElementGrant', 'column', 'ElementId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleElementGrant')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'UserId')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElementGrant', 'column', 'UserId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElementGrant', 'column', 'UserId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleElementGrant')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'RoleId')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElementGrant', 'column', 'RoleId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElementGrant', 'column', 'RoleId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleElementGrant')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'GrantType')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElementGrant', 'column', 'GrantType'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleElementGrant', 'column', 'GrantType'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
2015-11-15 23:06:43 +08:00
|
|
|
|
alter table ModuleElementGrant
|
|
|
|
|
add constraint PK_MODULEELEMENTGRANT primary key (Id)
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
/*==============================================================*/
|
2015-11-15 23:06:43 +08:00
|
|
|
|
/* Table: ModuleRole */
|
2015-10-28 22:49:59 +08:00
|
|
|
|
/*==============================================================*/
|
2015-11-15 23:06:43 +08:00
|
|
|
|
create table ModuleRole (
|
2015-10-28 22:49:59 +08:00
|
|
|
|
Id int identity,
|
2015-11-15 23:06:43 +08:00
|
|
|
|
RoleId int not null default 0,
|
2015-10-28 22:49:59 +08:00
|
|
|
|
ModuleId int not null default 0,
|
|
|
|
|
Type int not null default 0,
|
2015-11-15 23:06:43 +08:00
|
|
|
|
OperateTime datetime not null default getdate(),
|
|
|
|
|
OperatorId int not null default 0
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1 from sys.extended_properties
|
2015-11-15 23:06:43 +08:00
|
|
|
|
where major_id = object_id('ModuleRole') and minor_id = 0)
|
2015-10-28 22:49:59 +08:00
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleRole'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>-<2D><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleRole'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleRole')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Id')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleRole', 'column', 'Id'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleRole', 'column', 'Id'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleRole')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'RoleId')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleRole', 'column', 'RoleId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleRole', 'column', 'RoleId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleRole')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'ModuleId')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleRole', 'column', 'ModuleId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleRole', 'column', 'ModuleId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleRole')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Type')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleRole', 'column', 'Type'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleRole', 'column', 'Type'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('ModuleRole')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'OperateTime')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleRole', 'column', 'OperateTime'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD>Ȩʱ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleRole', 'column', 'OperateTime'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
2015-11-19 21:49:39 +08:00
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('ModuleRole')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'OperatorId')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleRole', 'column', 'OperatorId'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'ModuleRole', 'column', 'OperatorId'
|
|
|
|
|
go
|
|
|
|
|
|
2015-11-15 23:06:43 +08:00
|
|
|
|
alter table ModuleRole
|
|
|
|
|
add constraint PK_MODULEROLE primary key (Id)
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
2015-11-15 23:06:43 +08:00
|
|
|
|
/*==============================================================*/
|
|
|
|
|
/* Table: Org */
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
create table Org (
|
|
|
|
|
Id int identity,
|
|
|
|
|
CascadeId varchar(255) not null default ' ',
|
|
|
|
|
Name varchar(255) not null default ' ',
|
|
|
|
|
HotKey varchar(255) not null default ' ',
|
|
|
|
|
ParentId int not null default 0,
|
|
|
|
|
ParentName varchar(255) not null default ' ',
|
|
|
|
|
IsLeaf bit not null default 1,
|
|
|
|
|
IsAutoExpand bit not null default 0,
|
|
|
|
|
IconName varchar(255) not null default ' ',
|
|
|
|
|
Status int not null default 1,
|
|
|
|
|
Type int not null default 0,
|
|
|
|
|
BizCode varchar(255) not null default ' ',
|
|
|
|
|
CustomCode varchar(4000) not null default ' ',
|
|
|
|
|
CreateTime datetime not null default getdate(),
|
|
|
|
|
CreateId int not null default 0,
|
|
|
|
|
SortNo int not null default 0
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
2015-11-15 23:06:43 +08:00
|
|
|
|
go
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
2015-11-15 23:06:43 +08:00
|
|
|
|
if exists (select 1 from sys.extended_properties
|
|
|
|
|
where major_id = object_id('Org') and minor_id = 0)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org'
|
|
|
|
|
|
|
|
|
|
end
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
|
2015-11-15 23:06:43 +08:00
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>֯<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Id')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'Id'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'Id'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'CascadeId')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'CascadeId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'CascadeId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Name')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'Name'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD>֯<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'Name'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'HotKey')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'HotKey'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD>ȼ<EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'HotKey'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'ParentId')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'ParentId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'ParentId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'ParentName')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'ParentName'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'ParentName'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'IsLeaf')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'IsLeaf'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD>Ƿ<EFBFBD>Ҷ<EFBFBD>ӽڵ<EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'IsLeaf'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'IsAutoExpand')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'IsAutoExpand'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD>Ƿ<EFBFBD><EFBFBD>Զ<EFBFBD>չ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'IsAutoExpand'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'IconName')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'IconName'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD>ڵ<EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'IconName'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Status')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'Status'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD>ǰ״̬',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'Status'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Type')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'Type'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD>֯<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'Type'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'BizCode')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'BizCode'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'BizCode'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'CustomCode')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'CustomCode'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'CustomCode'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'CreateTime')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'CreateTime'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'CreateTime'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'CreateId')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'CreateId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'CreateId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
2015-11-15 23:06:43 +08:00
|
|
|
|
p.major_id = object_id('Org')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'SortNo')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'SortNo'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-15 23:06:43 +08:00
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Org', 'column', 'SortNo'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
2015-11-15 23:06:43 +08:00
|
|
|
|
alter table Org
|
|
|
|
|
add constraint PK_ORG primary key (Id)
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
/* Table: Role */
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
create table Role (
|
2015-11-19 22:47:56 +08:00
|
|
|
|
Id int identity,
|
2015-10-28 22:49:59 +08:00
|
|
|
|
Name varchar(255) not null default ' ',
|
|
|
|
|
Status int not null default 1,
|
|
|
|
|
Type int not null default 0,
|
|
|
|
|
CreateTime datetime not null default getdate(),
|
|
|
|
|
CreateId varchar(64) not null default ' ',
|
2015-11-19 21:49:39 +08:00
|
|
|
|
OrgId int not null default 0,
|
|
|
|
|
OrgCascadeId varchar(255) not null default ' ',
|
|
|
|
|
OrgName varchar(255) not null default ' '
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1 from sys.extended_properties
|
|
|
|
|
where major_id = object_id('Role') and minor_id = 0)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Role')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Id')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'Id'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'Id'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Role')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Name')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'Name'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'Name'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Role')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Status')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'Status'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ǰ״̬',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'Status'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Role')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Type')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'Type'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'Type'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Role')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'CreateTime')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'CreateTime'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'CreateTime'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Role')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'CreateId')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'CreateId'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'CreateId'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Role')
|
2015-11-19 21:49:39 +08:00
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'OrgId')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-19 21:49:39 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'OrgId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-19 21:49:39 +08:00
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'OrgId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Role')
|
2015-11-19 21:49:39 +08:00
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'OrgCascadeId')
|
2015-10-28 22:49:59 +08:00
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
2015-11-19 21:49:39 +08:00
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'OrgCascadeId'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
2015-11-19 21:49:39 +08:00
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Žڵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'OrgCascadeId'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('Role')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'OrgName')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'OrgName'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'Role', 'column', 'OrgName'
|
2015-10-28 22:49:59 +08:00
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
alter table Role
|
|
|
|
|
add constraint PK_ROLE primary key (Id)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
/* Table: [User] */
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
create table [User] (
|
2015-11-15 23:06:43 +08:00
|
|
|
|
Id int identity,
|
2015-10-28 22:49:59 +08:00
|
|
|
|
Account varchar(255) not null default ' ',
|
|
|
|
|
Password varchar(255) not null default ' ',
|
|
|
|
|
Name varchar(255) not null default ' ',
|
|
|
|
|
Sex int not null default 0,
|
|
|
|
|
Status int not null default 0,
|
|
|
|
|
Type int not null default 0,
|
|
|
|
|
BizCode varchar(255) not null default ' ',
|
|
|
|
|
CreateTime datetime not null default getdate(),
|
|
|
|
|
CreateId int not null default 0
|
|
|
|
|
)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1 from sys.extended_properties
|
|
|
|
|
where major_id = object_id('[User]') and minor_id = 0)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('[User]')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Id')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'Id'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'Id'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('[User]')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Account')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'Account'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>ʺ<EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'Account'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('[User]')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Password')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'Password'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'Password'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('[User]')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Name')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'Name'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'Name'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('[User]')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Sex')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'Sex'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>Ա<EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'Sex'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('[User]')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Status')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'Status'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD>״̬',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'Status'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('[User]')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Type')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'Type'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'Type'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('[User]')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'BizCode')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'BizCode'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'BizCode'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('[User]')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'CreateTime')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'CreateTime'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'CreateTime'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('[User]')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'CreateId')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'CreateId'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', '[User]', 'column', 'CreateId'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
alter table [User]
|
|
|
|
|
add constraint PK_USER primary key (Id)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
/* Table: UserCfg */
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
create table UserCfg (
|
|
|
|
|
Id int not null default 0,
|
|
|
|
|
Theme varchar(255) not null default ' ',
|
|
|
|
|
Skin varchar(255) not null default ' ',
|
|
|
|
|
NavBarStyle varchar(255) not null default ' ',
|
|
|
|
|
TabFocusColor varchar(255) not null default ' ',
|
|
|
|
|
NavTabIndex int not null default 0
|
|
|
|
|
)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1 from sys.extended_properties
|
|
|
|
|
where major_id = object_id('UserCfg') and minor_id = 0)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserCfg'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserCfg'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserCfg')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Id')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserCfg', 'column', 'Id'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD>ID',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserCfg', 'column', 'Id'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserCfg')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Theme')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserCfg', 'column', 'Theme'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserCfg', 'column', 'Theme'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserCfg')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Skin')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserCfg', 'column', 'Skin'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserCfg', 'column', 'Skin'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserCfg')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'NavBarStyle')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserCfg', 'column', 'NavBarStyle'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserCfg', 'column', 'NavBarStyle'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserCfg')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'TabFocusColor')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserCfg', 'column', 'TabFocusColor'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'Tab<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserCfg', 'column', 'TabFocusColor'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserCfg')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'NavTabIndex')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserCfg', 'column', 'NavTabIndex'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȱʡ<EFBFBD>ҳ',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserCfg', 'column', 'NavTabIndex'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
alter table UserCfg
|
|
|
|
|
add constraint PK_USERCFG primary key (Id)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
/* Table: UserExt */
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
create table UserExt (
|
|
|
|
|
Id int not null,
|
|
|
|
|
Email varchar(255) not null default ' ',
|
|
|
|
|
Phone_ varchar(255) not null default ' ',
|
|
|
|
|
Mobile varchar(255) not null default ' ',
|
|
|
|
|
Address varchar(255) not null default ' ',
|
|
|
|
|
Zip varchar(255) not null default ' ',
|
|
|
|
|
Birthday varchar(255) not null default ' ',
|
|
|
|
|
IdCard varchar(255) not null default ' ',
|
|
|
|
|
QQ varchar(255) not null default ' ',
|
|
|
|
|
DynamicField varchar(4000) not null default ' ',
|
|
|
|
|
ByteArrayId int not null default 0,
|
|
|
|
|
Remark varchar(4000) not null default ' ',
|
|
|
|
|
Field1 varchar(255) not null default ' ',
|
|
|
|
|
Field2 varchar(255) not null default ' ',
|
|
|
|
|
Field3 varchar(255) not null default ' '
|
|
|
|
|
)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1 from sys.extended_properties
|
|
|
|
|
where major_id = object_id('UserExt') and minor_id = 0)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserExt')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Id')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Id'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD>ID',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Id'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserExt')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Email')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Email'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Email'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserExt')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Phone_')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Phone_'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>̶<EFBFBD><EFBFBD>绰',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Phone_'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserExt')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Mobile')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Mobile'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>ƶ<EFBFBD><EFBFBD>绰',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Mobile'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserExt')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Address')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Address'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>ַ',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Address'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserExt')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Zip')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Zip'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>ʱ<EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Zip'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserExt')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Birthday')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Birthday'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Birthday'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserExt')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'IdCard')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'IdCard'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'IdCard'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserExt')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'QQ')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'QQ'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'QQ',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'QQ'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserExt')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'DynamicField')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'DynamicField'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD>չ<EFBFBD>ֶ<EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'DynamicField'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserExt')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'ByteArrayId')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'ByteArrayId'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ID',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'ByteArrayId'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserExt')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Remark')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Remark'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ע',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Remark'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserExt')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Field1')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Field1'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD>չ<EFBFBD>ֶ<EFBFBD>1',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Field1'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserExt')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Field2')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Field2'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD>չ<EFBFBD>ֶ<EFBFBD>2',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Field2'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserExt')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Field3')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Field3'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD>չ<EFBFBD>ֶ<EFBFBD>3',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserExt', 'column', 'Field3'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
alter table UserExt
|
|
|
|
|
add constraint PK_USEREXT primary key (Id)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
/* Table: UserModule */
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
create table UserModule (
|
2015-11-15 23:06:43 +08:00
|
|
|
|
Id int identity,
|
2015-10-28 22:49:59 +08:00
|
|
|
|
UserId int not null default 0,
|
|
|
|
|
ModuleId int not null default 0,
|
|
|
|
|
Type int not null default 0,
|
|
|
|
|
OperateTime datetime not null default getdate(),
|
|
|
|
|
OperatorId int not null default 0
|
|
|
|
|
)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1 from sys.extended_properties
|
|
|
|
|
where major_id = object_id('UserModule') and minor_id = 0)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserModule'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>-<2D>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserModule'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserModule')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Id')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserModule', 'column', 'Id'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserModule', 'column', 'Id'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserModule')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'UserId')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserModule', 'column', 'UserId'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserModule', 'column', 'UserId'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserModule')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'ModuleId')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserModule', 'column', 'ModuleId'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserModule', 'column', 'ModuleId'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserModule')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Type')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserModule', 'column', 'Type'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserModule', 'column', 'Type'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserModule')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'OperateTime')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserModule', 'column', 'OperateTime'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>Ȩʱ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserModule', 'column', 'OperateTime'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserModule')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'OperatorId')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserModule', 'column', 'OperatorId'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserModule', 'column', 'OperatorId'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
alter table UserModule
|
|
|
|
|
add constraint PK_USERMODULE primary key (Id)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
/* Table: UserOrg */
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
create table UserOrg (
|
2015-11-15 23:06:43 +08:00
|
|
|
|
Id int identity,
|
2015-10-28 22:49:59 +08:00
|
|
|
|
OrgId int not null default 0,
|
|
|
|
|
UserId int not null default 0,
|
|
|
|
|
OperateTime datetime not null default getdate(),
|
|
|
|
|
OperatorId int not null default 0
|
|
|
|
|
)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1 from sys.extended_properties
|
|
|
|
|
where major_id = object_id('UserOrg') and minor_id = 0)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserOrg'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD>-<2D><><EFBFBD>Ź<EFBFBD><C5B9><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserOrg'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserOrg')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Id')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserOrg', 'column', 'Id'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserOrg', 'column', 'Id'
|
|
|
|
|
go
|
|
|
|
|
|
2015-11-19 21:49:39 +08:00
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserOrg')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'OrgId')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserOrg', 'column', 'OrgId'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserOrg', 'column', 'OrgId'
|
|
|
|
|
go
|
|
|
|
|
|
2015-10-28 22:49:59 +08:00
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserOrg')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'UserId')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserOrg', 'column', 'UserId'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserOrg', 'column', 'UserId'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserOrg')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'OperateTime')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserOrg', 'column', 'OperateTime'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>Ȩʱ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserOrg', 'column', 'OperateTime'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserOrg')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'OperatorId')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserOrg', 'column', 'OperatorId'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserOrg', 'column', 'OperatorId'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
alter table UserOrg
|
|
|
|
|
add constraint PK_USERORG primary key (Id)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
/* Table: UserRole */
|
|
|
|
|
/*==============================================================*/
|
|
|
|
|
create table UserRole (
|
2015-11-15 23:06:43 +08:00
|
|
|
|
Id int identity,
|
2015-10-28 22:49:59 +08:00
|
|
|
|
RoleId int not null default 0,
|
|
|
|
|
UserId int not null default 0,
|
|
|
|
|
OperateTime datetime not null default getdate(),
|
|
|
|
|
OperatorId int not null default 0
|
|
|
|
|
)
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists (select 1 from sys.extended_properties
|
|
|
|
|
where major_id = object_id('UserRole') and minor_id = 0)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserRole'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD>-<2D><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserRole'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserRole')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Id')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserRole', 'column', 'Id'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserRole', 'column', 'Id'
|
|
|
|
|
go
|
|
|
|
|
|
2015-11-19 21:49:39 +08:00
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserRole')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'RoleId')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserRole', 'column', 'RoleId'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>ɫID',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserRole', 'column', 'RoleId'
|
|
|
|
|
go
|
|
|
|
|
|
2015-10-28 22:49:59 +08:00
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserRole')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'UserId')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserRole', 'column', 'UserId'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserRole', 'column', 'UserId'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserRole')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'OperateTime')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserRole', 'column', 'OperateTime'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>Ȩʱ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserRole', 'column', 'OperateTime'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
if exists(select 1 from sys.extended_properties p where
|
|
|
|
|
p.major_id = object_id('UserRole')
|
|
|
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'OperatorId')
|
|
|
|
|
)
|
|
|
|
|
begin
|
|
|
|
|
declare @CurrentUser sysname
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserRole', 'column', 'OperatorId'
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select @CurrentUser = user_name()
|
|
|
|
|
execute sp_addextendedproperty 'MS_Description',
|
|
|
|
|
'<EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>',
|
|
|
|
|
'user', @CurrentUser, 'table', 'UserRole', 'column', 'OperatorId'
|
|
|
|
|
go
|
|
|
|
|
|
|
|
|
|
alter table UserRole
|
|
|
|
|
add constraint PK_USERROLE primary key (Id)
|
|
|
|
|
go
|
2015-11-19 21:49:39 +08:00
|
|
|
|
|