lrj
6 天以前 4fa9591629721797386fc11836e3a9deb69cd58c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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<Map<String, Object>> judges = jdbcTemplate.queryForList("SELECT id, name, phone FROM t_judge WHERE state = 1 LIMIT 5");
            
            for (Map<String, Object> 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<Map<String, Object>> 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<String, Object> 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<Map<String, Object>> typeDistribution = jdbcTemplate.queryForList(
                "SELECT target_type, COUNT(*) as count FROM t_media WHERE state = 1 GROUP BY target_type");
            
            for (Map<String, Object> 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();
        }
    }
}