-- ============================================
-- 一键更新所有书籍封面
-- 使用说明：
-- 1. 先执行下面的查询语句，查看所有书籍
-- 2. 为每本书找到封面图片URL
-- 3. 在下面的UPDATE语句中填入对应的URL
-- 4. 执行所有UPDATE语句即可
-- ============================================

-- ============================================
-- 第一步：查询所有书籍（先执行这个）
-- ============================================
SELECT 
    `content_id` AS 'ID',
    `title` AS '书名',
    `author` AS '作者',
    `cover_url` AS '当前封面',
    CASE 
        WHEN `content_type` = 1 THEN '电子书'
        WHEN `content_type` = 2 THEN '听书'
    END AS '类型'
FROM `content`
ORDER BY `content_id`;

-- ============================================
-- 第二步：根据查询结果，更新封面URL
-- 请将下面的示例URL替换为真实的封面图片URL
-- ============================================

-- 示例模板（请根据实际查询结果修改）：
-- UPDATE `content` SET `cover_url` = '封面URL' WHERE `content_id` = 书籍ID;

-- 示例1：如果书籍ID为1，书名为"活着"
-- UPDATE `content` SET `cover_url` = 'https://img3.doubanio.com/view/subject/l/public/s1070959.jpg' WHERE `content_id` = 1;

-- 示例2：如果书籍ID为2，书名为"三体"
-- UPDATE `content` SET `cover_url` = 'https://img3.doubanio.com/view/subject/l/public/s2768378.jpg' WHERE `content_id` = 2;

-- 示例3：如果书籍ID为3，书名为"百年孤独"
-- UPDATE `content` SET `cover_url` = 'https://img3.doubanio.com/view/subject/l/public/s1103152.jpg' WHERE `content_id` = 3;

-- ============================================
-- 批量更新模板（复制下面的行，修改ID和URL）
-- ============================================
-- UPDATE `content` SET `cover_url` = 'https://example.com/cover1.jpg' WHERE `content_id` = 1;
-- UPDATE `content` SET `cover_url` = 'https://example.com/cover2.jpg' WHERE `content_id` = 2;
-- UPDATE `content` SET `cover_url` = 'https://example.com/cover3.jpg' WHERE `content_id` = 3;
-- UPDATE `content` SET `cover_url` = 'https://example.com/cover4.jpg' WHERE `content_id` = 4;
-- UPDATE `content` SET `cover_url` = 'https://example.com/cover5.jpg' WHERE `content_id` = 5;
-- ... 继续添加更多书籍

-- ============================================
-- 使用CASE语句批量更新（如果书籍数量较少）
-- ============================================
-- UPDATE `content` 
-- SET `cover_url` = CASE 
--     WHEN `content_id` = 1 THEN 'https://example.com/cover1.jpg'
--     WHEN `content_id` = 2 THEN 'https://example.com/cover2.jpg'
--     WHEN `content_id` = 3 THEN 'https://example.com/cover3.jpg'
--     ELSE `cover_url`
-- END
-- WHERE `content_id` IN (1, 2, 3);

-- ============================================
-- 第三步：验证更新结果（执行后查看）
-- ============================================
-- SELECT `content_id`, `title`, `cover_url` FROM `content` ORDER BY `content_id`;

-- ============================================
-- 获取封面URL的快速方法：
-- 1. 豆瓣读书：https://book.douban.com/ 搜索书名，右键封面复制地址
-- 2. 网络搜索：搜索"书名 封面"，右键图片复制地址
-- 3. 图床服务：上传到七牛云/阿里云OSS等，获取URL
-- ============================================

