sozsoft-platform/configs/seeds/host/sql/object/Hr_F_HrSetting.sql
2026-10-04 22:17:16 +03:00

19 lines
681 B
Transact-SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CREATE OR ALTER FUNCTION [dbo].[Hr_F_HrSetting]
(
@TenantId uniqueidentifier,
@Name nvarchar(128)
)
RETURNS nvarchar(2048)
AS
BEGIN
-- Ayar ekranının çözüm sırası (T|G|D): kiracı değeri, genel değer, tanımdaki varsayılan.
RETURN COALESCE(
(SELECT TOP 1 [Value] FROM AbpSettings
WHERE [Name] = @Name AND ProviderName = N'T' AND @TenantId IS NOT NULL
AND ProviderKey = CONVERT(nvarchar(64), @TenantId)),
(SELECT TOP 1 [Value] FROM AbpSettings
WHERE [Name] = @Name AND ProviderName = N'G'),
(SELECT TOP 1 DefaultValue FROM Sas_H_SettingDefinition
WHERE Code = @Name AND IsDeleted = 0));
END
GO