DELIMITER //

CREATE FUNCTION IF NOT EXISTS omc_get_dict_value(field_value VARCHAR(255), type VARCHAR(255))
RETURNS VARCHAR(255) CHARSET utf8mb4 COLLATE utf8mb4_general_ci
DETERMINISTIC
BEGIN
DECLARE result VARCHAR(255);

SELECT `dict_value` INTO result
FROM `sys_dict_data`
WHERE `dict_label` = field_value AND `dict_type` = type
LIMIT 1;

RETURN result;
END //

DELIMITER ;