SET QUOTED_IDENTIFIER ON 
SET NOCOUNT ON

--v6.5安全版补丁包脚本

--处理用户组冗余数据
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

--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



--v7.0.0升级脚本



--增加微信微课系统参数
if not exists(select * from sitepara where pcode='IsPushwk')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('mobile','IsPushwk','0','15','是否开启微课公众号推送')
GO
if not exists(select * from sitepara where pcode='wkUrl')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('mobile','wkUrl','','16','微课推送服务地址')
GO
if not exists(select * from sitepara where pcode='wkAppoint')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('mobile','wkAppoint','','17','微课推送服务约定字符串')
GO
if not exists(select * from sitepara where pcode='wkPubid')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('mobile','wkPubid','','18','微课公众号ID')
GO
if not exists(select * from sitepara where pcode='wkPubname')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('mobile','wkPubname','','19','微课公众号名称')
GO
if not exists(select * from sitepara where pcode='IsPushwx')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('mobile','IsPushwx','0','20','是否开启微信公众号推送')
GO
if not exists(select * from sitepara where pcode='wxName')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('mobile','wxName','','21','微信公众号名称')
GO
if not exists(select * from sitepara where pcode='wxAccount')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('mobile','wxAccount','','22','微信公众号帐号')
GO
if not exists(select * from sitepara where pcode='wxUrl')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('mobile','wxUrl','','23','微信接口服务器地址')
GO
if not exists(select * from sitepara where pcode='wxToken')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('mobile','wxToken','','24','微信接口令牌')
GO
if not exists(select * from sitepara where pcode='wxAppID')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('mobile','wxAppID','','25','微信平台分配的开发者凭据')
GO
if not exists(select * from sitepara where pcode='wxAppSecret')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('mobile','wxAppSecret','','26','微信平台分配的开发者密钥')
GO
--增加单点登录参数
if not exists(select * from sitepara where pcode='SSOType')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SSO','SSOType','','30','基础平台类型')
GO
if not exists(select * from sitepara where pcode='ServiceUrl')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SSO','ServiceUrl','','31','基础平台服务地址')
GO
if not exists(select * from sitepara where pcode='PassportUrl')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SSO','PassportUrl','','32','Passport验证地址')
GO
if not exists(select * from sitepara where pcode='MemberUrl')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SSO','MemberUrl','','33','Member地址')
GO
if not exists(select * from sitepara where pcode='OfficeUrl')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SSO','OfficeUrl','','34','验证成功后跳转地址')
GO
if not exists(select * from sitepara where pcode='ServerId')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SSO','ServerId','','35','服务ID')
GO
if not exists(select * from sitepara where pcode='ServerKey')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SSO','ServerKey','','36','服务KEY')
GO
if not exists(select * from sitepara where pcode='WebUrl')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SSO','WebUrl','','37','用户请求访问的地址')
GO
if not exists(select * from sitepara where pcode='Root')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SSO','Root','','38','root参数')
GO
if not exists(select * from sitepara where pcode='Control')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SSO','Control','','39','开启基础平台控制')
GO
if not exists(select * from sitepara where pcode='PassportSel')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SSO','PassportSel','','40','启用Passport登录')
GO
--增加短信服务参数
if not exists(select * from sitepara where pcode='ServerName')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SMS','ServerName','','41','短信帐号')
GO
if not exists(select * from sitepara where pcode='ServerPwd')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SMS','ServerPwd','','42','短信密码')
GO
if not exists(select * from sitepara where pcode='UpHost')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SMS','UpHost','','43','上行接口IP')
GO
if not exists(select * from sitepara where pcode='UpPort')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SMS','UpPort','','44','上行接口端口')
GO
if not exists(select * from sitepara where pcode='DownHost')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SMS','DownHost','','45','下行接口IP')
GO
if not exists(select * from sitepara where pcode='DownPort')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SMS','DownPort','','46','下行接口端口')
GO


--增加邮箱参数
if not exists(select * from sitepara where pcode='smtphost')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SMTP','smtphost','','57','SMTP服务器地址')
GO
if not exists(select * from sitepara where pcode='smtpname')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SMTP','smtpname','','59','SMTP服务器身份认证账号')
GO
if not exists(select * from sitepara where pcode='smtppwd')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SMTP','smtppwd','','60','SMTP服务器身份认证密码')
GO
if not exists(select * from sitepara where pcode='smtpadress')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SMTP','smtpadress','','61','发信人邮件地址')
GO
if not exists(select * from sitepara where pcode='smtpfrom')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('SMTP','smtpfrom','','62','发信人显示的名称')
GO

--增加系统参数
if not exists(select * from sitepara where pcode='grade')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysBasic','grade','','63','使用分级浏览机制（系统基本属性）')
GO
if not exists(select * from sitepara where pcode='defaultPassed')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysBasic','defaultPassed','','64','文章默认状态（系统基本属性）')
GO
if not exists(select * from sitepara where pcode='review')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysBasic','review','','65','是否开启评论功能（系统基本属性）')
GO
if not exists(select * from sitepara where pcode='showIp')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysBasic','showIp','','66','是否显示评论者IP地址（系统基本属性）')
GO
if not exists(select * from sitepara where pcode='reviewCheck')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysBasic','reviewCheck','','67','评论默认状态（系统基本属性）')
GO
if not exists(select * from sitepara where pcode='stattime')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysBasic','stattime','0','68','网站访问人数设置')
GO
if not exists(select * from sitepara where pcode='newsDefaultClick')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysBasic','newsDefaultClick','','69','文章初始点击量')
GO
if not exists(select * from sitepara where pcode='showNewHours')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysBasic','showNewHours','','70','信息显示new标志时长')
GO
if not exists(select * from sitepara where pcode='showHotClick')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysBasic','showHotClick','','71','信息显示HOT标志点击量')
GO
if not exists(select * from sitepara where pcode='isAllowNewsUpdtime')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysOther','isAllowNewsUpdtime','1','72','是否允许修改新闻时间')
GO
--增加其他系统参数
if not exists(select * from sitepara where pcode='IsSensitiveWords')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysOther','IsSensitiveWords','','73','是否开启前台敏感词过滤')
GO
if not exists(select * from sitepara where pcode='SWMrPostPlatform')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysOther','SWMrPostPlatform','','74','是否允许敏感词监控发送至运营平台')
GO
if not exists(select * from sitepara where pcode='SWMPostUrl')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysOther','SWMPostUrl','','75','敏感词监控运营平台服务地址')
GO
if not exists(select * from sitepara where pcode='reviewpage')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysOther','reviewpage','8','76','评论显示分页条数')
GO
if not exists(select * from sitepara where pcode='reviewAlternation')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysOther','reviewAlternation','','77','评论发表时间间隔')
GO
if not exists(select * from sitepara where pcode='navGate')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysOther','navGate','','78','导航页浏览权限设置')
GO
if not exists(select * from sitepara where pcode='navPage')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysOther','navPage','','79','导航页文件名')
GO
if not exists(select * from sitepara where pcode='pagesize')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysOther','pagesize','','80','网站全局分页数量')
GO
if not exists(select * from sitepara where pcode='shareNewsUrl')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysOther','shareNewsUrl','','81','主管单位网址')
GO
if not exists(select * from sitepara where pcode='shareNewsTemplateID')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysOther','shareNewsTemplateID','','82','主管单位共享新闻模板')
GO
if not exists(select * from sitepara where pcode='outputCacheTime')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysOther','outputCacheTime','','83','网站页面缓存时间')
GO
if not exists(select * from sitepara where pcode='newsOpenMode')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysOther','newsOpenMode','','84','新闻页打开方式')
GO
if not exists(select * from sitepara where pcode='IsContribute')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysBasic','IsContribute','0','85','是否允许子站投稿')
GO
if not exists(select * from sitepara where pcode='IsAllowCopy')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysOther','IsAllowCopy','1','86','是否使用右键功能')
GO
if not exists(select * from sitepara where pcode='UserPwdRank')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('sysOther','UserPwdRank','3','87','普通用户密码等级设置')
GO
--同步更新系统数据
if (select grade from siteBasicProperty) is not null
update sitepara set pvalue=(select grade from siteBasicProperty) where pcode='grade'
GO
if (select defaultPassed from siteBasicProperty) is not null
update sitepara set pvalue=(select defaultPassed from siteBasicProperty) where pcode='defaultPassed'
GO
if (select review from siteBasicProperty) is not null
update sitepara set pvalue=(select review from siteBasicProperty) where pcode='review'
GO
if (select showIp from siteBasicProperty) is not null
update sitepara set pvalue=(select showIp from siteBasicProperty) where pcode='showIp'
GO
if (select reviewCheck from siteBasicProperty) is not null
update sitepara set pvalue=(select reviewCheck from siteBasicProperty) where pcode='reviewCheck'
GO
if (select top 1 [time] from stat) is not null
update sitepara set pvalue=(select top 1 [time] from stat) where pcode='stattime'
GO
if (select newsDefaultClick from siteOtherProperty) is not null
update sitepara set pvalue=(select newsDefaultClick from siteOtherProperty) where pcode='newsDefaultClick'
GO
if (select showNewHours from siteOtherProperty) is not null
update sitepara set pvalue=(select showNewHours from siteOtherProperty) where pcode='showNewHours'
GO
if (select showHotClick from siteOtherProperty) is not null
update sitepara set pvalue=(select showHotClick from siteOtherProperty) where pcode='showHotClick'
GO
if (select isAllowNewsUpdtime from siteOtherProperty) is not null
update sitepara set pvalue=(select isAllowNewsUpdtime from siteOtherProperty) where pcode='isAllowNewsUpdtime'
GO
if (select SensitiveWordMonitorEnable from siteBasicProperty) is not null
update sitepara set pvalue=(select SensitiveWordMonitorEnable from siteBasicProperty) where pcode='IsSensitiveWords'
GO
if (select SensitiveWordMonitorPostPlatform from siteBasicProperty) is not null
update sitepara set pvalue=(select SensitiveWordMonitorPostPlatform from siteBasicProperty) where pcode='SWMrPostPlatform'
GO
if (select SensitiveWordMonitorPostPlatformServiceUrl from siteBasicProperty) is not null
update sitepara set pvalue=(select SensitiveWordMonitorPostPlatformServiceUrl from siteBasicProperty) where pcode='SWMPostUrl'
GO
if (select reviewAlternation from siteBasicProperty) is not null
update sitepara set pvalue=(select reviewAlternation from siteBasicProperty) where pcode='reviewAlternation'
GO
if (select navGate from siteBasicProperty) is not null
update sitepara set pvalue=(select navGate from siteBasicProperty) where pcode='navGate'
GO
if (select navPage from siteBasicProperty) is not null
update sitepara set pvalue=(select navPage from siteBasicProperty) where pcode='navPage'
GO
if (select pagesize from siteBasicProperty) is not null
update sitepara set pvalue=(select pagesize from siteBasicProperty) where pcode='pagesize'
GO
if (select shareNewsUrl from siteBasicProperty) is not null
update sitepara set pvalue=(select shareNewsUrl from siteBasicProperty) where pcode='shareNewsUrl'
GO
if (select shareNewsLayoutTemplateID from siteBasicProperty) is not null
update sitepara set pvalue=(select shareNewsLayoutTemplateID from siteBasicProperty) where pcode='shareNewsTemplateID'
GO
if (select outputCacheTime from siteBasicProperty) is not null
update sitepara set pvalue=(select outputCacheTime from siteBasicProperty) where pcode='outputCacheTime'
GO
if (select newsOpenMode from siteBasicProperty) is not null
update sitepara set pvalue=(select newsOpenMode from siteBasicProperty) where pcode='newsOpenMode'
GO
if (select IsAllowContribute from siteBasicProperty) is not null
update sitepara set pvalue=(select IsAllowContribute from siteBasicProperty) where pcode='IsContribute'
GO
if (select IsAllowCopy from siteBasicProperty) is not null
update sitepara set pvalue=(select IsAllowCopy from siteBasicProperty) where pcode='IsAllowCopy'
GO

--增加留言本系统参数
if not exists(select * from sitepara where pcode='allowAnonymityAppear')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('messageBoard','allowAnonymityAppear','','88','匿名用户是否能发布留言')
GO
if not exists(select * from sitepara where pcode='isAllowSecrecy')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('messageBoard','isAllowSecrecy','','89','匿名用户发布留言是否保密')
GO
if not exists(select * from sitepara where pcode='isAnonymityAuditing')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('messageBoard','isAnonymityAuditing','','90','匿名用户发布留言是否须经审核')
GO
if not exists(select * from sitepara where pcode='isRegisterAuditing')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('messageBoard','isRegisterAuditing','','91','登录用户发布留言是否须经审核')
GO
if not exists(select * from sitepara where pcode='isShowIp')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('messageBoard','isShowIp','','92','前台是否显示留言者IP')
GO
if not exists(select * from sitepara where pcode='suspendUse')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('messageBoard','suspendUse','','93','暂停留言功能')
GO
if not exists(select * from sitepara where pcode='isShowRespondFlag')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('messageBoard','isShowRespondFlag','','94','是否显示回复标识')
GO
if not exists(select * from sitepara where pcode='showListWidth')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('messageBoard','showListWidth','','95','留言本显示详细列表最小宽度')
GO
--同步更新。
if (select allowAnonymityAppear from messageBoardProperty) is not null
update sitepara set pvalue=(select allowAnonymityAppear from messageBoardProperty) where pcode='allowAnonymityAppear'
GO
if (select isAllowAnonymityAppearSecrecy from messageBoardProperty) is not null
update sitepara set pvalue=(select isAllowAnonymityAppearSecrecy from messageBoardProperty) where pcode='isAllowSecrecy'
GO
if (select isAnonymityAuditing from messageBoardProperty) is not null
update sitepara set pvalue=(select isAnonymityAuditing from messageBoardProperty) where pcode='isAnonymityAuditing'
GO
if (select isRegisterAuditing from messageBoardProperty) is not null
update sitepara set pvalue=(select isRegisterAuditing from messageBoardProperty) where pcode='isRegisterAuditing'
GO
if (select isShowIp from messageBoardProperty) is not null
update sitepara set pvalue=(select isShowIp from messageBoardProperty) where pcode='isShowIp'
GO
if (select suspendUseMessageBoard from messageBoardProperty) is not null
update sitepara set pvalue=(select suspendUseMessageBoard from messageBoardProperty) where pcode='suspendUse'
GO
if (select isShowRespondFlag from messageBoardProperty) is not null
update sitepara set pvalue=(select isShowRespondFlag from messageBoardProperty) where pcode='isShowRespondFlag'
GO
if (select showParticularListWidth from messageBoardProperty) is not null
update sitepara set pvalue=(select showParticularListWidth from messageBoardProperty) where pcode='showListWidth'
GO
--新增上传参数
if not exists(select * from sitepara where pcode='picSize')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('uploadFiles','picSize','','96','图片上传大小限制')
GO
if not exists(select * from sitepara where pcode='flashSize')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('uploadFiles','flashSize','','97','flash上传大小限制')
GO
if not exists(select * from sitepara where pcode='mediaSize')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('uploadFiles','mediaSize','','98','媒体文件上传大小限制')
GO
if not exists(select * from sitepara where pcode='otherSize')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('uploadFiles','otherSize','','99','其他文件上传大小限制')
GO
if not exists(select * from sitepara where pcode='picType')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('uploadFiles','picType','','100','图片格式')
GO
if not exists(select * from sitepara where pcode='flashType')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('uploadFiles','flashType','','101','Flash格式')
GO
if not exists(select * from sitepara where pcode='mediaType')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('uploadFiles','mediaType','','102','媒体格式')
GO
if not exists(select * from sitepara where pcode='otherType')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('uploadFiles','otherType','','103','其它格式')
GO
--同步更新
if (select picSize from uploadFilesProperty) is not null
update sitepara set pvalue=(select picSize from uploadFilesProperty) where pcode='picSize'
GO
if (select flashSize from uploadFilesProperty) is not null
update sitepara set pvalue=(select flashSize from uploadFilesProperty) where pcode='flashSize'
GO
if (select mediaSize from uploadFilesProperty) is not null
update sitepara set pvalue=(select mediaSize from uploadFilesProperty) where pcode='mediaSize'
GO
if (select otherSize from uploadFilesProperty) is not null
update sitepara set pvalue=(select otherSize from uploadFilesProperty) where pcode='otherSize'
GO
if (select picType from uploadFilesProperty) is not null
update sitepara set pvalue=(select picType from uploadFilesProperty) where pcode='picType'
GO
if (select flashType from uploadFilesProperty) is not null
update sitepara set pvalue=(select flashType from uploadFilesProperty) where pcode='flashType'
GO
if (select mediaType from uploadFilesProperty) is not null
update sitepara set pvalue=(select mediaType from uploadFilesProperty) where pcode='mediaType'
GO
if (select otherType from uploadFilesProperty) is not null
update sitepara set pvalue=(select otherType from uploadFilesProperty) where pcode='otherType'
GO
--水印
if not exists(select * from sitepara where pcode='watermarkUseMode')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('watermark','watermarkUseMode','','104','是否启用水印')
GO
if not exists(select * from sitepara where pcode='watermarkStat')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('watermark','watermarkStat','','105','水印类型')
GO
if not exists(select * from sitepara where pcode='watermarkText')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('watermark','watermarkText','','106','文字水印内容')
GO
if not exists(select * from sitepara where pcode='watermarkFontColor')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('watermark','watermarkFontColor','','107','文字水印字体颜色')
GO
if not exists(select * from sitepara where pcode='watermarkShadowColor')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('watermark','watermarkShadowColor','','108','文字水印阴影字体颜色')
GO
if not exists(select * from sitepara where pcode='watermarkShadowSize')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('watermark','watermarkShadowSize','','109','文字水印阴影字体大小')
GO
if not exists(select * from sitepara where pcode='watermarkFontSize')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('watermark','watermarkFontSize','','110','文字水印字体大小')
GO
if not exists(select * from sitepara where pcode='watermarkFont')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('watermark','watermarkFont','','111','文字水印字体')
GO
if not exists(select * from sitepara where pcode='watermarkPic')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('watermark','watermarkPic','','112','水印图片')
GO
if not exists(select * from sitepara where pcode='watermarkPlace')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('watermark','watermarkPlace','','113','水印位置')
GO
if not exists(select * from sitepara where pcode='watermarkClarity')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('watermark','watermarkClarity','','114','水印图片透明效果')
GO
--同步更新
if (select watermarkUseMode from uploadFilesProperty) is not null
update sitepara set pvalue=(select watermarkUseMode from uploadFilesProperty) where pcode='watermarkUseMode'
GO
if (select watermarkStat from uploadFilesProperty) is not null
update sitepara set pvalue=(select watermarkStat from uploadFilesProperty) where pcode='watermarkStat'
GO
if (select watermarkText from uploadFilesProperty) is not null
update sitepara set pvalue=(select watermarkText from uploadFilesProperty) where pcode='watermarkText'
GO
if (select watermarkFontColor from uploadFilesProperty) is not null
update sitepara set pvalue=(select watermarkFontColor from uploadFilesProperty) where pcode='watermarkFontColor'
GO
if (select watermarkShadowColor from uploadFilesProperty) is not null
update sitepara set pvalue=(select watermarkShadowColor from uploadFilesProperty) where pcode='watermarkShadowColor'
GO
if (select watermarkShadowSize from uploadFilesProperty) is not null
update sitepara set pvalue=(select watermarkShadowSize from uploadFilesProperty) where pcode='watermarkShadowSize'
GO
if (select watermarkFontSize from uploadFilesProperty) is not null
update sitepara set pvalue=(select watermarkFontSize from uploadFilesProperty) where pcode='watermarkFontSize'
GO
if (select watermarkFont from uploadFilesProperty) is not null
update sitepara set pvalue=(select watermarkFont from uploadFilesProperty) where pcode='watermarkFont'
GO
if (select watermarkPic from uploadFilesProperty) is not null
update sitepara set pvalue=(select watermarkPic from uploadFilesProperty) where pcode='watermarkPic'
GO
if (select watermarkPlace from uploadFilesProperty) is not null
update sitepara set pvalue=(select watermarkPlace from uploadFilesProperty) where pcode='watermarkPlace'
GO
if (select watermarkClarity from uploadFilesProperty) is not null
update sitepara set pvalue=(select watermarkClarity from uploadFilesProperty) where pcode='watermarkClarity'
GO
--新增用户信息
if not exists(select * from sitepara where pcode='regProtocol')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('RegUser','regProtocol','','115','注册许可协议')
GO
if not exists(select * from sitepara where pcode='forbidLoginExplain')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('RegUser','forbidLoginExplain','','116','所有用户禁止登录说明')
GO
if not exists(select * from sitepara where pcode='allowReg')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('RegUser','allowReg','','117','允许注册')
GO
if not exists(select * from sitepara where pcode='allowLogin')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('RegUser','allowLogin','','120','允许登录')
GO
if not exists(select * from sitepara where pcode='examine')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('RegUser','examine','','121','新用户默认登录状态')
GO
--同步更新
if (select regProtocol from RegUserInfo) is not null
update sitepara set pvalue=(select regProtocol from RegUserInfo) where pcode='regProtocol'
GO
if (select forbidLoginExplain from RegUserInfo) is not null
update sitepara set pvalue=(select forbidLoginExplain from RegUserInfo) where pcode='forbidLoginExplain'
GO
if (select allowReg from RegUserInfo) is not null
update sitepara set pvalue=(select allowReg from RegUserInfo) where pcode='allowReg'
GO
if (select allowLogin from RegUserInfo) is not null
update sitepara set pvalue=(select allowLogin from RegUserInfo) where pcode='allowLogin'
GO
if (select examine from RegUserInfo) is not null
update sitepara set pvalue=(select examine from RegUserInfo) where pcode='examine'
GO
if not exists(select * from sitepara where pcode='keyword')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('unitInfo','keyword','','123','网站关键字')
GO
if not exists(select * from sitepara where pcode='description')
insert into sitepara (ptype,pcode,pvalue,pseq,pnote) values('unitInfo','description','','124','网站描述')
GO

update sitepara set ptype='sysBasic' where pcode='picWidth'
GO
update sitepara set ptype='mobile' where pcode='MbNewsTmpid'
GO
update sitepara set ptype='static' where pcode='IsStatic'
GO
update sitepara set ptype='mobile' where pcode='MbIndex'
GO
update sitepara set ptype='sysBasic' where pcode='IsAllowCtb'
GO
update sitepara set ptype='static' where pcode='IsAutoUpdate'
GO
update sitepara set ptype='mobile' where ptype='weike'
GO
update sitepara set pvalue='0' where pcode='passportsel'
GO
update sitepara set pvalue='0' where pcode='control'
GO
update sitepara set pvalue='0' where pcode='isallowcopy'
GO
--修改栏目类别  留言汇总 发文统计排行
update template set typeid='4' where pkid='69'
GO
update template set typeid='4' where pkid='75'
GO

--新增接口默认参数
if not exists(select * from siteDataex where mcode='pv')
begin
insert into siteDataex (mcode,mname,sql,parameter) values('pv','访问量','select SUM([time]) as pv from stat','dt1,datetime|dt2,datetime')
end
GO

if not exists(select * from siteDataex where mcode='pwdlevel')
begin
insert into siteDataex (mcode,mname,sql,parameter) values('pwdlevel','管理员密码等级','select (select count(*) from users where pkid>0 and pwdlevel = 3 and manageAll = 0) as user_high ,(select count(*) from users where pkid>0 and pwdlevel = 2 and manageAll = 0) as user_middle ,(select count(*) from users where pkid>0 and pwdlevel = 1 and manageAll = 0) as user_low ,(select count(*) from users where pkid>0 and (pwdlevel is null or pwdlevel<1) and manageAll = 0) as user_unknown,(select count(*) from users where pkid>0 and pwdlevel = 3 and manageAll > 0) as admin_high ,(select count(*) from users where pkid>0 and pwdlevel = 2 and manageAll > 0) as admin_middle ,(select count(*) from users where pkid>0 and pwdlevel = 1 and manageAll > 0) as admin_low,(select count(*) from users where pkid>0 and (pwdlevel is null or pwdlevel<1) and manageAll > 0) as admin_unknown','')
end
GO

if not exists(select * from siteDataex where mcode='colpublish')
begin
insert into siteDataex (mcode,mname,sql,parameter) values('colpublish','栏目发文量','select count(n.pkid) as colpublish from news N, bigclass B, users U Where N.bigclassId=B.pkId and N.usersId = U.pkId and N.updatetime >=@dt1 and N.updatetime <=@dt2','dt1,datetime|dt2,datetime')
end
GO

if not exists(select * from siteDataex where mcode='coltotal')
begin
insert into siteDataex (mcode,mname,sql,parameter) values('coltotal','栏目活跃度','select B.name as classname, count(N.pkId) as classnum from news N join bigclass B on N.bigclassId=B.pkId and N.updatetime >=@dt1 and N.updatetime <=@dt2 group by B.name order by classnum desc','dt1,datetime|dt2,datetime')
end
GO

--新增相册栏目
if not exists(select * from template where pkId=80)
begin
SET IDENTITY_INSERT [template] ON
insert into template ([pkId],[name],remark,code,previewTemplate,typeId) values('80','相册','相册','album','album.htm','2')
SET IDENTITY_INSERT [template] OFF
end
GO

if not exists(select * from templatePrivilege where templateid='80')
begin
insert into templatePrivilege (templateId,privilegeId) values('80','1')
insert into templatePrivilege (templateId,privilegeId) values('80','3')
insert into templatePrivilege (templateId,privilegeId) values('80','4')
insert into templatePrivilege (templateId,privilegeId) values('80','5')
insert into templatePrivilege (templateId,privilegeId) values('80','6')
insert into templatePrivilege (templateId,privilegeId) values('80','7')
insert into templatePrivilege (templateId,privilegeId) values('80','8')
insert into templatePrivilege (templateId,privilegeId) values('80','9')
end
GO

--新增图文翻动左右栏目
if not exists(select * from template where pkId=81)
begin
SET IDENTITY_INSERT [template] ON
insert into template ([pkId],name,remark,code,previewTemplate,typeId) values('81','图文翻动左右','图文翻动左右','scrollFlashNews2','scrollFlashNews2.htm','2')
SET IDENTITY_INSERT [template] OFF
end
GO

if not exists(select * from templatePrivilege where templateid='81')
begin
insert into templatePrivilege (templateId,privilegeId) values('81','1')
insert into templatePrivilege (templateId,privilegeId) values('81','3')
insert into templatePrivilege (templateId,privilegeId) values('81','4')
insert into templatePrivilege (templateId,privilegeId) values('81','5')
insert into templatePrivilege (templateId,privilegeId) values('81','6')
insert into templatePrivilege (templateId,privilegeId) values('81','7')
insert into templatePrivilege (templateId,privilegeId) values('81','8')
insert into templatePrivilege (templateId,privilegeId) values('81','9')
end
GO


--以下是升级处理脚本
--如果没有默认pkid=1的账号则新创建一个pkid=1的默认系统管理员账号。
if not exists(select * from users where pkId=1)
begin
SET IDENTITY_Insert users ON   
INSERT INTO Users(pkid,userName, fullName, password, question, answer, sex, born, QQ, email, intro, 
loginIp, loginNum, loginTime, logIp, logTime, tel, photo, examine, gradeId, departmentId,
company, appear, networkTest, Auditing, manageAll, usersGroupId, readInfoType, topRight,
recommandRight, isSbwUser,isDel,pwdlevel) VALUES ('1','wpcms', '浙大万朋', 'E11315E064FE35116227962AF01FE5D2', 
'wpcms', 'wpcms123', '女', '1990-01-01 00:00:00.000', '123456',
'wpcms@zdsoft.net', '初始化默认用户', '192.168.1.68', '0', '2016-08-18 10:30:30.337', '192.168.0.1', '2016-08-18 10:30:30.337', '0582-63563333', '/images/uploadfiles/nopic.gif', 
'1', '1', '1', 'zdsoft', '0', '0', '0', '4','1', '1', '0', '1', '2','0','1')
SET IDENTITY_Insert users OFF 
end
GO

--更新默认pkid=1的账号为系统管理员。wpcms@123
update users set userName='wpcms',password='E11315E064FE35116227962AF01FE5D2',manageall='4',readInfoType='1' where pkid='1'
GO

--修正管理员所属ID
update bigclass set adminid='1'
go
update menu set adminid='1'
go
update layoutTemplate set adminid='1'
go
update librariesTemplate set adminid='1'
go
update banner set adminid='1'
go
update menuset set adminid='1'
go


--把news表中的content值放入newscontent表
IF EXISTS (SELECT name FROM syscolumns WHERE (id = OBJECT_ID(N'news')) AND (name = 'content'))
begin 
if not exists(select 1 from newsContent)
begin
DECLARE @str nvarchar(1000)
SET @str = 'insert into newsContent(newsId,[content]) select pkId,[content] from news'
exec(@str)
end
end 
go

--创建v_news视图
IF EXISTS(SELECT 1 FROM sys.views WHERE name='v_news')
DROP VIEW v_news
GO
CREATE VIEW v_news
AS
SELECT     dbo.news.pkId, dbo.news.intactTitle, dbo.news.useListTitle, dbo.news.passed, dbo.news.updateTime, dbo.news.listTitle, dbo.news.gradeId, dbo.news.gate, 
                      dbo.news.isTop, dbo.news.usersId, dbo.news.bigClassId, dbo.news.Priority, dbo.news.click, dbo.Users.userName, dbo.Users.fullName, dbo.news.validDays, 
                      dbo.news.updateIp, dbo.news.isStatic, dbo.news.staticUrl, dbo.news.isDuplicated, dbo.news.isRecommand, dbo.news.MenuId, dbo.news.AuditUserID, 
                      dbo.news.albumId, dbo.news.imageName, dbo.news.copyfrom
FROM         dbo.news INNER JOIN
                      dbo.Users ON dbo.news.usersId = dbo.Users.pkId
GO


--201703 重新进行分类。
update templateType set type='汇总类' where pkid='6';
GO
update template set typeid='6' where pkid in (28,33,78,75,71,69,7);
GO
update template set typeid='4' where pkid=44;
GO


--201703 对于已经删掉content字段的表不进行处理。20170614修改：判断news表数据和newscontent表数据,若不一致则不修改news表中content字段且提示
IF EXISTS (SELECT name FROM syscolumns WHERE (id = OBJECT_ID(N'news')) AND (name = 'content'))
begin
if (select count(*) from news where content is not null)=(select count(*) from newscontent where content is not null)
begin
update news set content=''
end
else
begin
select [执行结果]='错误: newsContent表未导成功，news.content字段未置空,请检查。'
return
end
end
GO

--201704 重新修改上传格式
update sitepara set pvalue='rar|zip|doc|docx|xls|xlsx|wps|ppt|pdf' where pcode='otherType' 
GO
update sitepara set pvalue='rm|mp3|wav|mid|midi|ra|mpg|mpeg|wma|mov|avi|dat|rmvb|wmv' where pcode='mediaType'
GO

--重置系统权限表 201703
truncate table templatePrivilege
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)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (254, 80, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (255, 80, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (256, 80, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (257, 80, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (258, 80, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (259, 80, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (260, 80, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (261, 81, 1)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (262, 81, 3)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (263, 81, 4)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (264, 81, 5)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (265, 81, 6)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (266, 81, 7)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (267, 81, 8)
INSERT [dbo].[templatePrivilege] ([pkId], [templateId], [privilegeId]) VALUES (268, 81, 9)
SET IDENTITY_INSERT [dbo].[templatePrivilege] OFF


SET NOCOUNT OFF
SET QUOTED_IDENTIFIER OFF 