AdolphYang

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

 

/// <summary>
        /// 判断当前用户是否具有指定权限 (如果有为 1)
        /// </summary>
        /// <param name="id">当前用户ID</param>
        /// <param name="powerName">权限名称</param>
        /// <returns>返回查询条数:如果有为 1</returns>
        public long CheckHasPower(long id,string powerName)
        {
            string sql = @"SELECT COUNT(*) FROM (
                                    SELECT ADMINID FROM TD_ADMIN_ROLE WHERE ROLEID IN (
                                    SELECT ROLEID FROM TD_ROLE_POWER WHERE POWERID = (
                                    SELECT ID FROM TD_POWER WHERE NAME = :NAME )
                                    )
                                    ) t WHERE t.ADMINID=:ID ";
           object count = OracleHelper.ExecuteScalar(sql, new OracleParameter(":NAME", powerName),
                                                            new OracleParameter() { ParameterName = ":ID", Value = id }
                                                            );
           return Convert.ToInt64(count);
        }

 

posted on 2015-09-27 11:18  AdolphYang  阅读(569)  评论(0编辑  收藏  举报