diff --git a/插件库/Lskj.Business/Impl/BaseModuleImpl.cs b/插件库/Lskj.Business/Impl/BaseModuleImpl.cs index 1725efb..f962420 100644 --- a/插件库/Lskj.Business/Impl/BaseModuleImpl.cs +++ b/插件库/Lskj.Business/Impl/BaseModuleImpl.cs @@ -1034,9 +1034,26 @@ namespace Lskj.Business.Impl where = " and isnull(menutype,0)=0"; break; } - - string sqlValue = string.Format("select * from P_systempopupmenu where isnull(visible,0)=0 and (isnull(privilegeOper,'')='' or charindex(',{0},',','+privilegeOper+',')>0) and tab=@tab ", ERPInfo.Instance.UserName) + where + " order by orderid"; - return SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", key) }); + string sqlTemplate = @"WITH UserRoles AS ( + SELECT r.roleName + FROM p_systemRoleOperSetTab AS ro + JOIN p_systemRoleSetTab AS r ON r.id = ro.roleId + WHERE ro.operatorname = '{0}' + ) + SELECT pm.* + FROM P_systempopupmenu AS pm WITH (NOLOCK) + WHERE ISNULL(pm.visible, 0) = 0 + AND pm.tab = '{1}' + AND ( + ISNULL(pm.privilegeOper, '') = '' + OR CHARINDEX(',' + '{0}' + ',', ',' + pm.privilegeOper + ',') > 0 + OR EXISTS ( + SELECT 1 + FROM UserRoles AS ur + WHERE CHARINDEX('{{&' + ur.roleName + '&}}', pm.privilegeOper) > 0) + ) {2} ORDER BY pm.orderid;"; + string sqlValue = string.Format(sqlTemplate, ERPInfo.Instance.UserName, key, where); + return SqlHelper.ExecuteDataTable(sqlValue); } /// /// 获取单个右键菜单