1914 lines
59 KiB
MySQL
1914 lines
59 KiB
MySQL
|
|
/*==============================================================*/
|
|||
|
|
/* DBMS name: Microsoft SQL Server 2012 */
|
|||
|
|
/* Created on: 2021/5/17 16:21:56 */
|
|||
|
|
/*==============================================================*/
|
|||
|
|
|
|||
|
|
|
|||
|
|
if exists (select 1
|
|||
|
|
from sysobjects
|
|||
|
|
where id = object_id('W_Account')
|
|||
|
|
and type = 'U')
|
|||
|
|
drop table W_Account
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1
|
|||
|
|
from sysobjects
|
|||
|
|
where id = object_id('W_AreaInfo')
|
|||
|
|
and type = 'U')
|
|||
|
|
drop table W_AreaInfo
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1
|
|||
|
|
from sysobjects
|
|||
|
|
where id = object_id('W_Business')
|
|||
|
|
and type = 'U')
|
|||
|
|
drop table W_Business
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1
|
|||
|
|
from sysobjects
|
|||
|
|
where id = object_id('W_Device')
|
|||
|
|
and type = 'U')
|
|||
|
|
drop table W_Device
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1
|
|||
|
|
from sysobjects
|
|||
|
|
where id = object_id('W_DeviceData')
|
|||
|
|
and type = 'U')
|
|||
|
|
drop table W_DeviceData
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1
|
|||
|
|
from sysobjects
|
|||
|
|
where id = object_id('W_DeviceRealData')
|
|||
|
|
and type = 'U')
|
|||
|
|
drop table W_DeviceRealData
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1
|
|||
|
|
from sysobjects
|
|||
|
|
where id = object_id('W_Menu')
|
|||
|
|
and type = 'U')
|
|||
|
|
drop table W_Menu
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1
|
|||
|
|
from sysobjects
|
|||
|
|
where id = object_id('W_Result')
|
|||
|
|
and type = 'U')
|
|||
|
|
drop table W_Result
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1
|
|||
|
|
from sysobjects
|
|||
|
|
where id = object_id('W_Role')
|
|||
|
|
and type = 'U')
|
|||
|
|
drop table W_Role
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1
|
|||
|
|
from sysobjects
|
|||
|
|
where id = object_id('W_RoleAuthorize')
|
|||
|
|
and type = 'U')
|
|||
|
|
drop table W_RoleAuthorize
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1
|
|||
|
|
from sysobjects
|
|||
|
|
where id = object_id('W_WasteType')
|
|||
|
|
and type = 'U')
|
|||
|
|
drop table W_WasteType
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
/*==============================================================*/
|
|||
|
|
/* Table: W_Account */
|
|||
|
|
/*==============================================================*/
|
|||
|
|
create table W_Account (
|
|||
|
|
Id uniqueidentifier not null,
|
|||
|
|
UserName varchar(50) not null,
|
|||
|
|
RealName nvarchar(100) not null,
|
|||
|
|
Phone varchar(50) not null,
|
|||
|
|
Password varchar(50) not null,
|
|||
|
|
Secret varchar(50) not null,
|
|||
|
|
RoleId uniqueidentifier not null,
|
|||
|
|
AccountType int not null,
|
|||
|
|
BusinessId uniqueidentifier not null,
|
|||
|
|
Status int not null,
|
|||
|
|
LastVisitIP varchar(50) not null,
|
|||
|
|
LastVisitTime datetime null,
|
|||
|
|
CreateTime datetime not null,
|
|||
|
|
constraint PK_W_ACCOUNT primary key (Id)
|
|||
|
|
)
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1 from sys.extended_properties
|
|||
|
|
where major_id = object_id('W_Account') and minor_id = 0)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Account')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'UserName')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'UserName'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>˻<EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'UserName'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Account')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'RealName')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'RealName'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>dz<EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'RealName'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Account')
|
|||
|
|
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', 'W_Account', 'column', 'Phone'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'Phone'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Account')
|
|||
|
|
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', 'W_Account', 'column', 'Password'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'Password'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Account')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Secret')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'Secret'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>Կ',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'Secret'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Account')
|
|||
|
|
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', 'W_Account', 'column', 'RoleId'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>ɫID',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'RoleId'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Account')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'AccountType')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'AccountType'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'AccountType'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Account')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'BusinessId')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'BusinessId'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>ͻ<EFBFBD>ID',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'BusinessId'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Account')
|
|||
|
|
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', 'W_Account', 'column', 'Status'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'״̬,0-<2D><><EFBFBD><EFBFBD>,1-<2D><><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'Status'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Account')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'LastVisitIP')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'LastVisitIP'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'LastVisitIP'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Account')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'LastVisitTime')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'LastVisitTime'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'LastVisitTime'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Account')
|
|||
|
|
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', 'W_Account', 'column', 'CreateTime'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'ע<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Account', 'column', 'CreateTime'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
/*==============================================================*/
|
|||
|
|
/* Table: W_AreaInfo */
|
|||
|
|
/*==============================================================*/
|
|||
|
|
create table W_AreaInfo (
|
|||
|
|
Id int not null,
|
|||
|
|
pid int not null,
|
|||
|
|
name nvarchar(100) not null,
|
|||
|
|
code varchar(50) not null,
|
|||
|
|
level int not null
|
|||
|
|
)
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1 from sys.extended_properties
|
|||
|
|
where major_id = object_id('W_AreaInfo') and minor_id = 0)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_AreaInfo'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_AreaInfo'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
/*==============================================================*/
|
|||
|
|
/* Table: W_Business */
|
|||
|
|
/*==============================================================*/
|
|||
|
|
create table W_Business (
|
|||
|
|
Id uniqueidentifier not null,
|
|||
|
|
Code varchar(100) not null,
|
|||
|
|
ParentId uniqueidentifier not null,
|
|||
|
|
Name nvarchar(100) not null,
|
|||
|
|
Phone varchar(20) not null,
|
|||
|
|
Status int not null,
|
|||
|
|
Remark nvarchar(200) not null,
|
|||
|
|
Province varchar(50) not null,
|
|||
|
|
City varchar(50) not null,
|
|||
|
|
Area varchar(50) not null,
|
|||
|
|
Address nvarchar(200) not null,
|
|||
|
|
CreateTime datetime not null,
|
|||
|
|
constraint PK_W_BUSINESS primary key (Id)
|
|||
|
|
)
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1 from sys.extended_properties
|
|||
|
|
where major_id = object_id('W_Business') and minor_id = 0)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>̻<EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Business')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Code')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business', 'column', 'Code'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>̻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business', 'column', 'Code'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Business')
|
|||
|
|
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', 'W_Business', 'column', 'ParentId'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>ϼ<EFBFBD>ID',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business', 'column', 'ParentId'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Business')
|
|||
|
|
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', 'W_Business', 'column', 'Name'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>dz<EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business', 'column', 'Name'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Business')
|
|||
|
|
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', 'W_Business', 'column', 'Phone'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business', 'column', 'Phone'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Business')
|
|||
|
|
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', 'W_Business', 'column', 'Status'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'״̬,0-<2D><><EFBFBD><EFBFBD>,1-<2D><><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business', 'column', 'Status'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Business')
|
|||
|
|
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', 'W_Business', 'column', 'Remark'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>̻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business', 'column', 'Remark'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Business')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Province')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business', 'column', 'Province'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'ʡ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business', 'column', 'Province'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Business')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'City')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business', 'column', 'City'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business', 'column', 'City'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Business')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Area')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business', 'column', 'Area'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business', 'column', 'Area'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Business')
|
|||
|
|
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', 'W_Business', 'column', 'Address'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>ϸ<EFBFBD><EFBFBD>ַ',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business', 'column', 'Address'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Business')
|
|||
|
|
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', 'W_Business', 'column', 'CreateTime'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'ע<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Business', 'column', 'CreateTime'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
/*==============================================================*/
|
|||
|
|
/* Table: W_Device */
|
|||
|
|
/*==============================================================*/
|
|||
|
|
create table W_Device (
|
|||
|
|
Id uniqueidentifier not null,
|
|||
|
|
FacEcode varchar(50) not null,
|
|||
|
|
Ecode varchar(50) not null,
|
|||
|
|
DeviceType int not null,
|
|||
|
|
Name nvarchar(100) not null,
|
|||
|
|
Businessid uniqueidentifier not null,
|
|||
|
|
NetType int not null,
|
|||
|
|
Province varchar(50) not null,
|
|||
|
|
City varchar(50) not null,
|
|||
|
|
Area varchar(50) not null,
|
|||
|
|
Address nvarchar(200) not null,
|
|||
|
|
Remark nvarchar(200) not null,
|
|||
|
|
InstallTime datetime null,
|
|||
|
|
Status int not null,
|
|||
|
|
LastHeartTime datetime null,
|
|||
|
|
CreateTime datetime not null,
|
|||
|
|
constraint PK_W_DEVICE primary key (Id)
|
|||
|
|
)
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1 from sys.extended_properties
|
|||
|
|
where major_id = object_id('W_Device') and minor_id = 0)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>豸<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Device')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'FacEcode')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'FacEcode'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'FacEcode'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Device')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Ecode')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'Ecode'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'Ecode'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Device')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'DeviceType')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'DeviceType'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>豸<EFBFBD>ͺ<EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'DeviceType'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Device')
|
|||
|
|
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', 'W_Device', 'column', 'Name'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'Name'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Device')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Businessid')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'Businessid'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'Businessid'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Device')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'NetType')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'NetType'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ,1-4G,2-Wifi',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'NetType'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Device')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'City')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'City'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'City'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Device')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Area')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'Area'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'Area'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Device')
|
|||
|
|
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', 'W_Device', 'column', 'Address'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>ϸ<EFBFBD><EFBFBD>ַ',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'Address'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Device')
|
|||
|
|
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', 'W_Device', 'column', 'Remark'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>ע',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'Remark'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Device')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'InstallTime')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'InstallTime'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'InstallTime'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Device')
|
|||
|
|
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', 'W_Device', 'column', 'Status'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>豸״̬,0-<2D>쳣,1-<2D><><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'Status'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Device')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'LastHeartTime')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'LastHeartTime'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'LastHeartTime'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Device')
|
|||
|
|
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', 'W_Device', 'column', 'CreateTime'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'ע<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Device', 'column', 'CreateTime'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
/*==============================================================*/
|
|||
|
|
/* Table: W_DeviceData */
|
|||
|
|
/*==============================================================*/
|
|||
|
|
create table W_DeviceData (
|
|||
|
|
DeviceId uniqueidentifier not null,
|
|||
|
|
ICCID varchar(50) not null,
|
|||
|
|
IMEI varchar(50) not null,
|
|||
|
|
IMSI varchar(50) not null,
|
|||
|
|
Longitude varchar(50) not null,
|
|||
|
|
Latitude varchar(50) not null,
|
|||
|
|
LastBeatTime datetime null,
|
|||
|
|
LastStartTime datetime null,
|
|||
|
|
Sign varchar(50) not null,
|
|||
|
|
constraint PK_W_DEVICEDATA primary key (DeviceId)
|
|||
|
|
)
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1 from sys.extended_properties
|
|||
|
|
where major_id = object_id('W_DeviceData') and minor_id = 0)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>豸<EFBFBD><EFBFBD>Ϣ',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_DeviceData')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'ICCID')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'ICCID'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'ICCID',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'ICCID'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_DeviceData')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'IMEI')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'IMEI'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'IMEI',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'IMEI'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_DeviceData')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'IMSI')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'IMSI'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'SIM<EFBFBD><EFBFBD>IMSI',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'IMSI'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_DeviceData')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Longitude')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'Longitude'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'Longitude'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_DeviceData')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Latitude')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'Latitude'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'γ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'Latitude'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_DeviceData')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'LastBeatTime')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'LastBeatTime'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'LastBeatTime'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_DeviceData')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'LastStartTime')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'LastStartTime'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'LastStartTime'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_DeviceData')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Sign')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'Sign'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>ź<EFBFBD>ǿ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceData', 'column', 'Sign'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
/*==============================================================*/
|
|||
|
|
/* Table: W_DeviceRealData */
|
|||
|
|
/*==============================================================*/
|
|||
|
|
create table W_DeviceRealData (
|
|||
|
|
Id uniqueidentifier not null,
|
|||
|
|
DeviceId uniqueidentifier not null,
|
|||
|
|
BusinessId uniqueidentifier not null,
|
|||
|
|
TodayCount int not null,
|
|||
|
|
TotalCount int not null,
|
|||
|
|
TodayWeigth decimal(18,2) not null,
|
|||
|
|
TotalWeight decimal(18,2) not null,
|
|||
|
|
constraint PK_W_DEVICEREALDATA primary key (Id)
|
|||
|
|
)
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1 from sys.extended_properties
|
|||
|
|
where major_id = object_id('W_DeviceRealData') and minor_id = 0)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceRealData'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>豸ʵʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceRealData'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_DeviceRealData')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'DeviceId')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceRealData', 'column', 'DeviceId'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>豸ID',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceRealData', 'column', 'DeviceId'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_DeviceRealData')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'BusinessId')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceRealData', 'column', 'BusinessId'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>̻<EFBFBD>ID',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceRealData', 'column', 'BusinessId'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_DeviceRealData')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'TodayCount')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceRealData', 'column', 'TodayCount'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD>մ<EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceRealData', 'column', 'TodayCount'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_DeviceRealData')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'TotalCount')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceRealData', 'column', 'TotalCount'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>ۼƴ<EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceRealData', 'column', 'TotalCount'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_DeviceRealData')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'TodayWeigth')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceRealData', 'column', 'TodayWeigth'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceRealData', 'column', 'TodayWeigth'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_DeviceRealData')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'TotalWeight')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceRealData', 'column', 'TotalWeight'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>ۼ<EFBFBD>Ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_DeviceRealData', 'column', 'TotalWeight'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
/*==============================================================*/
|
|||
|
|
/* Table: W_Menu */
|
|||
|
|
/*==============================================================*/
|
|||
|
|
create table W_Menu (
|
|||
|
|
Id uniqueidentifier not null,
|
|||
|
|
ParentId uniqueidentifier not null,
|
|||
|
|
Name nvarchar(50) not null,
|
|||
|
|
Icon varchar(50) not null,
|
|||
|
|
UrlAddress varchar(200) not null,
|
|||
|
|
SortCode int not null,
|
|||
|
|
Status int not null,
|
|||
|
|
CreateTime datetime not null,
|
|||
|
|
constraint PK_W_MENU primary key (Id)
|
|||
|
|
)
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1 from sys.extended_properties
|
|||
|
|
where major_id = object_id('W_Menu') and minor_id = 0)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Menu'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>˵<EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Menu'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Menu')
|
|||
|
|
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', 'W_Menu', 'column', 'ParentId'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>ID',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Menu', 'column', 'ParentId'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Menu')
|
|||
|
|
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', 'W_Menu', 'column', 'Name'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Menu', 'column', 'Name'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Menu')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Icon')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Menu', 'column', 'Icon'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'ͼ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Menu', 'column', 'Icon'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Menu')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'UrlAddress')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Menu', 'column', 'UrlAddress'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Menu', 'column', 'UrlAddress'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Menu')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'SortCode')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Menu', 'column', 'SortCode'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Menu', 'column', 'SortCode'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Menu')
|
|||
|
|
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', 'W_Menu', 'column', 'Status'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'״̬',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Menu', 'column', 'Status'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Menu')
|
|||
|
|
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', 'W_Menu', 'column', 'CreateTime'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Menu', 'column', 'CreateTime'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
/*==============================================================*/
|
|||
|
|
/* Table: W_Result */
|
|||
|
|
/*==============================================================*/
|
|||
|
|
create table W_Result (
|
|||
|
|
Id uniqueidentifier not null,
|
|||
|
|
DeviceId uniqueidentifier not null,
|
|||
|
|
BusinessId uniqueidentifier not null,
|
|||
|
|
WasteType varchar(50) not null,
|
|||
|
|
Tare decimal(18,2) not null,
|
|||
|
|
GrossWeight decimal(18,2) not null,
|
|||
|
|
NetWeight decimal(18,2) not null,
|
|||
|
|
Registration nvarchar(200) not null,
|
|||
|
|
CreateTime datetime not null,
|
|||
|
|
constraint PK_W_RESULT primary key (Id)
|
|||
|
|
)
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1 from sys.extended_properties
|
|||
|
|
where major_id = object_id('W_Result') and minor_id = 0)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'Ͷ<EFBFBD>ż<EFBFBD>¼',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Result')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'DeviceId')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result', 'column', 'DeviceId'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>豸ID',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result', 'column', 'DeviceId'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Result')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'BusinessId')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result', 'column', 'BusinessId'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result', 'column', 'BusinessId'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Result')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'WasteType')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result', 'column', 'WasteType'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result', 'column', 'WasteType'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Result')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Tare')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result', 'column', 'Tare'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'Ƥ<EFBFBD><EFBFBD>,<2C><>λKG',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result', 'column', 'Tare'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Result')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'GrossWeight')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result', 'column', 'GrossWeight'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'ë<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result', 'column', 'GrossWeight'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Result')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'NetWeight')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result', 'column', 'NetWeight'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result', 'column', 'NetWeight'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Result')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Registration')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result', 'column', 'Registration'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD>ƺ<EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result', 'column', 'Registration'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Result')
|
|||
|
|
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', 'W_Result', 'column', 'CreateTime'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>ϱ<EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Result', 'column', 'CreateTime'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
/*==============================================================*/
|
|||
|
|
/* Table: W_Role */
|
|||
|
|
/*==============================================================*/
|
|||
|
|
create table W_Role (
|
|||
|
|
Id uniqueidentifier not null,
|
|||
|
|
Name nvarchar(50) not null,
|
|||
|
|
EnCode varchar(50) not null,
|
|||
|
|
Remark nvarchar(200) not null,
|
|||
|
|
CreateTime datetime not null,
|
|||
|
|
constraint PK_W_ROLE primary key (Id)
|
|||
|
|
)
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1 from sys.extended_properties
|
|||
|
|
where major_id = object_id('W_Role') and minor_id = 0)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Role'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>ɫ',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Role'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_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', 'W_Role', 'column', 'Name'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Role', 'column', 'Name'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Role')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'EnCode')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Role', 'column', 'EnCode'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>ɫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Role', 'column', 'EnCode'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_Role')
|
|||
|
|
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', 'W_Role', 'column', 'Remark'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>ע',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Role', 'column', 'Remark'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_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', 'W_Role', 'column', 'CreateTime'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_Role', 'column', 'CreateTime'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
/*==============================================================*/
|
|||
|
|
/* Table: W_RoleAuthorize */
|
|||
|
|
/*==============================================================*/
|
|||
|
|
create table W_RoleAuthorize (
|
|||
|
|
Id uniqueidentifier not null,
|
|||
|
|
RoleId uniqueidentifier not null,
|
|||
|
|
MenuId uniqueidentifier not null,
|
|||
|
|
CreateTime datetime not null,
|
|||
|
|
constraint PK_W_ROLEAUTHORIZE primary key (Id)
|
|||
|
|
)
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1 from sys.extended_properties
|
|||
|
|
where major_id = object_id('W_RoleAuthorize') and minor_id = 0)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_RoleAuthorize'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>ɫ<EFBFBD>˵<EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_RoleAuthorize'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_RoleAuthorize')
|
|||
|
|
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', 'W_RoleAuthorize', 'column', 'RoleId'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>ɫID',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_RoleAuthorize', 'column', 'RoleId'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_RoleAuthorize')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'MenuId')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_RoleAuthorize', 'column', 'MenuId'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD>˵<EFBFBD>ID',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_RoleAuthorize', 'column', 'MenuId'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_RoleAuthorize')
|
|||
|
|
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', 'W_RoleAuthorize', 'column', 'CreateTime'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_RoleAuthorize', 'column', 'CreateTime'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
/*==============================================================*/
|
|||
|
|
/* Table: W_WasteType */
|
|||
|
|
/*==============================================================*/
|
|||
|
|
create table W_WasteType (
|
|||
|
|
Id uniqueidentifier not null,
|
|||
|
|
Code varchar(20) not null,
|
|||
|
|
Name nvarchar(100) not null,
|
|||
|
|
Status int not null,
|
|||
|
|
CreateTime datetime not null,
|
|||
|
|
constraint PK_W_WASTETYPE primary key (Id)
|
|||
|
|
)
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists (select 1 from sys.extended_properties
|
|||
|
|
where major_id = object_id('W_WasteType') and minor_id = 0)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_WasteType'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_WasteType'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_WasteType')
|
|||
|
|
and p.minor_id = (select c.column_id from sys.columns c where c.object_id = p.major_id and c.name = 'Code')
|
|||
|
|
)
|
|||
|
|
begin
|
|||
|
|
declare @CurrentUser sysname
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_dropextendedproperty 'MS_Description',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_WasteType', 'column', 'Code'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_WasteType', 'column', 'Code'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_WasteType')
|
|||
|
|
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', 'W_WasteType', 'column', 'Name'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_WasteType', 'column', 'Name'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_WasteType')
|
|||
|
|
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', 'W_WasteType', 'column', 'Status'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'״̬,0-<2D><><EFBFBD><EFBFBD>,1-<2D><><EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_WasteType', 'column', 'Status'
|
|||
|
|
go
|
|||
|
|
|
|||
|
|
if exists(select 1 from sys.extended_properties p where
|
|||
|
|
p.major_id = object_id('W_WasteType')
|
|||
|
|
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', 'W_WasteType', 'column', 'CreateTime'
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
select @CurrentUser = user_name()
|
|||
|
|
execute sp_addextendedproperty 'MS_Description',
|
|||
|
|
'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>',
|
|||
|
|
'user', @CurrentUser, 'table', 'W_WasteType', 'column', 'CreateTime'
|
|||
|
|
go
|
|||
|
|
|