sozsoft-platform/configs/seeds/postgres/object/Hr_S_PerformanceFeedbackOpen.sql

32 lines
1.3 KiB
MySQL
Raw Normal View History

2026-10-06 11:24:30 +00:00
CREATE OR REPLACE PROCEDURE public."Hr_S_PerformanceFeedbackOpen"(
p_FeedbackId uuid,
p_ActorId uuid DEFAULT NULL
)
LANGUAGE plpgsql
AS $$
DECLARE
v_ReviewId uuid;
v_ReviewerId uuid;
BEGIN
SELECT "ReviewId", "ReviewerId" INTO v_ReviewId, v_ReviewerId
FROM "Hr_T_PerformanceFeedback"
WHERE "Id" = p_FeedbackId AND "IsDeleted" = FALSE;
IF v_ReviewId IS NULL THEN
RETURN;
END IF;
-- Değerlendirici, değerlendirmenin yetkinlikleri üzerinden puan verir; satırlar burada açılır.
INSERT INTO "Hr_T_PerformanceFeedbackScore" ("Id", "TenantId", "FeedbackId", "SkillId", "IsActive", "CreationTime", "CreatorId", "IsDeleted")
SELECT gen_random_uuid(), c."TenantId", p_FeedbackId, c."SkillId", TRUE, NOW() AT TIME ZONE 'UTC', p_ActorId, FALSE
FROM "Hr_T_PerformanceCompetency" c
WHERE c."ReviewId" = v_ReviewId AND c."IsDeleted" = FALSE
AND NOT EXISTS (
SELECT 1 FROM "Hr_T_PerformanceFeedbackScore" s
WHERE s."FeedbackId" = p_FeedbackId AND s."SkillId" = c."SkillId" AND s."IsDeleted" = FALSE);
CALL public."Hr_S_PerformanceNotify"(v_ReviewId, v_ReviewerId, 'Performans360Talebi',
2026-10-19 14:35:08 +00:00
'Hr.Performance.Notification.Feedback.Subject', 'Hr.Performance.Notification.Feedback.Message', p_ActorId);
2026-10-06 11:24:30 +00:00
END
$$;