📄 forums_forum_get.prc
字号:
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[forums_Forum_Get]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [forums_Forum_Get]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE forums_Forum_Get
(
@SiteID int,
@UserID int = 0,
@ForumID int = 0,
@ApplicationKey nvarchar(256) = null
)
AS
if(@ApplicationKey is not null)
Begin
Select @ForumID = ForumID FROM forums_Forums where ApplicationKey = @ApplicationKey and SiteID = @SiteID
End
-- Return all the forums
SELECT
F.*,
LastUserActivity = (CASE @UserID
WHEN 0 THEN '1/1/1797'
ELSE ( ISNULL( (SELECT LastActivity FROM forums_ForumsRead WHERE UserID = @UserID AND ForumID = F.ForumID), '1/1/1797'))
END)
FROM
forums_Forums F
WHERE
ForumID = @ForumID and SiteID = @SiteID
exec forums_Forum_Permissions_Get @SiteID, @ForumID
-- -- Return permissions for this user
-- SELECT
-- P.*
-- FROM
-- forums_ForumPermissions P,
-- forums_UserProfile F,
-- aspnet_UsersInRoles R
--
-- WHERE
-- P.RoleID = R.RoleID AND
-- F.MembershipID = R.UserID and
-- (F.UserID = @UserID OR F.UserID = 0) and P.ForumID = @ForumID and P.SiteID = @SiteID and F.SiteID = @SiteID
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -