-- 查询成语是否在 all_idioms 中，如果存在则返回 1，否则再判断是否在 custom_words 或 all_words 中，存在则返回 0，否则返回 -1
SELECT 
    CASE
        WHEN EXISTS (SELECT 1 FROM all_idioms WHERE idiom = ?) THEN 1
        WHEN EXISTS (SELECT 1 FROM custom_words WHERE word = ?) OR EXISTS (SELECT 1 FROM all_words WHERE word = ?) THEN 0
        ELSE -1
    END AS status;