//////////////////////////////////////////////////////////////////////////////////////////////////////
        /// 组织机构模块关联关系相关
        //////////////////////////////////////////////////////////////////////////////////////////////////////


        #region public string[] GetScopeModuleIdsByOrganizeId(UserInfo userInfo, string organizeId, string permissionItemCode) 获取指定组织机构在某个权限域下所有模块主键数组
        /// <summary>
        /// 获取指定组织机构在某个权限域下所有模块主键数组
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="organizeId">组织机构主键</param>
        /// <param name="permissionItemCode">操作权限编号</param>
        /// <returns>组织机构主键数组</returns>
        public string[] GetScopeModuleIdsByOrganizeId(UserInfo userInfo, string organizeId, string permissionItemCode)
        {
            string[] returnValue = null;
            var      parameter   = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                returnValue = new OrganizeScopeManage(dbProvider, userInfo, PiPermissionScopeTable.TableName).GetModuleIds(organizeId, permissionItemCode);
            });
            return(returnValue);
        }
        /// <summary>
        /// 清除组织机构权限
        ///
        /// 1.清除组织机构的用户归属。
        /// 2.清除组织机构的模块权限。
        /// 3.清除组织机构的操作权限。
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="organizeId">组织机构主键</param>
        /// <returns>影响的行数</returns>
        public int ClearOrganizePermission(UserInfo userInfo, string organizeId)
        {
            var returnValue = 0;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.PermissionService_ClearOrganizePermission);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                returnValue += new OrganizePermissionManager(dbProvider, userInfo, PiPermissionTable.TableName).RevokeAll(organizeId);
                returnValue += new OrganizeScopeManage(dbProvider, userInfo, PiPermissionScopeTable.TableName).RevokeAll(organizeId);
            });
            return(returnValue);
        }
        /// <summary>
        /// 授予组织机构某个权限域的模块授权范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="organizeId">组织机构主键</param>
        /// <param name="permissionItemCode">操作权限编号</param>
        /// <param name="grantModuleId">授予模块主键</param>
        /// <returns>影响的行数</returns>
        public string GrantOrganizeModuleScope(UserInfo userInfo, string organizeId, string permissionItemCode, string grantModuleId)
        {
            string returnValue = string.Empty;
            var    parameter   = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessRDIWriteDbWithTran(userInfo, parameter, dbProvider =>
            {
                if (grantModuleId != null)
                {
                    returnValue = new OrganizeScopeManage(dbProvider, userInfo).GrantModule(organizeId, permissionItemCode, grantModuleId);
                }
            });
            return(returnValue);
        }
        /// <summary>
        /// 撤消指定组织机构某个权限域的模块授权范围
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="organizeId">组织机构主键</param>
        /// <param name="permissionItemCode">操作权限编号</param>
        /// <param name="revokeModuleId">撤消模块主键数组</param>
        /// <returns>影响的行数</returns>
        public int RevokeOrganizeModuleScope(UserInfo userInfo, string organizeId, string permissionItemCode, string revokeModuleId)
        {
            var returnValue = 0;
            var parameter   = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessRDIWriteDbWithTran(userInfo, parameter, dbProvider =>
            {
                if (revokeModuleId != null)
                {
                    returnValue += new OrganizeScopeManage(dbProvider, userInfo, PiPermissionScopeTable.TableName).RevokeModule(organizeId, permissionItemCode, revokeModuleId);
                }
            });
            return(returnValue);
        }