/// <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); }