package com.rongyichuang.judge; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.jdbc.core.JdbcTemplate; import java.util.List; import java.util.Map; @SpringBootTest public class JudgeTableSchemaTest { @Autowired private JdbcTemplate jdbcTemplate; @Test public void testJudgeAvatarData() { try { System.out.println("=== 查看评委数据 ==="); List> judges = jdbcTemplate.queryForList("SELECT id, name, phone FROM t_judge WHERE state = 1 LIMIT 5"); for (Map judge : judges) { System.out.println(String.format("评委ID: %s, 姓名: %s, 电话: %s", judge.get("id"), judge.get("name"), judge.get("phone"))); } System.out.println("\n=== 查看评委头像数据 (target_type=1) ==="); List> avatars = jdbcTemplate.queryForList( "SELECT target_id, path, name FROM t_media WHERE target_type = 1 AND state = 1"); if (avatars.isEmpty()) { System.out.println("没有找到评委头像数据"); } else { for (Map avatar : avatars) { System.out.println(String.format("评委ID: %s, 头像路径: %s, 文件名: %s", avatar.get("target_id"), avatar.get("path"), avatar.get("name"))); } } System.out.println("\n=== 查看所有media数据的target_type分布 ==="); List> typeDistribution = jdbcTemplate.queryForList( "SELECT target_type, COUNT(*) as count FROM t_media WHERE state = 1 GROUP BY target_type"); for (Map row : typeDistribution) { System.out.println(String.format("target_type: %s, 数量: %s", row.get("target_type"), row.get("count"))); } } catch (Exception e) { System.out.println("查询失败: " + e.getMessage()); e.printStackTrace(); } } }