WITH eps AS (
SELECT operation_type_id
FROM back_office.eps_operation_type
GROUP BY operation_type_id
)
SELECT
t.id AS id,
t.name_for_statement AS operationShortName,
t.code AS code,
t.group_code AS groupCode,
t.name AS name,
t.short_name AS shortName,
t.name_for_statement AS operationNameForStatement,
CASE
WHEN t.display_in_lkk
THEN 'Да'
ELSE 'Нет'
END AS displayInLKK,
CASE
WHEN t.auto_approver
THEN 'Да'
ELSE 'Нет'
END AS autoApprover,
CASE
WHEN eps.operation_type_id IS NOT NULL
THEN 'Да'
ELSE 'Нет'
END AS is_eps,
t.service_type AS serviceType,
t.type_movement AS typeMovement,
en.enum_value AS typeMovementRus,
CASE
WHEN t.display_in_statement
THEN 'Да'
ELSE 'Нет'
END AS displayInStatement,
t.settings_transaction_extended_id,
t.version
FROM back_office.operation_type t
LEFT JOIN eps
ON t.id = eps.operation_type_id
LEFT JOIN ourpension.enums en
ON en.id = t.type_movement
WHERE t.id BETWEEN 192 AND 199
ORDER BY t.id;