feat: 框架代码同步 (#344)

Co-authored-by: tk <fiyne1a@dingtalk.com>
This commit is contained in:
2025-08-28 11:47:16 +08:00
committed by GitHub
parent 041f3eeda1
commit 17edb17de9
437 changed files with 10376 additions and 9601 deletions

View File

@@ -0,0 +1,26 @@
CREATE FUNCTION [RM].[fn_GetChannelDealer] (@UserId BIGINT) RETURNS TABLE AS RETURN (
WITH [as_tree_cte] AS (
SELECT
0 AS cte_level,
a.[Id],
a.[OwnerId]
FROM
[RM].[Sys_UserInvite] a
WHERE
(a.[Id] = @UserId) UNION ALL
SELECT
wct1.cte_level + 1 AS cte_level,
wct2.[Id],
wct2.[OwnerId]
FROM
[as_tree_cte] wct1
INNER JOIN [RM].[Sys_UserInvite] wct2 ON wct2.[Id] = wct1.[OwnerId]
) SELECT TOP
1 a.[Id] AS ChannelDealerId
FROM
[as_tree_cte] a
WHERE
a.id <> 370942943322181
ORDER BY
a.cte_level DESC
)