--
清理
delete from FunctionGroup
delete from FunctionGroupModule
delete from KeyTable
delete from Module
delete from [ Role ]
delete from RolePerm
delete from UserRole
delete from User2
delete from BaseData2s
delete from SequenceTable
-- 超級管理員
insert into User2(ID,LoginName,Pass)
select 7 , ' admin ' , ' 0192023a7bbd73250516f069df18b500 '
-- 角色
insert into [ Role ] (ID,RoleName)
select 13 ,N ' 超級管理員 '
-- 分配角色
insert into UserRole(ID,Role_ID, [ User_ID ] )
select 19 , 13 , 7
-- 功能分組
insert into Module(ID,ModuleName,URL,Code)
select 1 ,N ' 分組管理 ' , ' /Security/FunctionGroupList.aspx ' , ' FunctionGroupList '
union all
select 2 ,N ' 系統功能管理 ' , ' /Security/ModuleList.aspx ' , ' ModuleList '
union all
select 3 ,N ' 角色權限管理 ' , ' /Security/RoleList.aspx ' , ' RoleList '
union all
select 4 ,N ' 用戶管理 ' , ' /Security/UserList.aspx ' , ' UserList '
union all
select 5 ,N ' 基礎資料 ' , ' /Security/BaseDataList.aspx ' , ' BaseDataList '
union all
select 20 ,N ' 個人信息 ' , ' /Security/PopupControl/UserChangeInfo.aspx ' , ' UserChangeInfo '
union all
select 21 ,N ' 修改密碼 ' , ' /Security/PopupControl/UserChangePWD.aspx ' , ' UserChangePWD '
union all
select 22 ,N ' 任務列表 ' , ' /OfficeMS/TaskList.aspx ' , ' TaskList '
-- 為角色分配權限
insert into RolePerm(ID,Role_ID,Module_ID,AllowOpen,AllowAdd,AllowEdit,AllowDelete)
select 14 , 13 , 1 , 1 , 1 , 1 , 1
union all
select 15 , 13 , 2 , 1 , 1 , 1 , 1
union all
select 16 , 13 , 3 , 1 , 1 , 1 , 1
union all
select 17 , 13 , 4 , 1 , 1 , 1 , 1
union all
select 18 , 13 , 5 , 1 , 1 , 1 , 1
union all
select 28 , 13 , 20 , 1 , 1 , 1 , 1
union all
select 29 , 13 , 21 , 1 , 1 , 1 , 1
union all
select 30 , 13 , 22 , 1 , 1 , 1 , 1
-- 分組
insert into FunctionGroup(ID, [ name ] ,GroupType)
select 6 ,N ' 系統管理 ' , 1
insert into FunctionGroupModule(ID,FunctionGroup_ID,Module_ID)
select 8 , 6 , 1
union all
select 9 , 6 , 2
union all
select 10 , 6 , 3
union all
select 11 , 6 , 4
union all
select 12 , 6 , 5
insert into FunctionGroup(ID, [ name ] ,GroupType)
select 23 ,N ' 個人信息 ' , 1
insert into FunctionGroupModule(ID,FunctionGroup_ID,Module_ID)
select 24 , 23 , 20
union all
select 25 , 23 , 21
insert into FunctionGroup(ID, [ name ] ,GroupType)
select 26 ,N ' 工作管理 ' , 1
insert into FunctionGroupModule(ID,FunctionGroup_ID,Module_ID)
select 27 , 26 , 22
-- 設置KEYTABLE
if ( select count ( * ) from KeyTable) = 0
begin
insert into KeyTable(NextId)
values ( 20 )
end
else if ( select NextId from KeyTable) < 31
begin
update KeyTable set NextId = 31
end
delete from FunctionGroup
delete from FunctionGroupModule
delete from KeyTable
delete from Module
delete from [ Role ]
delete from RolePerm
delete from UserRole
delete from User2
delete from BaseData2s
delete from SequenceTable
-- 超級管理員
insert into User2(ID,LoginName,Pass)
select 7 , ' admin ' , ' 0192023a7bbd73250516f069df18b500 '
-- 角色
insert into [ Role ] (ID,RoleName)
select 13 ,N ' 超級管理員 '
-- 分配角色
insert into UserRole(ID,Role_ID, [ User_ID ] )
select 19 , 13 , 7
-- 功能分組
insert into Module(ID,ModuleName,URL,Code)
select 1 ,N ' 分組管理 ' , ' /Security/FunctionGroupList.aspx ' , ' FunctionGroupList '
union all
select 2 ,N ' 系統功能管理 ' , ' /Security/ModuleList.aspx ' , ' ModuleList '
union all
select 3 ,N ' 角色權限管理 ' , ' /Security/RoleList.aspx ' , ' RoleList '
union all
select 4 ,N ' 用戶管理 ' , ' /Security/UserList.aspx ' , ' UserList '
union all
select 5 ,N ' 基礎資料 ' , ' /Security/BaseDataList.aspx ' , ' BaseDataList '
union all
select 20 ,N ' 個人信息 ' , ' /Security/PopupControl/UserChangeInfo.aspx ' , ' UserChangeInfo '
union all
select 21 ,N ' 修改密碼 ' , ' /Security/PopupControl/UserChangePWD.aspx ' , ' UserChangePWD '
union all
select 22 ,N ' 任務列表 ' , ' /OfficeMS/TaskList.aspx ' , ' TaskList '
-- 為角色分配權限
insert into RolePerm(ID,Role_ID,Module_ID,AllowOpen,AllowAdd,AllowEdit,AllowDelete)
select 14 , 13 , 1 , 1 , 1 , 1 , 1
union all
select 15 , 13 , 2 , 1 , 1 , 1 , 1
union all
select 16 , 13 , 3 , 1 , 1 , 1 , 1
union all
select 17 , 13 , 4 , 1 , 1 , 1 , 1
union all
select 18 , 13 , 5 , 1 , 1 , 1 , 1
union all
select 28 , 13 , 20 , 1 , 1 , 1 , 1
union all
select 29 , 13 , 21 , 1 , 1 , 1 , 1
union all
select 30 , 13 , 22 , 1 , 1 , 1 , 1
-- 分組
insert into FunctionGroup(ID, [ name ] ,GroupType)
select 6 ,N ' 系統管理 ' , 1
insert into FunctionGroupModule(ID,FunctionGroup_ID,Module_ID)
select 8 , 6 , 1
union all
select 9 , 6 , 2
union all
select 10 , 6 , 3
union all
select 11 , 6 , 4
union all
select 12 , 6 , 5
insert into FunctionGroup(ID, [ name ] ,GroupType)
select 23 ,N ' 個人信息 ' , 1
insert into FunctionGroupModule(ID,FunctionGroup_ID,Module_ID)
select 24 , 23 , 20
union all
select 25 , 23 , 21
insert into FunctionGroup(ID, [ name ] ,GroupType)
select 26 ,N ' 工作管理 ' , 1
insert into FunctionGroupModule(ID,FunctionGroup_ID,Module_ID)
select 27 , 26 , 22
-- 設置KEYTABLE
if ( select count ( * ) from KeyTable) = 0
begin
insert into KeyTable(NextId)
values ( 20 )
end
else if ( select NextId from KeyTable) < 31
begin
update KeyTable set NextId = 31
end