关于按权限隐藏功能菜单的使用方法
金蝶云社区-hanjoe
hanjoe
0人赞赏了该文章 1,908次浏览 未经作者许可,禁止转载编辑于2015年08月12日 09:48:49

1、CRM的参数一般是在系统设置--->参数设置里,但按权限隐藏功能菜单这个参数原来做是局部补丁,因此没有放在系统设置里,需要手动执行SQL来放开,SQL如下:
UPDATE t_SystemProfile SET FValue = 1 WHERE FCategory='EBOS' AND FKey='Authority'
GO

如果t_SystemProfile这个表里没上面WHERE FCategory='EBOS' AND FKey='Authority'的记录,则执行如下SQL插入:
IF NOT EXISTS (SELECT 1 FROM t_SystemProfile WHERE FCategory='CRM' AND FKey='Authority')
BEGIN
INSERT INTO t_SystemProfile (FCategory,FKey,FValue,FDescription,FFormat) VALUES ('CRM','Authority','0','CRM是否按权限隐藏单据','INT')

END
GO

2、请确认是否存在存储过程 p_CRM_AUTHORITY,有则执行如下SQL即可:
EXECUTE p_CRM_AUTHORITY
GO

正常的话到这步就OK了

3、如果没有上面的存储过程,则检查是否存在表:CRM_AUTHORITY,没有则执行如下SQL建表:
IF NOT EXISTS (SELECT 1 FROM sysobjects WHERE id = object_id(N'CRM_AUTHORITY') AND xtype = 'U')
BEGIN
CREATE TABLE CRM_AUTHORITY(
[FSubSysID] [int] NOT NULL DEFAULT (0),
[FSubFuncID] [int] NOT NULL DEFAULT (0),
[FDetailFuncID] [int] NOT NULL DEFAULT (0),
[FObjectType] [int] NOT NULL DEFAULT (0),
[FObjectID] [int] NOT NULL DEFAULT (0),
)

END
GO

EXECUTE p_IC_AddIndex @Indexname = 'idx_CRM_AUTHORITY_FDetailFuncID',
@tablename = 'CRM_AUTHORITY',
@FieldName = 'FDetailFuncID',
@IsClustered=0
GO

EXECUTE p_IC_AddIndex @Indexname = 'idx_CRM_AUTHORITY_FSubFuncID',
@tablename = 'CRM_AUTHORITY',
@FieldName = 'FSubFuncID',
@IsClustered=0
GO

EXECUTE p_IC_AddIndex @Indexname = 'idx_CRM_AUTHORITY_FSubSysID',
@tablename = 'CRM_AUTHORITY',
@FieldName = 'FSubSysID',
@IsClustered=0

GO

4、建表后,执行如下SQL创建存储过程:
IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'p_CRM_AUTHORITY' AND xtype = 'P')
DROP PROCEDURE p_CRM_AUTHORITY
GO

CREATE PROCEDURE p_CRM_AUTHORITY
AS

TRUNCATE TABLE CRM_AUTHORITY

----------------------------------------------------------------------------------------------------
--URL字段第一次提取至临时表

select SUBSTRING(t1.furl, CHARINDEX ('FClassTypeId=',t1.furl)+13 ,100) FString ,t1.furl,t1.FDetailFuncID,t1.FSubFuncID,t2.FSubSysID
into #temp
from t_DataFlowDetailFunc t1 inner join t_DataFlowsubFunc t2 on t1.FSubFuncID=t2.FSubFuncID
where t1.furl not like '' and t1.furl like '%FClassTypeId=%'

select SUBSTRING(t1.furl, CHARINDEX ('ReportId=',t1.furl)+9 ,100) Fstring, t1.furl,t1.FDetailFuncID,t1.FSubFuncID,t2.FSubSysID
into #temp2
from t_DataFlowDetailFunc t1 inner join t_DataFlowsubFunc t2 on t1.FSubFuncID=t2.FSubFuncID
where t1.furl not like '' and t1.furl not like '%ExtBOS/StandardReport%' and t1.furl like '%ReportId=%' and t1.furl not like '%Flag=NewRpt%'
and t1.furl not like '%ListTplID=%' and t1.furl not like '%&FClassTypeId=%' --普通系统报表

select SUBSTRING(t1.furl, CHARINDEX ('ReportId=',t1.furl)+9 ,100) Fstring, t1.furl,t1.FDetailFuncID,t1.FSubFuncID,t2.FSubSysID
into #temp3
from t_DataFlowDetailFunc t1 inner join t_DataFlowsubFunc t2 on t1.FSubFuncID=t2.FSubFuncID
where t1.furl not like '' and t1.furl like '%ReportId=%' and t1.furl like '%Flag=NewRpt%' --特殊报表

select SUBSTRING(t1.furl, CHARINDEX ('ReportId=',t1.furl)+9 ,100) Fstring, t1.furl,t1.FDetailFuncID,t1.FSubFuncID,t2.FSubSysID
into #temp4
from t_DataFlowDetailFunc t1 inner join t_DataFlowsubFunc t2 on t1.FSubFuncID=t2.FSubFuncID
where t1.furl not like '' and t1.furl like '%ReportId=%' and t1.furl like '%ListTplID=%' --BOS平台发布直接SQL报表

select SUBSTRING(t1.furl, CHARINDEX ('ReportId=',t1.furl)+9 ,100) Fstring, t1.furl,t1.FDetailFuncID,t1.FSubFuncID,t2.FSubSysID
into #temp5
from t_DataFlowDetailFunc t1 inner join t_DataFlowsubFunc t2 on t1.FSubFuncID=t2.FSubFuncID
where t1.furl not like '' and t1.furl not like '%Flag=NewRpt%'
and t1.furl not like '%ListTplID=%' and t1.furl not like '%ExtBOS/StandardReport%'
and t1.furl like '%ReportId=%'
and t1.furl like '%&FClassTypeId=%' --BOS万能报表发布序时簿类报表

select SUBSTRING(t1.furl, CHARINDEX ('ReportId=',t1.furl)+9 ,100) Fstring, t1.furl,t1.FDetailFuncID,t1.FSubFuncID,t2.FSubSysID
into #temp6
from t_DataFlowDetailFunc t1 inner join t_DataFlowsubFunc t2 on t1.FSubFuncID=t2.FSubFuncID
where t1.furl not like '' and t1.furl like '%ExtBOS/StandardReport%' and t1.furl not like '%Flag=NewRpt%'
and t1.furl not like '%ListTplID=%' and t1.furl not like '%&FClassTypeId=%' --BOS万能报表发布增强SQL类报表

----------------------------------------------------------------------------------------------------
--临时表URL字段二次处理
update #temp
set FString = substring(fstring,0,CHARINDEX ('&',FString))
where charindex('&',fstring)>0

update #temp3
set FString = substring(fstring,0,CHARINDEX ('&',FString))
where charindex('&',fstring)>0

update #temp4
set FString = substring(fstring,CHARINDEX ('&ListTplID=',Fstring)+11 ,100)
where charindex('&',fstring)>0

update #temp5
set FString = substring(fstring,0,CHARINDEX ('&',FString))
where charindex('&',fstring)>0

----------------------------------------------------------------------------------------------------
insert into CRM_AUTHORITY (FSubSysID,FSubFuncID,FDetailFuncID,FObjectType,FObjectID)
select a.FSubSysID,a.FSubFuncID,a.FDetailFuncID , b.FObjectType , b.FObjectID
from #temp a
left join icclasstype b on a.fstring = b.fid

insert into CRM_AUTHORITY (FSubSysID,FSubFuncID,FDetailFuncID,FObjectType,FObjectID)
select a.FSubSysID,a.FSubFuncID,a.FDetailFuncID , b.FRightObjectType , b.FRightObjectID
from #temp2 a
left join ICClassSysReport b on a.fstring = b.FReportID

insert into CRM_AUTHORITY (FSubSysID,FSubFuncID,FDetailFuncID,FObjectType,FObjectID)
select a.FSubSysID,a.FSubFuncID,a.FDetailFuncID , b.FRightObjectType , b.FRightObjectID
from #temp3 a
left join ICClassDevReport b on a.fstring = b.FReportID --特殊报表

insert into CRM_AUTHORITY (FSubSysID,FSubFuncID,FDetailFuncID,FObjectType,FObjectID)
select a.FSubSysID,a.FSubFuncID,a.FDetailFuncID , b.FRightObjectType , b.FRightObjectID
from #temp4 a
left join icclasssqlreport b on a.fstring = b.FListTplID --BOS平台发布直接SQL报表

insert into CRM_AUTHORITY (FSubSysID,FSubFuncID,FDetailFuncID,FObjectType,FObjectID)
select a.FSubSysID,a.FSubFuncID,a.FDetailFuncID , b.FRightObjectType , b.FRightObjectID
from #temp5 a
left join ICClassDevReport b on a.fstring = b.FReportID --BOS万能报表发布序时簿类报表

insert into CRM_AUTHORITY (FSubSysID,FSubFuncID,FDetailFuncID,FObjectType,FObjectID)
select a.FSubSysID,a.FSubFuncID,a.FDetailFuncID , b.FRightObjectType , b.FRightObjectID
from #temp6 a
left join ICClassDevReport b on a.fstring = b.FReportID --BOS万能报表发布增强SQL类报表
GO

5、第一次启动按权限隐藏菜单的参数、或增加自定义菜单的时候,都需要手动执行一次如下SQL:
EXECUTE p_CRM_AUTHORITY
GO