Django orm 批量更新对应的 SQL 语句

UPDATE
    `workingImdbMatchTask`
SET
    `task_json` = CASE
        WHEN (`workingImdbMatchTask`.`id` = 5) THEN 'asds'
        WHEN (`workingImdbMatchTask`.`id` = 8) THEN 'asds'
        WHEN (`workingImdbMatchTask`.`id` = 9) THEN 'asds'
        ELSE NULL
    END
WHERE
    `workingImdbMatchTask`.`id` IN (5, 8, 9);

你可能感兴趣的