/// <summary>
        /// 获取组织机构主键数组通过指定操作权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="permissionItemId">操作权限主键</param>
        /// <returns>主键数组</returns>
        public string[] GetOrganizeIdsByPermissionItemId(UserInfo userInfo, string permissionItemId)
        {
            string[] returnValue = null;
            var      parameter   = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                returnValue = new OrganizePermissionManager(dbProvider, userInfo, PiPermissionTable.TableName).GetOrganizeIds(permissionItemId);
            });
            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="revokePermissionItemId">撤消操作权限主键数组</param>
        /// <returns>影响的行数</returns>
        public int RevokeOrganizePermissionById(UserInfo userInfo, string organizeId, string revokePermissionItemId)
        {
            var returnValue = 0;
            var parameter   = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.PermissionService_RevokeOrganizePermissionById, "组织机构主键:" + organizeId + ",撤消操作权限主键数组:" + revokePermissionItemId);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                if (revokePermissionItemId != null)
                {
                    returnValue += new OrganizePermissionManager(dbProvider, userInfo, PiPermissionTable.TableName).Revoke(organizeId, revokePermissionItemId);
                }
            });
            return(returnValue);
        }
        /// <summary>
        /// 撤消组织机构操作权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="organizeIds">组织机构主键数组</param>
        /// <param name="revokePermissionItemIds">撤消操作权限主键数组</param>
        /// <returns>影响的行数</returns>
        public int RevokeOrganizePermissions(UserInfo userInfo, string[] organizeIds, string[] revokePermissionItemIds)
        {
            var returnValue = 0;
            var parameter   = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                if (organizeIds != null && revokePermissionItemIds != null)
                {
                    returnValue += new OrganizePermissionManager(dbProvider, userInfo, PiPermissionTable.TableName).Revoke(organizeIds, revokePermissionItemIds);
                }
            });
            return(returnValue);
        }
        /// <summary>
        /// 授予指定组织机构指定的操作权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="organizeId">组织机构主键</param>
        /// <param name="grantPermissionItemId">授予操作权限主键</param>
        /// <returns>影响的行数</returns>
        public string GrantOrganizePermissionById(UserInfo userInfo, string organizeId, string grantPermissionItemId)
        {
            string returnValue = string.Empty;
            var    parameter   = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider =>
            {
                if (grantPermissionItemId != null)
                {
                    returnValue = new OrganizePermissionManager(dbProvider, userInfo, PiPermissionTable.TableName).Grant(organizeId, grantPermissionItemId);
                }
            });
            return(returnValue);
        }