SET QUOTED_IDENTIFIER ON 
SET NOCOUNT ON

--v6.1版青岛定制功能脚本，此次统一集成在v6.3版本中
--sitePara 系统参数


if NOT exists(select * from sitePara where pcode='picWidth')
insert into sitePara(ptype,pcode,pvalue,pseq,pnote)values('sys','picWidth','1000','1','是否开启频道静态页')
if NOT exists(select * from sitePara where pcode='MbNewsTmpid')
insert into sitePara(ptype,pcode,pvalue,pseq,pnote)values('PAGE','MbNewsTmpid','0','2','手机版新闻页模版id')
if NOT exists(select * from sitePara where pcode='IsStatic')
insert into sitePara(ptype,pcode,pvalue,pseq,pnote)values('sys','IsStatic','0','5','是否开启频道页静态化')
if NOT exists(select * from sitePara where pcode='MbIndex')
insert into sitePara(ptype,pcode,pvalue,pseq,pnote)values('PAGE','MbIndex','0','3','手机版首页频道id');
if NOT exists(select * from sitePara where pcode='IsAllowCtb')
insert into sitePara(ptype,pcode,pvalue,pseq,pnote)values('sys','IsAllowCtb','1','10','是否开启子站投稿')
update sitepara set pseq = 5,pnote='是否开启频道静态页' where pcode='IsStatic';

if NOT exists(select * from sitePara where pcode='IsAutoUpdate')
insert into sitePara(ptype,pcode,pvalue,pseq,pnote)values('sys','IsAutoUpdate','1','6','静态页生成是否启用自动更新1自动更新0手动更新')

--新增图文翻动(宽版)栏目
if not exists(select * from template where pkId=77)
insert into template ([name],[remark],[code],[previewTemplate],[typeId])values('图文翻动(宽版)','图文翻动(宽版)','scrollFlashNews1','scrollFlashNews1.htm',2)

GO
--v6.3版新增脚本请在此后开始维护
--新增最新图文翻动栏目
if not exists(select * from template where pkId=78)
insert into template ([name],[remark],[code],[previewTemplate],[typeId])values('最新图文翻动','最新图文翻动','latestscrollFlashNews','latestscrollFlashNews.htm',2)

GO

--增加留言本用到的系统权限
if not exists(select * from privilege where pkId=13)
insert into privilege ([name],nameRemark,accreditValue,accreditRemark,showType,itemEnglish,itemChinese) 
values ('canAuditReply','回复审核','0|1','禁止|允许','Select','forAuditing|audited','待审|通过')
go
if not exists(select * from privilege where pkId=14)
insert into privilege ([name],nameRemark,accreditValue,accreditRemark,showType,itemEnglish,itemChinese) 
values ('defaultReplyPassed','回复默认审核状态','0|1','未审|已审','Select','','')
go



--增加不通过状态 v6.3版20150805 
update privilege set itemEnglish='forAuditing|audited|rejected' ,itemChinese ='待审|通过|不通过' where pkid='1'

GO
--新增信息查询(新版)栏目
if not exists(select * from template where pkId=79)
insert into template ([name],[remark],[code],[previewTemplate],[typeId])values('信息查询(新版)','信息查询(新版)','infoSearch1','infoSearch1.htm',5)

GO

--新增信息查询(新版)栏目权限
if not exists(select * from templatePrivilege where templateid=79)
begin
insert into templatePrivilege (templateId,privilegeId) values ('79','1')
insert into templatePrivilege (templateId,privilegeId) values ('79','4')
insert into templatePrivilege (templateId,privilegeId) values ('79','5')
insert into templatePrivilege (templateId,privilegeId) values ('79','6')
insert into templatePrivilege (templateId,privilegeId) values ('79','7')
insert into templatePrivilege (templateId,privilegeId) values ('79','8')
insert into templatePrivilege (templateId,privilegeId) values ('79','9')
end
go

--修改留言本系统权限
update privilege set itemEnglish='forAuditing|audited|noReply' ,itemChinese ='待审|通过|未回复' where pkid='13'
GO

--增加微课掌上通公众号推送参数
if NOT exists(select * from sitePara where pcode='IsPushwk')
insert into sitePara(ptype,pcode,pvalue,pseq,pnote)values('weike','IsPushwk','0','15','是否开启微课公众号推送');

if NOT exists(select * from sitePara where pcode='wkUrl')
insert into sitePara(ptype,pcode,pvalue,pseq,pnote)values('weike','wkUrl','','16','微课推送服务地址');

if NOT exists(select * from sitePara where pcode='wkAppoint')
insert into sitePara(ptype,pcode,pvalue,pseq,pnote)values('weike','wkAppoint','','17','微课推送服务约定字符串');

if NOT exists(select * from sitePara where pcode='wkPubid')
insert into sitePara(ptype,pcode,pvalue,pseq,pnote)values('weike','wkPubid','','18','微课公众号ID');

if NOT exists(select * from sitePara where pcode='wkPubname')
insert into sitePara(ptype,pcode,pvalue,pseq,pnote)values('weike','wkPubname','','19','微课公众号名称');

GO

----------------------------------------------------------------------
--v6.3版本升级处理脚本
----------------------------------------------------------------------

--处理用户组权限表冗余数据
delete groupAssign where menuId not in (select pkId from menu)
go
--处理用户授权冗余数据
delete moduleAssign where menuId not in (select pkId from menu)
go
--处理抄送信息审核异常数据
update news set passed='1' where passed is null

--需要清理原来列表标题中存放的html标签，检索出数据库中的href=”开头”结束的链接字符
update news set listtitle=left(right(listTitle,len(listTitle)-charindex('href="',listTitle)-5),charindex('"',right(listTitle,len(listTitle)-charindex('href="',listTitle)-5))-1) where charindex('href="',listTitle)>0
go

--取该栏目最新一条新闻的new.Width和height作为menu的默认值
update a set width=(select top 1 width from news d where d.bigclassId=a.bigclassid  order by updateTime desc),
height=(select top 1 height from news d where d.bigclassId=a.bigclassid  order by updateTime desc)
from menu a,bigclass b,template c
where a.bigclassid=b.pkid and b.templateId=c.pkid and c.typeId=2 and a.width is null and a.height is null

go

--批量处理栏目类型名称--v6.1版本更过一次。此处重复执行防止遗漏。
update template set [name]='网站搜索(无选择条件)' where pkid='17'
GO
update template set [name]='会员登录(横向)' where pkid='18'
GO
update template set [name]='网站搜索(无选择条件)' where pkid='17'
GO
update template set [name]='新闻点击排行' where pkid='7'
GO

--修改templateType表中数据--v6.1版本更过一次。此处重复执行防止遗漏。此处分类影响图文类栏目指定默认图片宽高。
--1.新闻类2.图文类3.链接类4.互动类5.工具类
update templatetype set [name]='news',type='新闻类' where pkid='1'
GO
UPDATE templateType SET [name] ='picVedio',type ='图文类' where pkId='2'
GO
UPDATE templateType SET [name] ='interact',type ='互动类'  where pkId='4'
GO
UPDATE templateType SET [name] ='tool' ,type = '功能类' where pkId='5' 
GO
update template set typeId='1' where pkid in (1,5,7,10,13,23,28,36)
GO
update template set typeId='2' where pkid in (6,12,24,25,26,27,43,71)
GO
update template set typeId='3' where pkid='37'
GO
update template set typeId='4' where pkid in (14,22,32,33,45,46,47,48,60,63,65)
GO
update template set typeId='5' where pkid in (9,11,15,16,17,18,19,30,58,65,66,67,69,72,73,74)
GO
update template set typeId='6' where pkid in (49,50,51,52,53,54,55,56,57,62,64,68,70)
GO

--浏览权限:批量更新【仅外网用户访问2】改为【无限制0】
update news set gate='0' where gate='2' 
go

--初始化数据将留言回复审核设置为通过
update messageboard set reAudit='1' 
go

--用户权限：批量追加留言本、留言问答栏目回复审核权限，默认通过
update moduleAssign set privilegeset= privilegeset+'|canAuditReply=1|defaultReplyPassed=1' 
where menuid in ( 
select pkid from menu where modeid=4 and bigclassid in (select pkid from bigclass where templateid in (32,63) )) 
and privilegeset not like '%canAuditReply%'
go

--用户组权限：批量追加留言本、留言问答栏目在回复审核权限，默认通过
update groupAssign set privilegeset= privilegeset+'|canAuditReply=1|defaultReplyPassed=1' 
where menuid in ( 
select pkid from menu where modeid=4 and bigclassid in (select pkid from bigclass where templateid in (32,63) )) 
and privilegeset not like '%canAuditReply%'
go

--删除网站调查栏目的冗余权限信息
delete from templatePrivilege where templateid='14' and privilegeid='8'
go
delete from templatePrivilege where templateid='14' and privilegeid='9'
go




--处理用户组冗余数据
delete groupAssign where menuId not in (select pkId from menu)
GO
--处理用户授权冗余数据
delete moduleAssign where menuId not in (select pkId from menu)
GO
--处理抄送信息审核异常数据
update news set passed='1' where passed is null
GO

--20170427 
--先清理栏目权限关系表  防止引起外键约束删除失败。
truncate table templatePrivilege 
GO
--清理PKID大于74的栏目。
delete template where pkId > 74
GO


--20170427  v6.1版本增加了两个栏目：发文统计排行、文章列表(头条)
--新增发文统计排行栏目
if not exists(select * from template where pkId=75)
begin
SET IDENTITY_INSERT [template] ON
insert into template ([pkId],[name],[remark],[code],[previewTemplate],[typeId])values('75','发文统计排行','发文统计排行','releaseTop','releaseTop.htm',5)
SET IDENTITY_INSERT [template] OFF
end
GO

--新增文章列表（头条）栏目
if not exists(select * from template where pkId=76)
begin
SET IDENTITY_INSERT [template] ON
insert into template ([pkId],[name],[remark],[code],[previewTemplate],[typeId])values('76','文章列表(头条)','文章列表(头条)','news1','news1.htm',1)
SET IDENTITY_INSERT [template] OFF
end
GO


--20170427 增加修复系统栏目表的数据   v6.5增加了三个栏目： 图文翻动(宽版)、最新图文翻动、信息查询(新版)
--新增图文翻动(宽版)栏目
if not exists(select * from template where pkId=77)
begin
SET IDENTITY_INSERT [dbo].[template] ON
insert into template ([pkId],[name],[remark],[code],[previewTemplate],[typeId])values('77','图文翻动(宽版)','图文翻动(宽版)','scrollFlashNews1','scrollFlashNews1.htm',2)
SET IDENTITY_INSERT [dbo].[template] OFF
end
GO

--v6.3版新增脚本请在此后开始维护
--新增最新图文翻动栏目
if not exists(select * from template where pkId=78)
begin
SET IDENTITY_INSERT [template] ON
insert into template ([pkId],[name],[remark],[code],[previewTemplate],[typeId])values('78','最新图文翻动','最新图文翻动','latestscrollFlashNews','latestscrollFlashNews.htm',2)
SET IDENTITY_INSERT [template] OFF
end
GO

--新增信息查询(新版)栏目
if not exists(select * from template where pkId=79)
begin
SET IDENTITY_INSERT [template] ON
insert into template ([pkId],[name],[remark],[code],[previewTemplate],[typeId])values('79','信息查询(新版)','信息查询(新版)','infoSearch1','infoSearch1.htm',5)
SET IDENTITY_INSERT [template] OFF
end
GO


--20170427 v6.5  增加修复系统权限表13、14两个状态
--增加留言本用到的系统权限
delete privilege where pkId > 12
GO


if not exists(select * from privilege where pkId=13)
begin
SET IDENTITY_INSERT [privilege] ON
insert into privilege ([pkId],[name],nameRemark,accreditValue,accreditRemark,showType,itemEnglish,itemChinese) 
values ('13','canAuditReply','回复审核','0|1','禁止|允许','Select','forAuditing|audited','待审|通过')
SET IDENTITY_INSERT [privilege] OFF
end
go

if not exists(select * from privilege where pkId=14)
begin
SET IDENTITY_INSERT [privilege] ON
insert into privilege ([pkId],[name],nameRemark,accreditValue,accreditRemark,showType,itemEnglish,itemChinese) 
values ('14','defaultReplyPassed','回复默认审核状态','0|1','未审|已审','Select','','')
SET IDENTITY_INSERT [privilege] OFF
end
go


--重置v6.5系统栏目权限关系表 201704
GO
SET IDENTITY_INSERT [dbo].[templatePrivilege] ON
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (1, 1, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (2, 1, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (3, 1, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (4, 1, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (5, 1, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (6, 1, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (7, 3, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (8, 3, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (9, 3, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (10, 3, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (11, 3, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (12, 4, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (13, 4, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (14, 4, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (15, 4, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (16, 4, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (17, 5, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (18, 5, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (19, 5, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (20, 5, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (21, 5, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (22, 6, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (23, 6, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (24, 6, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (25, 6, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (26, 6, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (27, 12, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (28, 12, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (29, 12, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (30, 12, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (31, 12, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (32, 12, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (33, 14, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (34, 14, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (35, 14, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (36, 15, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (37, 15, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (38, 15, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (39, 15, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (40, 15, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (41, 16, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (42, 16, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (43, 16, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (44, 16, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (45, 16, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (46, 23, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (47, 23, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (48, 23, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (49, 23, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (50, 23, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (51, 23, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (52, 24, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (53, 24, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (54, 24, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (55, 24, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (56, 24, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (57, 24, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (58, 25, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (59, 25, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (60, 25, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (61, 25, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (62, 25, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (63, 25, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (64, 26, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (65, 26, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (66, 26, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (67, 26, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (68, 26, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (69, 26, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (70, 27, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (71, 27, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (72, 27, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (73, 27, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (74, 27, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (75, 27, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (76, 32, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (77, 32, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (78, 32, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (79, 32, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (80, 32, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (81, 34, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (82, 34, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (83, 34, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (84, 34, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (85, 34, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (86, 35, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (87, 35, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (88, 35, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (89, 35, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (90, 35, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (91, 36, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (92, 36, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (93, 36, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (94, 36, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (95, 36, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (96, 36, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (97, 37, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (98, 37, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (99, 37, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (100, 37, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (101, 37, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (102, 45, 2)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (103, 45, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (104, 45, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (105, 45, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (106, 45, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (107, 45, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (108, 1, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (109, 3, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (110, 4, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (111, 5, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (112, 6, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (113, 12, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (115, 15, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (116, 16, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (117, 23, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (118, 24, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (119, 25, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (120, 26, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (121, 27, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (122, 32, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (123, 34, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (124, 35, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (125, 36, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (126, 37, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (127, 1, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (128, 3, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (129, 4, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (130, 5, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (131, 6, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (132, 12, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (134, 15, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (135, 16, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (136, 23, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (137, 24, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (138, 25, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (139, 26, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (140, 27, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (141, 32, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (142, 34, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (143, 35, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (144, 36, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (145, 37, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (146, 43, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (147, 43, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (148, 43, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (149, 43, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (150, 43, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (151, 43, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (152, 43, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (153, 43, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (154, 49, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (155, 49, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (156, 49, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (157, 49, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (158, 49, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (159, 49, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (160, 49, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (161, 49, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (162, 50, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (163, 50, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (164, 50, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (165, 50, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (166, 50, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (167, 50, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (168, 50, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (169, 50, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (170, 53, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (171, 53, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (172, 53, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (173, 53, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (174, 53, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (175, 53, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (176, 53, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (177, 53, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (178, 54, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (179, 54, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (180, 54, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (181, 54, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (182, 54, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (183, 54, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (184, 54, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (185, 54, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (186, 58, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (187, 58, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (192, 60, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (193, 60, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (194, 60, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (198, 9, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (199, 17, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (200, 62, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (201, 63, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (202, 63, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (203, 63, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (204, 63, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (205, 63, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (206, 63, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (207, 63, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (208, 65, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (209, 65, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (210, 65, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (211, 65, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (212, 65, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (213, 65, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (214, 65, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (215, 64, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (216, 64, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (217, 64, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (218, 64, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (219, 64, 10)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (220, 64, 11)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (221, 64, 12)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (222, 67, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (223, 70, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (224, 70, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (225, 70, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (226, 76, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (227, 76, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (228, 76, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (229, 76, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (230, 76, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (231, 76, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (232, 76, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (233, 76, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (234, 77, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (235, 77, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (236, 77, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (237, 77, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (238, 77, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (239, 77, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (240, 77, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (241, 77, 9)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (242, 32, 13)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (243, 32, 14)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (244, 63, 13)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (245, 63, 14)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (246, 79, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (247, 79, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (248, 79, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (249, 79, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (250, 79, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (251, 79, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (252, 79, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (253, 79, 9)
SET IDENTITY_INSERT [dbo].[templatePrivilege] OFF

SET NOCOUNT OFF
SET QUOTED_IDENTIFIER OFF 