-- ==========================================
-- 更新参赛选手的所属单位名称
-- 将测试数据替换为真实合理的武术学校/单位名称
-- ==========================================

-- 武术学校和单位名称列表 (50个真实的单位名称)
-- 包含：武术学校、体育学院、中小学、武馆、体育协会等

-- 更新策略：根据ID分配不同的单位名称

UPDATE martial_athlete SET organization = '北京体育大学武术学院' WHERE id % 50 = 1 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '上海体育学院武术系' WHERE id % 50 = 2 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '河南登封少林寺武术学校' WHERE id % 50 = 3 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '武汉体育学院' WHERE id % 50 = 4 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '成都体育学院' WHERE id % 50 = 5 AND is_deleted = 0;

UPDATE martial_athlete SET organization = '天津体育学院武术系' WHERE id % 50 = 6 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '西安体育学院' WHERE id % 50 = 7 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '沈阳体育学院' WHERE id % 50 = 8 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '广州体育学院武术系' WHERE id % 50 = 9 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '南京体育学院' WHERE id % 50 = 10 AND is_deleted = 0;

UPDATE martial_athlete SET organization = '嵩山少林武术职业学院' WHERE id % 50 = 11 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '河北省武术运动管理中心' WHERE id % 50 = 12 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '山东省武术院' WHERE id % 50 = 13 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '江苏省武术运动协会' WHERE id % 50 = 14 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '浙江大学武术队' WHERE id % 50 = 15 AND is_deleted = 0;

UPDATE martial_athlete SET organization = '清华大学武术协会' WHERE id % 50 = 16 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '北京大学武术队' WHERE id % 50 = 17 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '复旦大学武术社' WHERE id % 50 = 18 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '华南师范大学' WHERE id % 50 = 19 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '首都师范大学' WHERE id % 50 = 20 AND is_deleted = 0;

UPDATE martial_athlete SET organization = '北京市什刹海体育运动学校' WHERE id % 50 = 21 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '上海市第二体育运动学校' WHERE id % 50 = 22 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '深圳市体育运动学校' WHERE id % 50 = 23 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '广东省武术协会' WHERE id % 50 = 24 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '福建省武术队' WHERE id % 50 = 25 AND is_deleted = 0;

UPDATE martial_athlete SET organization = '陈家沟太极拳学校' WHERE id % 50 = 26 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '杨氏太极拳传承中心' WHERE id % 50 = 27 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '武当山武术学校' WHERE id % 50 = 28 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '峨眉山武术学校' WHERE id % 50 = 29 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '青城山武术院' WHERE id % 50 = 30 AND is_deleted = 0;

UPDATE martial_athlete SET organization = '石室中学' WHERE id % 50 = 31 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '成都七中' WHERE id % 50 = 32 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '武侯实验中学' WHERE id % 50 = 33 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '树德中学' WHERE id % 50 = 34 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '成都外国语学校' WHERE id % 50 = 35 AND is_deleted = 0;

UPDATE martial_athlete SET organization = '北京市第四中学' WHERE id % 50 = 36 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '上海中学' WHERE id % 50 = 37 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '杭州学军中学' WHERE id % 50 = 38 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '南京外国语学校' WHERE id % 50 = 39 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '华南师范大学附属中学' WHERE id % 50 = 40 AND is_deleted = 0;

UPDATE martial_athlete SET organization = '中国人民大学附属中学' WHERE id % 50 = 41 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '西北工业大学附属中学' WHERE id % 50 = 42 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '东北师范大学附属中学' WHERE id % 50 = 43 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '重庆巴蜀中学' WHERE id % 50 = 44 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '湖南师范大学附属中学' WHERE id % 50 = 45 AND is_deleted = 0;

UPDATE martial_athlete SET organization = '天津南开中学' WHERE id % 50 = 46 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '郑州外国语学校' WHERE id % 50 = 47 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '西安交通大学附属中学' WHERE id % 50 = 48 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '山东省实验中学' WHERE id % 50 = 49 AND is_deleted = 0;
UPDATE martial_athlete SET organization = '厦门双十中学' WHERE id % 50 = 0 AND is_deleted = 0;

-- 特别处理：为特定的知名选手设置更合适的单位
UPDATE martial_athlete SET organization = '河南省武术运动管理中心' WHERE player_name = '张三丰' AND is_deleted = 0;
UPDATE martial_athlete SET organization = '北京市武术协会' WHERE player_name = '李天龙' AND is_deleted = 0;
UPDATE martial_athlete SET organization = '上海精武体育总会' WHERE player_name = '王小红' AND is_deleted = 0;
UPDATE martial_athlete SET organization = '广东省武术队' WHERE player_name = '赵美丽' AND is_deleted = 0;
UPDATE martial_athlete SET organization = '四川省武术协会' WHERE player_name = '孙燕子' AND is_deleted = 0;

-- 查看更新结果
SELECT
    id,
    player_name,
    organization,
    team_name,
    category
FROM martial_athlete
WHERE is_deleted = 0
ORDER BY id
LIMIT 30;

-- 统计各单位的参赛人数
SELECT
    organization AS '所属单位',
    COUNT(*) AS '参赛人数'
FROM martial_athlete
WHERE is_deleted = 0
GROUP BY organization
ORDER BY COUNT(*) DESC;
